Skip to content

Instantly share code, notes, and snippets.

@maasha
Last active December 15, 2015 20:29
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save maasha/5319035 to your computer and use it in GitHub Desktop.
1) Scaffold pages index pagination Failure/Error: let(:user) { FactoryGirl.create(:user) } ActiveRecord::RecordInvalid: Validation failed: Email has already been taken # ./spec/requests/scaffold_pages_spec.rb:7:in `block (3 levels) in <top (required)>' # ./spec/requests/scaffold_pages_spec.rb:10:in `block (3 levels) in <top (required)>'
require 'spec_helper'
describe "Scaffold pages" do
subject { page }
describe "index" do
let(:user) { FactoryGirl.create(:user) }
before do
sign_in user
30.times { FactoryGirl.create(:scaffold, user: user) }
visit user_scaffolds_path(user)
end
it { should have_selector('title', text: 'All scaffolds') }
it { should have_selector('h1', text: 'All scaffolds') }
it "should list each scaffold" do
Scaffold.all.each do |scaffold|
page.should have_selector('li', text: scaffold.name)
end
end
describe "pagination" do
it { should have_selector('div.pagination') } # FIXME
it "should list each scaffold" do
user.scaffolds.paginate(page: 1).each do |scaffold|
page.should have_selector('li', text: scaffold.name)
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment