-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8c89a5e
commit e571a8e
Showing
12 changed files
with
114 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,3 +15,5 @@ | |
/log/* | ||
!/log/.keep | ||
/tmp | ||
|
||
/spring/*.pid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
guard :minitest, spring: true, all_on_start: false do | ||
# with Minitest::Unit | ||
watch(%r{^test/(.*)/?(.*)_test\.rb$}) | ||
watch('test/test_helper.rb') { 'test' } | ||
watch('config/routes.rb') { integration_tests } | ||
watch(%r{^app/models/(.*?)\.rb$}) do |matches| | ||
"test/models/#{matches[1]}_test.rb" | ||
end | ||
|
||
watch(%r{^app/controllers/(.*?)_controller\.rb$}) do |matches| | ||
resource_tests(matches[1]) | ||
end | ||
watch(%r{^app/views/([^/]*?)/.*\.html\.erb$}) do |matches| | ||
["test/controllers/#{matches[1]}_controller_test.rb"] + | ||
integration_tests(matches[1]) | ||
end | ||
watch(%r{^app/helpers/(.*?)_helper\.rb$}) do |matches| | ||
integration_tests(matches[1]) | ||
end | ||
watch('app/views/layouts/application.html.erb') do | ||
'test/integration/site_layout_test.rb' | ||
end | ||
watch('app/helpers/sessions_helper.rb') do | ||
integration_tests << 'test/helpers/sessions_helper_test.rb' | ||
end | ||
watch('app/controllers/sessions_controller.rb') do | ||
['test/controllers/sessions_controller_test.rb', | ||
'test/integration/users_login_test.rb'] | ||
end | ||
watch('app/controllers/account_activations_controller.rb') do | ||
'test/integration/users_signup_test.rb' | ||
end | ||
watch(%r{app/views/users/*}) do | ||
resource_tests('users') + | ||
['test/integration/microposts_interface_test.rb'] | ||
end | ||
end | ||
|
||
def integration_tests(resource = :all) | ||
if resource == :all | ||
Dir["test/integration/*"] | ||
else | ||
Dir["test/integration/#{resource}_*.rb"] | ||
end | ||
end | ||
|
||
def controller_test(resource) | ||
"test/controllers/#{resource}_controller_test.rb" | ||
end | ||
|
||
def resource_tests(resource) | ||
integration_tests(resource) << controller_test(resource) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,7 @@ def help | |
|
||
def about | ||
end | ||
|
||
def contact | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,13 @@ | ||
module ApplicationHelper | ||
|
||
def full_title(page_title = '') | ||
base_title = "Ruby on Rails Tutorial Sample App" | ||
if page_title.empty? | ||
base_title | ||
else | ||
"#{page_title} | #{base_title}" | ||
end | ||
end | ||
|
||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title><%= yield :title %> | Ruby on Rails Tutorial Sample App</title> | ||
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> | ||
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> | ||
<%= csrf_meta_tags %> | ||
</head> | ||
<body> | ||
<head> | ||
<title><%= full_title(yield(:title)) %></title> | ||
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> | ||
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> | ||
<%= csrf_meta_tags %> | ||
</head> | ||
<body> | ||
|
||
<%= yield %> | ||
<%= yield %> | ||
|
||
</body> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<% provide(:title, "Contact") %> | ||
|
||
<h1>Contact Page</h1> | ||
<p>This is where you can find our contacts</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
<% provide(:title, 'Home') %> | ||
<h1>Sample app</h1> | ||
<p>This is the home page we don't know what is yet to come</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# Be sure to restart your server when you modify this file. | ||
|
||
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. | ||
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } | ||
Rails.backtrace_cleaner.add_silencer { |line| line =~ /rvm/ } | ||
|
||
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. | ||
# Rails.backtrace_cleaner.remove_silencers! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# encoding: UTF-8 | ||
# This file is auto-generated from the current state of the database. Instead | ||
# of editing this file, please use the migrations feature of Active Record to | ||
# incrementally modify your database, and then regenerate this schema definition. | ||
# | ||
# Note that this schema.rb definition is the authoritative source for your | ||
# database schema. If you need to create the application database on another | ||
# system, you should be using db:schema:load, not running all the migrations | ||
# from scratch. The latter is a flawed and unsustainable approach (the more migrations | ||
# you'll amass, the slower it'll run and the greater likelihood for issues). | ||
# | ||
# It's strongly recommended that you check this file into your version control system. | ||
|
||
ActiveRecord::Schema.define(version: 0) do | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,31 @@ | ||
require 'test_helper' | ||
|
||
class StaticPagesControllerTest < ActionController::TestCase | ||
def setup | ||
@base_title = "| Ruby on Rails Tutorial Sample App" | ||
end | ||
test "should get home" do | ||
get :home | ||
assert_response :success | ||
assert_select "title", "Home | Ruby on Rails Tutorial Sample App" | ||
assert_select "title", "Ruby on Rails Tutorial Sample App" | ||
end | ||
|
||
test "should get help" do | ||
get :help | ||
assert_response :success | ||
assert_select "title", "Help | Ruby on Rails Tutorial Sample App" | ||
assert_select "title", "Help #{@base_title}" | ||
end | ||
|
||
test "should get about" do | ||
get :about | ||
assert_response :success | ||
assert_select "title", "About | Ruby on Rails Tutorial Sample App" | ||
assert_select "title", "About #{@base_title}" | ||
end | ||
|
||
test "should get contact" do | ||
get :contact | ||
assert_response :success | ||
assert_select "title", "Contact #{@base_title}" | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters