Wednesday, July 18, 2012

[Rails] Re: Re: Re: Re: Re: Re: Re: Re: Static Pages from Railcast

Colin Law wrote in post #1069168:
> On 17 July 2012 23:57, Jean-Sbastien D. <lists@ruby-forum.com> wrote:
>>>
>> getting error
>> Failure/Error: visit '/static_pages/home'
>>
>> rspec ./spec/requests/static_pages_spec.rb:6 # Static pages Home page
>> should have the content 'Sample App'
>>
>> Why would visit not be defined? Thanks for your help, not sure why its
>> gives me this
>
> My best guess would be that you have an error in the test code. If
> you cannot see it then post static_pages_spec.rb here. Copy/paste it
> from your actual code so we can check for typos.
>
> Colin

Lol here what I have

spec/requests/static_pages_spec.rb
describe "Static pages" do

describe "Home page" do
it "should have the content 'Sample App'" do
visit '/static_pages/home'
page.should have_content('Sample App')
end
end
end

app/views/layouts/application.html.erb
<!DOCTYPE html>
<html>
<head>
<title><%= full_title(yield(:title)) %></title>
<<%= full_meta_description(yield(:meta_description)) %> />
<<%= full_meta_keyword(yield(:meta_keyword)) %> />
<<%= full_meta_author(yield(:meta_author)) %> />

<%= stylesheet_link_tag "application", media: "all" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
<%= render 'layouts/shim' %>
</head>
<body>
<%= render 'layouts/header' %>
<div class="container">
<% flash.each do |key, value| %>
<div class="alert alert-<%= key %>"><%= value %></div>
<% end %>
<%= yield %>
<%= render 'layouts/footer' %>
<%= debug(params) if Rails.env.development? %>
</div>
</body>
</html>

app/views/static_pages/home.html.erb
Sample App
<div class="left_column">
</div>
<div class="right_column">
<%= link_to "Sign Up", 'signup_path' %>
</div>

And do as follow to run the test
bundle exec rspec spec/requests/static_pages_spec.rb

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate