Last active
December 15, 2015 22:59
-
-
Save maasha/5337159 to your computer and use it in GitHub Desktop.
1) Scaffold pages show Failure/Error: visit user_scaffold_path(user, user.scaffolds.first) ActionView::Template::Error: undefined method `name' for nil:NilClass # ./app/views/scaffolds/show.html.erb:1:in `_app_views_scaffolds_show_html_erb___4043736085633253445_70230076755880' # ./spec/requests/scaffold_pages_spec.rb:46:in `block (3 levels) in …
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
require 'spec_helper' | |
describe "User Pages" do | |
subject { page } | |
describe "index" do | |
let(:user) { FactoryGirl.create(:user) } | |
it { should have_selector('title', text: 'All scaffolds') } | |
it { should have_selector('h1', text: 'All scaffolds') } | |
it "should list each scaffold" do | |
user.scaffolds.each do |scaffold| | |
it { should have_selector('title', text: 'All scaffolds') } | |
it { should have_selector('h1', text: 'All scaffolds') } | |
it { should have_selector('h1', text: 'All scaffolds') } | |
it "should list each scaffold" do | |
user.scaffolds.each do |scaffold| | |
page.should have_selector('li', text: scaffold.name) | |
end | |
end | |
describe "pagination" do | |
before(:all) { 31.times { FactoryGirl.create(:scaffold, user: user) } } | |
after(:all) { User.delete_all } | |
it { should have_selector('div.pagination') } | |
it "should list each scaffold" do | |
user.scaffolds.paginate(page: 1, per_page: Scaffold::PER_PAGE).each do |scaffold| | |
page.should have_selector('li', text: scaffold.name) | |
end | |
end | |
end | |
end | |
describe "show" do | |
let(:user) { FactoryGirl.create(:user) } | |
before do | |
sign_in user | |
FactoryGirl.create(:scaffold, user: user) | |
Rails.logger.debug user_scaffold_path(user, user.scaffolds.first).to_yaml | |
visit user_scaffold_path(user, user.scaffolds.first) | |
end | |
it { should have_selector('title', text: user.scaffolds.first.name) } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment