Witam, w chwilach wolnego walczę sobie z ror i tym razem napotkałem problem zapewne banalny i więcej sie tu nawklejam niż to warte ale coś nie moge sobie poradzić.
[code]require ‘spec_helper’
describe PagesController do
render_views
describe “GET ‘home’” do
it “should be successful” do
get ‘home’
response.should be_success
end
it "should have the right title" do
get 'home'
response.should have_selector("title",
:content => "Ruby on Rails Tutorial Sample App | Home")
end
end
describe “GET ‘contact’” do
it “should be successful” do
get ‘contact’
response.should be_success
end
it "should have the right title" do
get 'contact'
response.should have_selector("title",
:content =>
"Ruby on Rails Tutorial Sample App | Contact")
end
end
describe “GET ‘about’” do
it “should be successful” do
get ‘about’
response.should be_success
end
it "should have the right title" do
get 'about'
response.should have_selector("title",
:content =>
"Ruby on Rails Tutorial Sample App | About")
end
end
describe “GET ‘help’” do
it “should should be successful” do
get ‘help’
response.should be_success
end
it “should have the right title” do
get ‘help’
response.should have_selector(“title”,
:content=>
“Ruby on Rails tutorial Sample App | Help”)
end
end
end[/code]
wg tutka mialem dopisac test dla strony Help oraz ją dorobić napisałem to co powyżej.
Dodałem :
get "pages/help"
do routes.rb
oraz :
[code]
Help
Ruby on Rails Tutorial is a project to make a book and screencasts to teach web development with Ruby on Rails. This is the sample application for the tutorial.
[/code] utworzyłem widok dla page/helpapp/views/layouts/application.html.erb wyglada tak
[code]
Ruby on Rails Tutorial Sample App | <%= @title %><%= csrf_meta_tag %>
<%= yield %>
[/code] pages_controller.rb wyglada tak: [code]class PagesController < ApplicationController def home @title="Home" enddef contact
@title=“Contact”
end
def about
@title=“About”
end
def help
@title=“Help”
end
end[/code]
Wiec chyba nic nie pominąłem ale terminal cały czas wypluwa:
[code]Failures:
-
PagesController GET ‘help’ should have the right title
Ruby on Rails Tutorial Sample App | Help
Failure/Error: response.should have_selector(“title”,
expected following output to contain a Ruby on Rails tutorial Samp
e App | Help tag:<h1>Help</h1>
Ruby on Rails Tutorial is a project to make a book and screencasts to teach web development with Ruby on Rails. This is the sample application for the tutorial.
# ./spec/controllers/pages_controller_spec.rb:55:in `block (3 levels) in <t
p (required)>’
inished in 5.22 seconds
12 examples, 1 failure, 4 pending
failed examples:
spec ./spec/controllers/pages_controller_spec.rb:53 # PagesController GET 'help
should have the right title[/code]
Czy ktoś będzie tak miły i zechce mi uświadomić co pomijam? Dziękuje