diff --git a/.rubocop.yml b/.rubocop.yml index 6323a52818..bfbb95a7fe 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -28,6 +28,10 @@ RSpec/DescribeClass: - 'spec/views/**/*.rb' - 'spec/features/**/*.rb' +RSpec/NoExpectationExample: + Exclude: + - 'spec/features/percy/percy_spec.rb' + Layout/MultilineMethodCallIndentation: EnforcedStyle: indented diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 8a3c39e195..12767032bd 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -388,10 +388,7 @@ RSpec/NestedGroups: # Offense count: 366 # Configuration parameters: AllowedPatterns. # AllowedPatterns: ^expect_, ^assert_ -RSpec/NoExpectationExample: - Enabled: false - -# Offense count: 9 +# Offense count: 4 RSpec/PendingWithoutReason: Exclude: - 'spec/features/members/blocking_spec.rb' diff --git a/spec/controllers/likes_controller_spec.rb b/spec/controllers/likes_controller_spec.rb index 278512c710..7be4d9443a 100644 --- a/spec/controllers/likes_controller_spec.rb +++ b/spec/controllers/likes_controller_spec.rb @@ -16,7 +16,7 @@ it { expect(Like.last.likeable_id).to eq(blogpost.id) } it { expect(Like.last.likeable_type).to eq('Post') } - it { JSON.parse(response.body)["description"] == "1 like" } + it { expect(JSON.parse(response.body)["description"]).to eq "1 like" } describe "Liking someone else's post" do it { expect(response).to have_http_status(:created) } @@ -30,14 +30,14 @@ describe "un-liking something i liked before" do it { expect(response).to have_http_status(:ok) } - it { JSON.parse(response.body)["description"] == "0 likes" } + it { expect(JSON.parse(response.body)["description"]).to eq "0 likes" } end describe "Deleting someone else's like" do let(:like) { create(:like) } it { expect(response).to have_http_status(:forbidden) } - it { JSON.parse(response.body)["error"] == "Unable to like" } + it { expect(JSON.parse(response.body)["error"]).to eq "Unable to like" } end end end diff --git a/spec/controllers/places_controller_spec.rb b/spec/controllers/places_controller_spec.rb index 94aec751bd..3621e2d892 100644 --- a/spec/controllers/places_controller_spec.rb +++ b/spec/controllers/places_controller_spec.rb @@ -27,7 +27,7 @@ describe "GET search" do it "redirects to the new place" do get :search, params: { new_place: "foo" } - response.should redirect_to place_path("foo") + expect(response).to redirect_to place_path("foo") end end end diff --git a/spec/controllers/registrations_controller_spec.rb b/spec/controllers/registrations_controller_spec.rb index 7570cd7943..25aee48b1b 100644 --- a/spec/controllers/registrations_controller_spec.rb +++ b/spec/controllers/registrations_controller_spec.rb @@ -13,13 +13,13 @@ describe "GET edit" do it "assigns the requested member as @member" do get :edit - assigns(:member).should eq(@member) + expect(assigns(:member)).to eq(@member) end it "picks up the flickr auth" do @auth = create(:flickr_authentication, member: @member) get :edit - assigns(:flickr_auth).should eq @auth + expect(assigns(:flickr_auth)).to eq @auth end end end diff --git a/spec/controllers/scientific_names_controller_spec.rb b/spec/controllers/scientific_names_controller_spec.rb index 534712bf4e..37b5c4076f 100644 --- a/spec/controllers/scientific_names_controller_spec.rb +++ b/spec/controllers/scientific_names_controller_spec.rb @@ -14,7 +14,7 @@ def valid_attributes describe "GET new" do it "assigns crop if specified" do get :new, params: { crop_id: crop.id } - assigns(:crop).should be_an_instance_of Crop + expect(assigns(:crop)).to be_an_instance_of Crop end end end diff --git a/spec/features/admin/admin_spec.rb b/spec/features/admin/admin_spec.rb index e4cd871d1c..86dadd8905 100644 --- a/spec/features/admin/admin_spec.rb +++ b/spec/features/admin/admin_spec.rb @@ -7,6 +7,7 @@ include_context 'signed in admin' it "navigating to forum admin with js" do visit admin_path + expect(page).to have_content 'Admin' page.percy_snapshot(page, name: 'Admin page') end end diff --git a/spec/features/conversations/index_spec.rb b/spec/features/conversations/index_spec.rb index e10696b54d..f83d138017 100644 --- a/spec/features/conversations/index_spec.rb +++ b/spec/features/conversations/index_spec.rb @@ -21,7 +21,10 @@ include_examples 'is accessible' it { expect(page).to have_content 'something i want to say' } - it { page.percy_snapshot(page, name: 'conversations#index') } + it "takes a percy snapshot" do + expect(page).to have_content 'something i want to say' + page.percy_snapshot(page, name: 'conversations#index') + end describe 'deleting' do before do diff --git a/spec/features/conversations/show_spec.rb b/spec/features/conversations/show_spec.rb index 4a670e6722..11ad8a082b 100644 --- a/spec/features/conversations/show_spec.rb +++ b/spec/features/conversations/show_spec.rb @@ -21,7 +21,11 @@ it { expect(page).to have_content 'this is the body' } it { expect(page).to have_link sender.login_name } - it { page.percy_snapshot(page, name: 'conversations#show') } + + it "takes a percy snapshot" do + expect(page).to have_content 'this is the body' + page.percy_snapshot(page, name: 'conversations#show') + end describe 'Replying to the conversation' do before do diff --git a/spec/features/members/deletion_spec.rb b/spec/features/members/deletion_spec.rb index 49af930ed5..8685bae2a4 100644 --- a/spec/features/members/deletion_spec.rb +++ b/spec/features/members/deletion_spec.rb @@ -73,12 +73,13 @@ end describe 'percy spec' do - it do + it "takes a percy snapshot" do logout login_as(member) visit member_path(member) click_link 'Edit profile' click_link 'Delete Account' + expect(page).to have_content 'Delete Account' page.percy_snapshot(page, name: 'Account deletion') end end diff --git a/spec/features/rss/comments_spec.rb b/spec/features/rss/comments_spec.rb index 3268fd106b..bc366298ec 100644 --- a/spec/features/rss/comments_spec.rb +++ b/spec/features/rss/comments_spec.rb @@ -5,7 +5,7 @@ describe 'Comments RSS feed' do it 'The index feed exists' do visit comments_path(format: 'rss') - # expect(page.status_code).to equal 200 + expect(page).to have_http_status :ok end it 'The index title is what we expect' do diff --git a/spec/features/rss/crops_spec.rb b/spec/features/rss/crops_spec.rb index c0b81a36a7..503940090b 100644 --- a/spec/features/rss/crops_spec.rb +++ b/spec/features/rss/crops_spec.rb @@ -6,7 +6,7 @@ it 'The index feed exists' do Crop.reindex visit crops_path(format: 'rss') - # expect(page.status_code).to equal 200 + expect(page).to have_http_status :ok end it 'The index title is what we expect' do diff --git a/spec/features/rss/plantings_spec.rb b/spec/features/rss/plantings_spec.rb index 06f19fb6d1..60cca55d79 100644 --- a/spec/features/rss/plantings_spec.rb +++ b/spec/features/rss/plantings_spec.rb @@ -5,7 +5,7 @@ describe 'Plantings RSS feed' do it 'The index feed exists' do visit plantings_path(format: 'rss') - # expect(page.status_code).to equal 200 + expect(page).to have_http_status :ok end it 'The index title is what we expect' do diff --git a/spec/features/rss/posts_spec.rb b/spec/features/rss/posts_spec.rb index eb89db819b..ebc73039b7 100644 --- a/spec/features/rss/posts_spec.rb +++ b/spec/features/rss/posts_spec.rb @@ -5,7 +5,7 @@ describe 'Posts RSS feed' do it 'The index feed exists' do visit posts_path(format: 'rss') - # expect(page.status_code).to equal 200 + expect(page).to have_http_status :ok end it 'The index title is what we expect' do diff --git a/spec/features/rss/seeds_spec.rb b/spec/features/rss/seeds_spec.rb index 44966c17cc..eecdaad35e 100644 --- a/spec/features/rss/seeds_spec.rb +++ b/spec/features/rss/seeds_spec.rb @@ -5,7 +5,7 @@ describe 'Seeds RSS feed' do it 'The index feed exists' do visit seeds_path(format: 'rss') - # expect(page.status_code).to equal 200 + expect(page).to have_http_status :ok end it 'The index title is what we expect' do diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 665ed280a8..c8113ca737 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -4,10 +4,10 @@ describe ApplicationHelper do it "parses dates" do - parse_date(nil).should be_nil - parse_date('').should be_nil - parse_date('2012-05-12').should eq Date.new(2012, 5, 12) - parse_date('may 12th 2012').should eq Date.new(2012, 5, 12) + expect(parse_date(nil)).to be_nil + expect(parse_date('')).to be_nil + expect(parse_date('2012-05-12')).to eq Date.new(2012, 5, 12) + expect(parse_date('may 12th 2012')).to eq Date.new(2012, 5, 12) end describe '#avatar_uri' do diff --git a/spec/helpers/harvests_helper_spec.rb b/spec/helpers/harvests_helper_spec.rb index 136c1c3cb9..93bb5ccecf 100644 --- a/spec/helpers/harvests_helper_spec.rb +++ b/spec/helpers/harvests_helper_spec.rb @@ -9,7 +9,7 @@ quantity: nil, weight_quantity: nil) result = helper.display_quantity(harvest) - result.should eq 'not specified' + expect(result).to eq 'not specified' end it '3 individual' do @@ -18,7 +18,7 @@ unit: 'individual', weight_quantity: nil) result = helper.display_quantity(harvest) - result.should eq '3' + expect(result).to eq '3' end it '1 bunch' do @@ -27,7 +27,7 @@ unit: 'bunch', weight_quantity: nil) result = helper.display_quantity(harvest) - result.should eq '1 bunch' + expect(result).to eq '1 bunch' end it '3 bunches' do @@ -36,7 +36,7 @@ unit: 'bunch', weight_quantity: nil) result = helper.display_quantity(harvest) - result.should eq '3 bunches' + expect(result).to eq '3 bunches' end it '3 kg' do @@ -46,7 +46,7 @@ weight_quantity: 3, weight_unit: 'kg') result = helper.display_quantity(harvest) - result.should eq '3 kg' + expect(result).to eq '3 kg' end it '3 individual weighing 3 kg' do @@ -56,7 +56,7 @@ weight_quantity: 3, weight_unit: 'kg') result = helper.display_quantity(harvest) - result.should eq '3, weighing 3 kg' + expect(result).to eq '3, weighing 3 kg' end it '3 bunches weighing 3 kg' do @@ -66,7 +66,7 @@ weight_quantity: 3, weight_unit: 'kg') result = helper.display_quantity(harvest) - result.should eq '3 bunches, weighing 3 kg' + expect(result).to eq '3 bunches, weighing 3 kg' end end end diff --git a/spec/lib/haml/filters/escaped_markdown_spec.rb b/spec/lib/haml/filters/escaped_markdown_spec.rb index 7a342e4b35..9cdbbcad8f 100644 --- a/spec/lib/haml/filters/escaped_markdown_spec.rb +++ b/spec/lib/haml/filters/escaped_markdown_spec.rb @@ -7,7 +7,7 @@ describe 'Haml::Filters::Escaped_Markdown' do it 'is registered as the handler for :escaped_markdown' do - Haml::Filters.registered[:escaped_markdown].should == + expect(Haml::Filters.registered[:escaped_markdown]).to eq Haml::Filters::EscapedMarkdown end diff --git a/spec/models/ability_spec.rb b/spec/models/ability_spec.rb index 8eced2577c..78ec1c1fce 100644 --- a/spec/models/ability_spec.rb +++ b/spec/models/ability_spec.rb @@ -10,24 +10,24 @@ context "notifications" do it 'member can view their own notifications' do notification = create(:notification, recipient: member) - ability.should be_able_to(:read, notification) + expect(ability).to be_able_to(:read, notification) end it "member can't view someone else's notifications" do notification = create(:notification, recipient: create(:member)) - ability.should_not be_able_to(:read, notification) + expect(ability).not_to be_able_to(:read, notification) end it "member can't send messages to themself" do - ability.should_not be_able_to(:create, + expect(ability).not_to be_able_to(:create, create(:notification, recipient: member, sender: member)) end it "member can send messages to someone else" do - ability.should be_able_to(:create, + expect(ability).to be_able_to(:create, create(:notification, recipient: create(:member), sender: member)) @@ -39,16 +39,16 @@ context "standard member" do it "can't manage crops" do - ability.should_not be_able_to(:update, crop) - ability.should_not be_able_to(:destroy, crop) + expect(ability).not_to be_able_to(:update, crop) + expect(ability).not_to be_able_to(:destroy, crop) end it "can request crops" do - ability.should be_able_to(:create, Crop) + expect(ability).to be_able_to(:create, Crop) end it "can read crops" do - ability.should be_able_to(:read, crop) + expect(ability).to be_able_to(:read, crop) end end @@ -60,19 +60,19 @@ end it "has crop_wrangler role" do - member.role?(:crop_wrangler).should be true + expect(member.role?(:crop_wrangler)).to be true end it "can create crops" do - ability.should be_able_to(:create, Crop) + expect(ability).to be_able_to(:create, Crop) end it "can update crops" do - ability.should be_able_to(:update, crop) + expect(ability).to be_able_to(:update, crop) end it "can destroy crops" do - ability.should be_able_to(:destroy, crop) + expect(ability).to be_able_to(:destroy, crop) end end end @@ -166,13 +166,13 @@ context 'ordinary member' do it "can read plant parts" do - ability.should be_able_to(:read, plant_part) + expect(ability).to be_able_to(:read, plant_part) end it "can't manage plant parts" do - ability.should_not be_able_to(:create, PlantPart) - ability.should_not be_able_to(:update, plant_part) - ability.should_not be_able_to(:destroy, plant_part) + expect(ability).not_to be_able_to(:create, PlantPart) + expect(ability).not_to be_able_to(:update, plant_part) + expect(ability).not_to be_able_to(:destroy, plant_part) end end @@ -184,21 +184,21 @@ end it "can read plant_part details" do - ability.should be_able_to(:read, plant_part) + expect(ability).to be_able_to(:read, plant_part) end it "can manage plant_part details" do - ability.should be_able_to(:create, PlantPart) - ability.should be_able_to(:update, plant_part) + expect(ability).to be_able_to(:create, PlantPart) + expect(ability).to be_able_to(:update, plant_part) end it "can delete an unused plant part" do - ability.should be_able_to(:destroy, plant_part) + expect(ability).to be_able_to(:destroy, plant_part) end it "can't delete a plant part that has harvests" do @harvest = create(:harvest, plant_part:) - ability.should_not be_able_to(:destroy, plant_part) + expect(ability).not_to be_able_to(:destroy, plant_part) end end end @@ -206,7 +206,7 @@ context 'members' do context 'ordinary member' do it "can't manage members" do - ability.should_not be_able_to(:destroy, Member) + expect(ability).not_to be_able_to(:destroy, Member) end end @@ -218,11 +218,11 @@ end it "can manage members" do - ability.should be_able_to(:destroy, create(:member)) + expect(ability).to be_able_to(:destroy, create(:member)) end it "cannot delete themselves" do - ability.should_not be_able_to(:destroy, member) + expect(ability).not_to be_able_to(:destroy, member) end end end diff --git a/spec/models/authentication_spec.rb b/spec/models/authentication_spec.rb index 3ec5c3e8ee..90ff1ce573 100644 --- a/spec/models/authentication_spec.rb +++ b/spec/models/authentication_spec.rb @@ -5,7 +5,7 @@ describe Authentication do it 'creates an authentication' do @auth = create(:authentication) - @auth.should be_an_instance_of described_class - @auth.member.should be_an_instance_of Member + expect(@auth).to be_an_instance_of described_class + expect(@auth.member).to be_an_instance_of Member end end diff --git a/spec/models/comment_spec.rb b/spec/models/comment_spec.rb index 8085d2de21..86b6c49d03 100644 --- a/spec/models/comment_spec.rb +++ b/spec/models/comment_spec.rb @@ -7,11 +7,11 @@ let(:comment) { create(:comment) } it "belongs to a post" do - comment.commentable.should be_an_instance_of Post + expect(comment.commentable).to be_an_instance_of Post end it "belongs to an author" do - comment.author.should be_an_instance_of Member + expect(comment.author).to be_an_instance_of Member end end @@ -25,11 +25,11 @@ it "sets the notification fields" do @c = create(:comment) @n = Notification.first - @n.sender.should eq @c.author - @n.recipient.should eq @c.commentable.author - @n.subject.should include 'commented on' - @n.body.should eq @c.body - @n.notifiable.should eq @c.commentable # polymorphic association, this is a Post. + expect(@n.sender).to eq @c.author + expect(@n.recipient).to eq @c.commentable.author + expect(@n.subject).to include 'commented on' + expect(@n.body).to eq @c.body + expect(@n.notifiable).to eq @c.commentable # polymorphic association, this is a Post. end it "doesn't send notifications to yourself" do @@ -65,7 +65,7 @@ end it 'has a scope for ASC order for displaying on post page' do - described_class.post_order.should eq [@c1, @c2] + expect(described_class.post_order).to eq [@c1, @c2] end end end diff --git a/spec/models/crop_spec.rb b/spec/models/crop_spec.rb index 2c5890dea7..5d2ca6ab78 100644 --- a/spec/models/crop_spec.rb +++ b/spec/models/crop_spec.rb @@ -7,24 +7,24 @@ let(:crop) { create(:tomato) } it 'saves a basic crop' do - crop.save.should be(true) + expect(crop.save).to be(true) end it 'is fetchable from the database' do crop.save @crop2 = described_class.find_by(name: 'tomato') - @crop2.en_wikipedia_url.should eq("http://en.wikipedia.org/wiki/Tomato") - @crop2.slug.should eq("tomato") + expect(@crop2.en_wikipedia_url).to eq("http://en.wikipedia.org/wiki/Tomato") + expect(@crop2.slug).to eq("tomato") end it 'stringifies as the system name' do crop.save - crop.to_s.should eq('tomato') + expect(crop.to_s).to eq('tomato') end it 'has a creator' do crop.save - crop.creator.should be_an_instance_of Member + expect(crop.creator).to be_an_instance_of Member end end @@ -42,7 +42,7 @@ end it 'recent scope sorts by creation date' do - described_class.recent.first.should == @uppercase + expect(described_class.recent.first).to eq @uppercase end end @@ -217,7 +217,7 @@ create(:sunny_planting, crop:) create(:semi_shady_planting, crop:) create(:shady_planting, crop:) - crop.sunniness.should be_an_instance_of Hash + expect(crop.sunniness).to be_an_instance_of Hash end it 'counts each sunniness value' do @@ -225,14 +225,14 @@ create(:sunny_planting, crop:) create(:semi_shady_planting, crop:) create(:shady_planting, crop:) - crop.sunniness.should == { 'sun' => 2, 'shade' => 1, 'semi-shade' => 1 } + expect(crop.sunniness).to eq { 'sun' => 2, 'shade' => 1, 'semi-shade' => 1 } end it 'ignores unused sunniness values' do create(:sunny_planting, crop:) create(:sunny_planting, crop:) create(:semi_shady_planting, crop:) - crop.sunniness.should == { 'sun' => 2, 'semi-shade' => 1 } + expect(crop.sunniness).to eq { 'sun' => 2, 'semi-shade' => 1 } end end @@ -244,7 +244,7 @@ create(:seed_planting, crop:) create(:seedling_planting, crop:) create(:cutting_planting, crop:) - crop.planted_from.should be_an_instance_of Hash + expect(crop.planted_from).to be_an_instance_of Hash end it 'counts each planted_from value' do @@ -252,14 +252,14 @@ create(:seed_planting, crop:) create(:seedling_planting, crop:) create(:cutting_planting, crop:) - crop.planted_from.should == { 'seed' => 2, 'seedling' => 1, 'cutting' => 1 } + expect(crop.planted_from).to eq { 'seed' => 2, 'seedling' => 1, 'cutting' => 1 } end it 'ignores unused planted_from values' do create(:seed_planting, crop:) create(:seed_planting, crop:) create(:seedling_planting, crop:) - crop.planted_from.should == { 'seed' => 2, 'seedling' => 1 } + expect(crop.planted_from).to eq { 'seed' => 2, 'seedling' => 1 } end end @@ -267,7 +267,7 @@ let(:crop) { create(:tomato) } it 'returns a hash of plant_part values' do - crop.popular_plant_parts.should be_an_instance_of Hash + expect(crop.popular_plant_parts).to be_an_instance_of Hash end it 'counts each plant_part value' do @@ -287,7 +287,7 @@ @harvest4 = create(:harvest, crop:, plant_part: @root) - crop.popular_plant_parts.should == { [@fruit.id, @fruit.name] => 2, + expect(crop.popular_plant_parts).to eq { [@fruit.id, @fruit.name] => 2, [@seed.id, @seed.name] => 1, [@root.id, @root.name] => 1 } end diff --git a/spec/models/forum_spec.rb b/spec/models/forum_spec.rb index f6772dd59e..6668a46ddf 100644 --- a/spec/models/forum_spec.rb +++ b/spec/models/forum_spec.rb @@ -6,20 +6,20 @@ let(:forum) { create(:forum) } it "belongs to an owner" do - forum.owner.should be_an_instance_of Member + expect(forum.owner).to be_an_instance_of Member end it "stringifies nicely" do - forum.to_s.should eq forum.name + expect(forum.to_s).to eq forum.name end it 'has a slug' do - forum.slug.should eq 'permaculture' + expect(forum.slug).to eq 'permaculture' end it "has many posts" do @post1 = create(:forum_post, forum:) @post2 = create(:forum_post, forum:) - forum.posts.size.should == 2 + expect(forum.posts.size).to eq 2 end end diff --git a/spec/models/garden_spec.rb b/spec/models/garden_spec.rb index 65b76bf111..9f9c30c8b3 100644 --- a/spec/models/garden_spec.rb +++ b/spec/models/garden_spec.rb @@ -7,59 +7,59 @@ let(:garden) { create(:garden, owner:, name: 'Springfield Community Garden') } it "has a slug" do - garden.slug.should match(/hatupatu-springfield-community-garden/) + expect(garden.slug).to match(/hatupatu-springfield-community-garden/) end it "has a description" do - garden.description.should == "This is a **totally** cool garden" + expect(garden.description).to eq "This is a **totally** cool garden" end it "doesn't allow a nil name" do garden = build(:garden, name: nil) - garden.should_not be_valid + expect(garden).not_to be_valid end it "doesn't allow a blank name" do garden = build(:garden, name: "") - garden.should_not be_valid + expect(garden).not_to be_valid end it "allows numbers" do garden = build(:garden, name: "100 vines of 2 kamo-kamo") - garden.should be_valid + expect(garden).to be_valid end it "allows brackets" do garden = build(:garden, name: "Garden (second)") - garden.should be_valid + expect(garden).to be_valid end it "allows macrons" do garden = build(:garden, name: "Kūmara and pūha patch") - garden.should be_valid + expect(garden).to be_valid end it "allows some punctuation" do garden = build(:garden, name: "best-garden-eva!") - garden.should be_valid + expect(garden).to be_valid end it "doesn't allow a name with only spaces" do garden = build(:garden, name: " ") - garden.should_not be_valid + expect(garden).not_to be_valid end it "doesn't allow new line chars in garden names" do garden = build(:garden, name: "My garden\nI am a 1337 hacker") - garden.should_not be_valid + expect(garden).not_to be_valid end it "has an owner" do - garden.owner.should be_an_instance_of Member + expect(garden.owner).to be_an_instance_of Member end it "stringifies as its name" do - garden.to_s.should == garden.name + expect(garden.to_s).to eq garden.name end it "destroys plantings when deleted" do @@ -75,27 +75,27 @@ context 'area' do it 'allows numeric area' do garden = build(:garden, area: 33) - garden.should be_valid + expect(garden).to be_valid end it "doesn't allow negative area" do garden = build(:garden, area: -5) - garden.should_not be_valid + expect(garden).not_to be_valid end it 'allows decimal quantities' do garden = build(:garden, area: 3.3) - garden.should be_valid + expect(garden).to be_valid end it 'allows blank quantities' do garden = build(:garden, area: '') - garden.should be_valid + expect(garden).to be_valid end it 'allows nil quantities' do garden = build(:garden, area: nil) - garden.should be_valid + expect(garden).to be_valid end it 'cleans up zero quantities' do @@ -105,7 +105,7 @@ it "doesn't allow non-numeric quantities" do garden = build(:garden, area: "99a") - garden.should_not be_valid + expect(garden).not_to be_valid end end @@ -113,19 +113,19 @@ Garden::AREA_UNITS_VALUES.values.push(nil, '').each do |s| it "#{s} should be a valid unit" do garden = build(:garden, area_unit: s) - garden.should be_valid + expect(garden).to be_valid end end it 'refuses invalid unit values' do garden = build(:garden, area_unit: 'not valid') - garden.should_not be_valid - garden.errors[:area_unit].should include("not valid is not a valid area unit") + expect(garden).not_to be_valid + expect(garden.errors[:area_unit]).to include("not valid is not a valid area unit") end it 'sets area unit to blank if area is blank' do garden = build(:garden, area: '', area_unit: 'acre') - garden.should be_valid + expect(garden).to be_valid expect(garden.area_unit).to be_nil end end @@ -135,13 +135,13 @@ let(:inactive) { create(:inactive_garden) } it 'includes active garden in active scope' do - described_class.active.should include active - described_class.active.should_not include inactive + expect(described_class.active).to include active + expect(described_class.active).not_to include inactive end it 'includes inactive garden in inactive scope' do - described_class.inactive.should include inactive - described_class.inactive.should_not include active + expect(described_class.inactive).to include inactive + expect(described_class.inactive).not_to include active end end @@ -196,7 +196,7 @@ it 'deletes association with photos when photo is deleted' do photo.destroy garden.reload - garden.photos.should be_empty + expect(garden.photos).to be_empty end it 'has a default photo' do diff --git a/spec/models/harvest_spec.rb b/spec/models/harvest_spec.rb index 535dedd4c2..515dc5cbd2 100644 --- a/spec/models/harvest_spec.rb +++ b/spec/models/harvest_spec.rb @@ -5,33 +5,33 @@ describe Harvest do it "has an owner" do harvest = create(:harvest) - harvest.owner.should be_an_instance_of Member + expect(harvest.owner).to be_an_instance_of Member end it "has a crop" do harvest = create(:harvest) - harvest.crop.should be_an_instance_of Crop + expect(harvest.crop).to be_an_instance_of Crop end context 'quantity' do it 'allows numeric quantities' do @harvest = build(:harvest, quantity: 33) - @harvest.should be_valid + expect(@harvest).to be_valid end it 'allows decimal quantities' do @harvest = build(:harvest, quantity: 3.3) - @harvest.should be_valid + expect(@harvest).to be_valid end it 'allows blank quantities' do @harvest = build(:harvest, quantity: '') - @harvest.should be_valid + expect(@harvest).to be_valid end it 'allows nil quantities' do @harvest = build(:harvest, quantity: nil) - @harvest.should be_valid + expect(@harvest).to be_valid end it 'cleans up zero quantities' do @@ -41,7 +41,7 @@ it "doesn't allow non-numeric quantities" do @harvest = build(:harvest, quantity: "99a") - @harvest.should_not be_valid + expect(@harvest).not_to be_valid end end @@ -50,19 +50,19 @@ ['individual', 'bunch', 'sprig', 'handful', 'litre', 'pint', 'quart', 'bucket', 'basket', 'bushel', nil, ''].each do |s| @harvest = build(:harvest, unit: s) - @harvest.should be_valid + expect(@harvest).to be_valid end end it 'refuses invalid unit values' do @harvest = build(:harvest, unit: 'not valid') - @harvest.should_not be_valid - @harvest.errors[:unit].should include("not valid is not a valid unit") + expect(@harvest).not_to be_valid + expect(@harvest.errors[:unit]).to include("not valid is not a valid unit") end it 'sets unit to blank if quantity is blank' do @harvest = build(:harvest, quantity: '', unit: 'individual') - @harvest.should be_valid + expect(@harvest).to be_valid expect(@harvest.unit).to be_nil end end @@ -70,22 +70,22 @@ context 'weight quantity' do it 'allows numeric weight quantities' do @harvest = build(:harvest, weight_quantity: 33) - @harvest.should be_valid + expect(@harvest).to be_valid end it 'allows decimal weight quantities' do @harvest = build(:harvest, weight_quantity: 3.3) - @harvest.should be_valid + expect(@harvest).to be_valid end it 'allows blank weight quantities' do @harvest = build(:harvest, weight_quantity: '') - @harvest.should be_valid + expect(@harvest).to be_valid end it 'allows nil weight quantities' do @harvest = build(:harvest, weight_quantity: nil) - @harvest.should be_valid + expect(@harvest).to be_valid end it 'cleans up zero quantities' do @@ -95,7 +95,7 @@ it "doesn't allow non-numeric weight quantities" do @harvest = build(:harvest, weight_quantity: "99a") - @harvest.should_not be_valid + expect(@harvest).not_to be_valid end end @@ -103,19 +103,19 @@ it 'all valid units should work' do ['kg', 'lb', 'oz', nil, ''].each do |s| @harvest = build(:harvest, weight_unit: s) - @harvest.should be_valid + expect(@harvest).to be_valid end end it 'refuses invalid weight unit values' do @harvest = build(:harvest, weight_unit: 'not valid') - @harvest.should_not be_valid - @harvest.errors[:weight_unit].should include("not valid is not a valid unit") + expect(@harvest).not_to be_valid + expect(@harvest.errors[:weight_unit]).to include("not valid is not a valid unit") end it 'sets weight_unit to blank if quantity is blank' do @harvest = build(:harvest, weight_quantity: '', weight_unit: 'kg') - @harvest.should be_valid + expect(@harvest).to be_valid expect(@harvest.weight_unit).to be_nil end end @@ -123,19 +123,19 @@ context "standardized weights" do it 'converts from pounds' do @harvest = create(:harvest, weight_quantity: 2, weight_unit: "lb") - @harvest.should be_valid + expect(@harvest).to be_valid expect(@harvest.reload.si_weight).to eq 0.907 end it 'converts from ounces' do @harvest = create(:harvest, weight_quantity: 16, weight_unit: "oz") - @harvest.should be_valid + expect(@harvest).to be_valid expect(@harvest.reload.si_weight).to eq 0.454 end it 'leaves kg alone' do @harvest = create(:harvest, weight_quantity: 2, weight_unit: "kg") - @harvest.should be_valid + expect(@harvest).to be_valid expect(@harvest.reload.si_weight).to eq 2.0 end end @@ -255,7 +255,7 @@ end it 'is found in has_photos scope' do - described_class.has_photos.should include(@harvest) + expect(described_class.has_photos).to include(@harvest) end it 'has a photo' do @@ -265,7 +265,7 @@ it 'deletes association with photos when photo is deleted' do @photo.destroy @harvest.reload - @harvest.photos.should be_empty + expect(@harvest.photos).to be_empty end it 'has a default photo' do diff --git a/spec/models/member_spec.rb b/spec/models/member_spec.rb index 1133457af7..afd96ecbe9 100644 --- a/spec/models/member_spec.rb +++ b/spec/models/member_spec.rb @@ -45,19 +45,19 @@ it 'has many plantings' do create(:planting, owner: member) - member.plantings.size.should eq 1 + expect(member.plantings.size).to eq 1 end it "has many comments" do create(:comment, author: member) create(:comment, author: member) - member.comments.size.should == 2 + expect(member.comments.size).to eq 2 end it "has many forums" do create(:forum, owner: member) create(:forum, owner: member) - member.forums.size.should == 2 + expect(member.forums.size).to eq 2 end it "has many likes" do @@ -71,24 +71,24 @@ it 'has location and lat/long fields' do member.update(location: 'Greenwich, UK') - member.location.should eq 'Greenwich, UK' - member.latitude.round(2).should eq 51.48 - member.longitude.round(2).should eq 0.00 + expect(member.location).to eq 'Greenwich, UK' + expect(member.latitude.round(2)).to eq 51.48 + expect(member.longitude.round(2)).to eq 0.00 end it 'empties the lat/long if location removed' do member.update(location: 'Greenwich, UK') member.update(location: '') - member.location.should eq '' - member.latitude.should be_nil - member.longitude.should be_nil + expect(member.location).to eq '' + expect(member.latitude).to be_nil + expect(member.longitude).to be_nil end it 'fails gracefully for unfound locations' do member.update(location: 'Tatooine') - member.location.should eq 'Tatooine' - member.latitude.should be_nil - member.longitude.should be_nil + expect(member.location).to eq 'Tatooine' + expect(member.latitude).to be_nil + expect(member.longitude).to be_nil end end @@ -96,7 +96,7 @@ let(:member) { build(:no_tos_member) } it "refuses to save a member who hasn't agreed to the TOS" do - member.save.should_not be(true) + expect(member.save).not_to be(true) end end @@ -104,8 +104,8 @@ it 'finds newsletter recipients' do regular_member = create(:member) newsletter_member = create(:newsletter_recipient_member) - Member.wants_newsletter.should include newsletter_member - Member.wants_newsletter.should_not include regular_member + expect(Member.wants_newsletter).to include newsletter_member + expect(Member.wants_newsletter).not_to include regular_member end end @@ -113,71 +113,71 @@ it "does not allow two members with the same login_name" do create(:member, login_name: "bob") member = build(:member, login_name: "bob") - member.should_not be_valid - member.errors[:login_name].should include("has already been taken") + expect(member).not_to be_valid + expect(member.errors[:login_name]).to include("has already been taken") end it "tests uniqueness case-insensitively" do create(:member, login_name: "bob") member = build(:member, login_name: "BoB") - member.should_not be_valid - member.errors[:login_name].should include("has already been taken") + expect(member).not_to be_valid + expect(member.errors[:login_name]).to include("has already been taken") end end context 'case sensitivity' do it 'preserves case of login name' do create(:member, login_name: "BOB") - Member.find('bob').login_name.should eq 'BOB' + expect(Member.find('bob').login_name).to eq 'BOB' end end context 'invalid login names' do it "doesn't allow short names" do member = build(:invalid_member_shortname) - member.should_not be_valid - member.errors[:login_name].should include("should be between 2 and 25 characters long") + expect(member).not_to be_valid + expect(member.errors[:login_name]).to include("should be between 2 and 25 characters long") end it "doesn't allow really long names" do member = build(:invalid_member_longname) - member.should_not be_valid - member.errors[:login_name].should include("should be between 2 and 25 characters long") + expect(member).not_to be_valid + expect(member.errors[:login_name]).to include("should be between 2 and 25 characters long") end it "doesn't allow spaces in names" do member = build(:invalid_member_spaces) - member.should_not be_valid - member.errors[:login_name].should include("may only include letters, numbers, or underscores") + expect(member).not_to be_valid + expect(member.errors[:login_name]).to include("may only include letters, numbers, or underscores") end it "doesn't allow other chars in names" do member = build(:invalid_member_badchars) - member.should_not be_valid - member.errors[:login_name].should include("may only include letters, numbers, or underscores") + expect(member).not_to be_valid + expect(member.errors[:login_name]).to include("may only include letters, numbers, or underscores") end it "doesn't allow reserved names" do member = build(:invalid_member_badname) - member.should_not be_valid - member.errors[:login_name].should include("name is reserved") + expect(member).not_to be_valid + expect(member.errors[:login_name]).to include("name is reserved") end end context 'valid login names' do it "allows plain alphanumeric chars in names" do member = build(:valid_member_alphanumeric) - member.should be_valid + expect(member).to be_valid end it "allows uppercase chars in names" do member = build(:valid_member_uppercase) - member.should be_valid + expect(member).to be_valid end it "allows underscores in names" do member = build(:valid_member_underscore) - member.should be_valid + expect(member).to be_valid end end @@ -190,20 +190,20 @@ end it 'has a role' do - member.roles.first.should eq role - member.role?(:moderator).should be true + expect(member.roles.first).to eq role + expect(member.role?(:moderator)).to be true end it 'sets up roles in factories' do admin = create(:admin_member) - admin.role?(:admin).should be true + expect(admin.role?(:admin)).to be true end it 'converts role names properly' do # need to make sure spaces get turned to underscores role = create(:role, name: "a b c") member.roles << role - member.role?(:a_b_c).should be true + expect(member.role?(:a_b_c)).to be true end end @@ -214,12 +214,12 @@ end it 'sees confirmed members' do - Member.confirmed.size.should == 2 + expect(Member.confirmed.size).to eq 2 end it 'ignores unconfirmed members' do create(:unconfirmed_member) - Member.confirmed.size.should == 2 + expect(Member.confirmed.size).to eq 2 end end @@ -227,12 +227,12 @@ # located members must have location, lat, long it 'finds members who have locations' do london_member = create(:london_member) - Member.located.should include london_member + expect(Member.located).to include london_member end it 'ignores members with blank locations' do nowhere_member = create(:member) - Member.located.should_not include nowhere_member + expect(Member.located).not_to include nowhere_member end it 'ignores members with blank lat/long' do @@ -240,7 +240,7 @@ london_member.latitude = nil london_member.longitude = nil london_member.save(validate: false) - Member.located.should_not include london_member + expect(Member.located).not_to include london_member end end @@ -248,7 +248,7 @@ it 'finds nearby members and sorts them' do edinburgh_member = create(:edinburgh_member) london_member = create(:london_member) - Member.nearest_to('Greenwich, UK').should eq [london_member, edinburgh_member] + expect(Member.nearest_to('Greenwich, UK')).to eq [london_member, edinburgh_member] end end @@ -285,7 +285,7 @@ end it 'finds interesting members without duplicates in the correct order' do - @result.should eq [@members[2], @members[1], @members[0]] + expect(@result).to eq [@members[2], @members[1], @members[0]] end end end @@ -294,7 +294,7 @@ it 'has harvests' do member = create(:member) harvest = create(:harvest, owner: member) - member.harvests.should eq [harvest] + expect(member.harvests).to eq [harvest] end end diff --git a/spec/models/photo_spec.rb b/spec/models/photo_spec.rb index 51d082cfe3..6d1001fe27 100644 --- a/spec/models/photo_spec.rb +++ b/spec/models/photo_spec.rb @@ -174,7 +174,7 @@ # So we're just going to test that the method exists. it 'exists' do photo = described_class.new(owner_id: 1) - photo.should.respond_to? :flickr_metadata + expect(photo).to respond_to :flickr_metadata end end diff --git a/spec/models/plant_part_spec.rb b/spec/models/plant_part_spec.rb index 6013dd6428..3364264ec2 100644 --- a/spec/models/plant_part_spec.rb +++ b/spec/models/plant_part_spec.rb @@ -5,7 +5,7 @@ describe PlantPart do it 'stringifies' do @pp = create(:plant_part) - @pp.to_s.should eq @pp.name + expect(@pp.to_s).to eq @pp.name end it 'has crops' do diff --git a/spec/models/planting_spec.rb b/spec/models/planting_spec.rb index 021e78c81a..37fe4972ae 100644 --- a/spec/models/planting_spec.rb +++ b/spec/models/planting_spec.rb @@ -270,20 +270,20 @@ def one_hundred_day_old_planting end it 'has an owner' do - planting.owner.should be_an_instance_of Member + expect(planting.owner).to be_an_instance_of Member end it "generates a location" do - planting.location.should eq garden.location + expect(planting.location).to eq garden.location end it "has a slug" do - planting.slug.should match(/^hatupatu-springfield-community-garden-tomato$/) + expect(planting.slug).to match(/^hatupatu-springfield-community-garden-tomato$/) end it 'sorts in reverse creation order' do @planting2 = create(:planting) - described_class.first.should eq @planting2 + expect(described_class.first).to eq @planting2 end describe '#planted?' do @@ -305,43 +305,43 @@ def one_hundred_day_old_planting context 'delegation' do it 'system name' do - planting.crop_name.should eq planting.crop.name + expect(planting.crop_name).to eq planting.crop.name end it 'wikipedia url' do - planting.crop_en_wikipedia_url.should eq planting.crop.en_wikipedia_url + expect(planting.crop_en_wikipedia_url).to eq planting.crop.en_wikipedia_url end it 'default scientific name' do - planting.crop_default_scientific_name.should eq planting.crop.default_scientific_name + expect(planting.crop_default_scientific_name).to eq planting.crop.default_scientific_name end it 'plantings count' do - planting.crop_plantings_count.should eq planting.crop.plantings_count + expect(planting.crop_plantings_count).to eq planting.crop.plantings_count end end context 'quantity' do it 'allows integer quantities' do @planting = build(:planting, quantity: 99) - @planting.should be_valid + expect(@planting).to be_valid end it "doesn't allow decimal quantities" do @planting = build(:planting, quantity: 99.9) - @planting.should_not be_valid + expect(@planting).not_to be_valid end it "doesn't allow non-numeric quantities" do @planting = build(:planting, quantity: 'foo') - @planting.should_not be_valid + expect(@planting).not_to be_valid end it "allows blank quantities" do @planting = build(:planting, quantity: nil) - @planting.should be_valid + expect(@planting).to be_valid @planting = build(:planting, quantity: '') - @planting.should be_valid + expect(@planting).to be_valid end end @@ -349,27 +349,27 @@ def one_hundred_day_old_planting let(:planting) { create(:sunny_planting) } it 'has a sunniness value' do - planting.sunniness.should eq 'sun' + expect(planting.sunniness).to eq 'sun' end it 'all three valid sunniness values should work' do ['sun', 'shade', 'semi-shade', nil, ''].each do |s| @planting = build(:planting, sunniness: s) - @planting.should be_valid + expect(@planting).to be_valid end end it 'refuses invalid sunniness values' do @planting = build(:planting, sunniness: 'not valid') - @planting.should_not be_valid - @planting.errors[:sunniness].should include("not valid is not a valid sunniness value") + expect(@planting).not_to be_valid + expect(@planting.errors[:sunniness]).to include("not valid is not a valid sunniness value") end end context 'planted from' do it 'has a planted_from value' do @planting = create(:seed_planting) - @planting.planted_from.should eq 'seed' + expect(@planting.planted_from).to eq 'seed' end it 'all valid planted_from values should work' do @@ -379,14 +379,14 @@ def one_hundred_day_old_planting 'graft', 'layering', 'bulb', 'root/tuber', nil, '' ].each do |p| @planting = build(:planting, planted_from: p) - @planting.should be_valid + expect(@planting).to be_valid end end it 'refuses invalid planted_from values' do @planting = build(:planting, planted_from: 'not valid') - @planting.should_not be_valid - @planting.errors[:planted_from].should include("not valid is not a valid planting method") + expect(@planting).not_to be_valid + expect(@planting.errors[:planted_from]).to include("not valid is not a valid planting method") end end @@ -485,38 +485,38 @@ def one_hundred_day_old_planting context "finished" do it 'has finished fields' do @planting = create(:finished_planting) - @planting.finished.should be true - @planting.finished_at.should be_an_instance_of Date + expect(@planting.finished).to be true + expect(@planting.finished_at).to be_an_instance_of Date end it 'has finished scope' do @p = create(:planting) @f = create(:finished_planting) - described_class.finished.should include @f - described_class.finished.should_not include @p + expect(described_class.finished).to include @f + expect(described_class.finished).not_to include @p end it 'has current scope' do @p = create(:planting) @f = create(:finished_planting) - described_class.current.should include @p - described_class.current.should_not include @f + expect(described_class.current).to include @p + expect(described_class.current).not_to include @f end context "finished date validation" do it 'requires finished date after planting date' do @f = build(:finished_planting, planted_at: '2014-01-01', finished_at: '2013-01-01') - @f.should_not be_valid + expect(@f).not_to be_valid end it 'allows just the planted date' do @f = build(:planting, planted_at: '2013-01-01', finished_at: nil) - @f.should be_valid + expect(@f).to be_valid end it 'allows just the finished date' do @f = build(:planting, finished_at: '2013-01-01', planted_at: nil) - @f.should be_valid + expect(@f).to be_valid end end end @@ -531,20 +531,20 @@ def one_hundred_day_old_planting it 'has a failed scope' do @p = create(:planting) @f = create(:planting, failed: true) - described_class.failed.should include @f - described_class.failed.should_not include @p + expect(described_class.failed).to include @f + expect(described_class.failed).not_to include @p end it 'is not included in the active scope' do @p = create(:planting) @f = create(:planting, failed: true) - described_class.active.should include @p - described_class.active.should_not include @f + expect(described_class.active).to include @p + expect(described_class.active).not_to include @f end it 'cannot be finished and failed' do @f = build(:planting, finished: true, failed: true) - @f.should_not be_valid + expect(@f).not_to be_valid end it 'is not finished' do diff --git a/spec/models/post_spec.rb b/spec/models/post_spec.rb index a597056410..5826ea7eb1 100644 --- a/spec/models/post_spec.rb +++ b/spec/models/post_spec.rb @@ -13,52 +13,52 @@ datestr = time.strftime("%Y%m%d") # 2 digit day and month, full-length years # Counting digits using Math.log is not precise enough! - datestr.size.should eq(4 + time.year.to_s.size) - post.slug.should eq("#{member.login_name}-#{datestr}-a-post") + expect(datestr.size).to eq(4 + time.year.to_s.size) + expect(post.slug).to eq("#{member.login_name}-#{datestr}-a-post") end it "has many comments" do post = create(:post, author: member) create(:comment, commentable: post) create(:comment, commentable: post) - post.comments.size.should == 2 + expect(post.comments.size).to eq 2 end it "supports counting comments" do post = create(:post, author: member) create(:comment, commentable: post) create(:comment, commentable: post) - post.comment_count.should == 2 + expect(post.comment_count).to eq 2 end it "destroys comments when deleted" do post = create(:post, author: member) create(:comment, commentable: post) create(:comment, commentable: post) - post.comments.size.should eq(2) + expect(post.comments.size).to eq(2) all = Comment.count post.destroy - Comment.count.should eq(all - 2) + expect(Comment.count).to eq(all - 2) end it "belongs to a forum" do post = create(:forum_post) - post.forum.should be_an_instance_of Forum + expect(post.forum).to be_an_instance_of Forum end it "doesn't allow a nil subject" do post = build(:post, subject: nil) - post.should_not be_valid + expect(post).not_to be_valid end it "doesn't allow a blank subject" do post = build(:post, subject: "") - post.should_not be_valid + expect(post).not_to be_valid end it "doesn't allow a subject with only spaces" do post = build(:post, subject: " ") - post.should_not be_valid + expect(post).not_to be_valid end context "recent activity" do @@ -69,28 +69,28 @@ let!(:post) { create(:post, created_at: 1.day.ago) } it "sets recent activity to post time" do - post.recent_activity.to_i.should eq post.created_at.to_i + expect(post.recent_activity.to_i).to eq post.created_at.to_i end it "sets recent activity to comment time" do comment = create(:comment, commentable: post, created_at: 1.hour.ago) - post.recent_activity.to_i.should eq comment.created_at.to_i + expect(post.recent_activity.to_i).to eq comment.created_at.to_i end it "shiny new post is recently active" do # create a shiny new post post2 = create(:post, created_at: 1.minute.ago) - described_class.recently_active.first.should eq post2 - described_class.recently_active.second.should eq post + expect(described_class.recently_active.first).to eq post2 + expect(described_class.recently_active.second).to eq post end it "new comment on old post is recently active" do # now comment on an older post post2 = create(:post, created_at: 1.minute.ago) create(:comment, commentable: post, created_at: 1.second.ago) - described_class.recently_active.first.should eq post - described_class.recently_active.second.should eq post2 + expect(described_class.recently_active.first).to eq post + expect(described_class.recently_active.second).to eq post2 end end @@ -112,10 +112,10 @@ it "sets the notification field" do p = create(:post, author: member, body: "Hey @#{member2}") n = Notification.first - n.sender.should eq member - n.recipient.should eq member2 - n.subject.should match(/mentioned you in their post/) - n.body.should eq p.body + expect(n.sender).to eq member + expect(n.recipient).to eq member2 + expect(n.subject).to match(/mentioned you in their post/) + expect(n.body).to eq p.body end it "sends notifications to all members mentioned" do diff --git a/spec/models/role_spec.rb b/spec/models/role_spec.rb index 97eb4ef2cb..3fe4b8c464 100644 --- a/spec/models/role_spec.rb +++ b/spec/models/role_spec.rb @@ -12,11 +12,11 @@ let(:member) { create(:member) } it 'has members' do - subject.members.first.should eq member + expect(subject.members.first).to eq member end it 'has a slug' do - subject.slug.should eq 'crop-wrangler' + expect(subject.slug).to eq 'crop-wrangler' end describe '.crop_wranglers' do diff --git a/spec/models/scientific_name_spec.rb b/spec/models/scientific_name_spec.rb index d7fed5bac1..b4c2d86bcf 100644 --- a/spec/models/scientific_name_spec.rb +++ b/spec/models/scientific_name_spec.rb @@ -7,18 +7,18 @@ let(:sn) { create(:zea_mays) } it 'saves a basic scientific name' do - sn.save.should be(true) + expect(sn.save).to be(true) end it 'is fetchable from the database' do sn.save @sn2 = described_class.find_by(name: 'Zea mays') - @sn2.crop.name.should == 'maize' + expect(@sn2.crop.name).to eq 'maize' end it 'has a creator' do sn.save - sn.creator.should be_an_instance_of Member + expect(sn.creator).to be_an_instance_of Member end end diff --git a/spec/requests/gardens_spec.rb b/spec/requests/gardens_spec.rb index 890a6edb74..d3be2c4d4e 100644 --- a/spec/requests/gardens_spec.rb +++ b/spec/requests/gardens_spec.rb @@ -7,7 +7,7 @@ it "works! (now write some real specs)" do # Run the generator again with the --webrat flag if you want to use webrat methods/matchers get gardens_path - response.status.should be(200) + expect(response.status).to be(200) end end end diff --git a/spec/requests/photos_spec.rb b/spec/requests/photos_spec.rb index 6ac4694a0f..70e12648b6 100644 --- a/spec/requests/photos_spec.rb +++ b/spec/requests/photos_spec.rb @@ -7,7 +7,7 @@ it "works! (now write some real specs)" do # Run the generator again with the --webrat flag if you want to use webrat methods/matchers get photos_path - response.status.should be(200) + expect(response.status).to be(200) end end end diff --git a/spec/requests/plant_parts_spec.rb b/spec/requests/plant_parts_spec.rb index a96599cbbb..e101ae215a 100644 --- a/spec/requests/plant_parts_spec.rb +++ b/spec/requests/plant_parts_spec.rb @@ -7,7 +7,7 @@ it "works! (now write some real specs)" do # Run the generator again with the --webrat flag if you want to use webrat methods/matchers get plant_parts_path - response.status.should be(200) + expect(response.status).to be(200) end end end diff --git a/spec/requests/plantings_spec.rb b/spec/requests/plantings_spec.rb index 1a1126cb77..0a3f6284a3 100644 --- a/spec/requests/plantings_spec.rb +++ b/spec/requests/plantings_spec.rb @@ -7,7 +7,7 @@ it "works! (now write some real specs)" do # Run the generator again with the --webrat flag if you want to use webrat methods/matchers get plantings_path - response.status.should be(200) + expect(response.status).to be(200) end end @@ -50,7 +50,7 @@ # TBA: Perennial and annual crops predictions of 'next' harvest date don't really fit - response.status.should be(200) + expect(response.status).to be(200) end end @@ -81,7 +81,7 @@ it "works!" do get member_plantings_path(@member, format: "csv") - response.status.should be(200) + expect(response.status).to be(200) data = CSV.parse(response.body, headers: true) expect(data.headers).to eq expected_headers diff --git a/spec/requests/post_spec.rb b/spec/requests/post_spec.rb index 51ccf416ab..5bfb3f1f62 100644 --- a/spec/requests/post_spec.rb +++ b/spec/requests/post_spec.rb @@ -6,7 +6,7 @@ describe "GET /posts" do it "works! (now write some real specs)" do get posts_path - response.status.should be(200) + expect(response.status).to be(200) end end end diff --git a/spec/requests/scientific_names_spec.rb b/spec/requests/scientific_names_spec.rb index f2ce118aab..79efca725f 100644 --- a/spec/requests/scientific_names_spec.rb +++ b/spec/requests/scientific_names_spec.rb @@ -7,7 +7,7 @@ it "works! (now write some real specs)" do # Run the generator again with the --webrat flag if you want to use webrat methods/matchers get scientific_names_path - response.status.should be(200) + expect(response.status).to be(200) end end end diff --git a/spec/requests/seeds_spec.rb b/spec/requests/seeds_spec.rb index 1440d638c6..fa0e39d71b 100644 --- a/spec/requests/seeds_spec.rb +++ b/spec/requests/seeds_spec.rb @@ -7,7 +7,7 @@ it "works! (now write some real specs)" do # Run the generator again with the --webrat flag if you want to use webrat methods/matchers get seeds_path - response.status.should be(200) + expect(response.status).to be(200) end end end diff --git a/spec/routing/authentications_controller_routing_spec.rb b/spec/routing/authentications_controller_routing_spec.rb index 877a353952..e219f298aa 100644 --- a/spec/routing/authentications_controller_routing_spec.rb +++ b/spec/routing/authentications_controller_routing_spec.rb @@ -5,11 +5,11 @@ describe AuthenticationsController do describe "routing" do it "routes to #create" do - post("/authentications").should route_to("authentications#create") + expect(post("/authentications")).to route_to("authentications#create") end it "routes to #destroy" do - delete("/authentications/1").should route_to("authentications#destroy", id: "1") + expect(delete("/authentications/1")).to route_to("authentications#destroy", id: "1") end end end diff --git a/spec/routing/comments_controller_routing_spec.rb b/spec/routing/comments_controller_routing_spec.rb index 9fbfa436ae..0db59cc5b6 100644 --- a/spec/routing/comments_controller_routing_spec.rb +++ b/spec/routing/comments_controller_routing_spec.rb @@ -5,31 +5,31 @@ describe CommentsController do describe "routing" do it "routes to #index" do - get("/comments").should route_to("comments#index") + expect(get("/comments")).to route_to("comments#index") end it "routes to #new" do - get("/comments/new").should route_to("comments#new") + expect(get("/comments/new")).to route_to("comments#new") end it "routes to #show" do - get("/comments/1").should route_to("comments#show", id: "1") + expect(get("/comments/1")).to route_to("comments#show", id: "1") end it "routes to #edit" do - get("/comments/1/edit").should route_to("comments#edit", id: "1") + expect(get("/comments/1/edit")).to route_to("comments#edit", id: "1") end it "routes to #create" do - post("/comments").should route_to("comments#create") + expect(post("/comments")).to route_to("comments#create") end it "routes to #update" do - put("/comments/1").should route_to("comments#update", id: "1") + expect(put("/comments/1")).to route_to("comments#update", id: "1") end it "routes to #destroy" do - delete("/comments/1").should route_to("comments#destroy", id: "1") + expect(delete("/comments/1")).to route_to("comments#destroy", id: "1") end end end diff --git a/spec/routing/crops_controller_routing_spec.rb b/spec/routing/crops_controller_routing_spec.rb index 7821db6ff0..12373dae11 100644 --- a/spec/routing/crops_controller_routing_spec.rb +++ b/spec/routing/crops_controller_routing_spec.rb @@ -5,35 +5,35 @@ describe CropsController do describe "routing" do it "routes to #index" do - get("/crops").should route_to("crops#index") + expect(get("/crops")).to route_to("crops#index") end it "routes to #new" do - get("/crops/new").should route_to("crops#new") + expect(get("/crops/new")).to route_to("crops#new") end it "routes to #show" do - get("/crops/lettuce").should route_to("crops#show", slug: 'lettuce') + expect(get("/crops/lettuce")).to route_to("crops#show", slug: 'lettuce') end - it { get("/crops/lettuce/plantings").should route_to("plantings#index", crop_slug: 'lettuce') } - it { get("/crops/lettuce/harvests").should route_to("harvests#index", crop_slug: 'lettuce') } - it { get("/crops/lettuce/seeds").should route_to("seeds#index", crop_slug: 'lettuce') } + it { expect(get("/crops/lettuce/plantings")).to route_to("plantings#index", crop_slug: 'lettuce') } + it { expect(get("/crops/lettuce/harvests")).to route_to("harvests#index", crop_slug: 'lettuce') } + it { expect(get("/crops/lettuce/seeds")).to route_to("seeds#index", crop_slug: 'lettuce') } it "routes to #edit" do - get("/crops/lettuce/edit").should route_to("crops#edit", slug: "lettuce") + expect(get("/crops/lettuce/edit")).to route_to("crops#edit", slug: "lettuce") end it "routes to #create" do - post("/crops").should route_to("crops#create") + expect(post("/crops")).to route_to("crops#create") end it "routes to #update" do - put("/crops/lettuce").should route_to("crops#update", slug: "lettuce") + expect(put("/crops/lettuce")).to route_to("crops#update", slug: "lettuce") end it "routes to #destroy" do - delete("/crops/lettuce").should route_to("crops#destroy", slug: "lettuce") + expect(delete("/crops/lettuce")).to route_to("crops#destroy", slug: "lettuce") end end end diff --git a/spec/routing/follows_controller_routing_spec.rb b/spec/routing/follows_controller_routing_spec.rb index e79c266100..82dfa12c27 100644 --- a/spec/routing/follows_controller_routing_spec.rb +++ b/spec/routing/follows_controller_routing_spec.rb @@ -5,11 +5,11 @@ describe FollowsController do describe "routing" do it "routes to #create" do - post("/follows").should route_to("follows#create") + expect(post("/follows")).to route_to("follows#create") end it "routes to #destroy" do - delete("/follows/1").should route_to("follows#destroy", id: "1") + expect(delete("/follows/1")).to route_to("follows#destroy", id: "1") end end end diff --git a/spec/routing/forums_controller_routing_spec.rb b/spec/routing/forums_controller_routing_spec.rb index 5c3ade5455..e7a187b6b8 100644 --- a/spec/routing/forums_controller_routing_spec.rb +++ b/spec/routing/forums_controller_routing_spec.rb @@ -5,31 +5,31 @@ describe ForumsController do describe "routing" do it "routes to #index" do - get("/forums").should route_to("forums#index") + expect(get("/forums")).to route_to("forums#index") end it "routes to #new" do - get("/forums/new").should route_to("forums#new") + expect(get("/forums/new")).to route_to("forums#new") end it "routes to #show" do - get("/forums/1").should route_to("forums#show", id: "1") + expect(get("/forums/1")).to route_to("forums#show", id: "1") end it "routes to #edit" do - get("/forums/1/edit").should route_to("forums#edit", id: "1") + expect(get("/forums/1/edit")).to route_to("forums#edit", id: "1") end it "routes to #create" do - post("/forums").should route_to("forums#create") + expect(post("/forums")).to route_to("forums#create") end it "routes to #update" do - put("/forums/1").should route_to("forums#update", id: "1") + expect(put("/forums/1")).to route_to("forums#update", id: "1") end it "routes to #destroy" do - delete("/forums/1").should route_to("forums#destroy", id: "1") + expect(delete("/forums/1")).to route_to("forums#destroy", id: "1") end end end diff --git a/spec/routing/garden_types_controller_routing_spec.rb b/spec/routing/garden_types_controller_routing_spec.rb index 805ebdfa33..ba2f038b7a 100644 --- a/spec/routing/garden_types_controller_routing_spec.rb +++ b/spec/routing/garden_types_controller_routing_spec.rb @@ -5,31 +5,31 @@ describe GardenTypesController do describe "routing" do it "routes to #index" do - get("/garden_types").should route_to("garden_types#index") + expect(get("/garden_types")).to route_to("garden_types#index") end it "routes to #new" do - get("/garden_types/new").should route_to("garden_types#new") + expect(get("/garden_types/new")).to route_to("garden_types#new") end it "routes to #show" do - get("/garden_types/1").should route_to("garden_types#show", id: "1") + expect(get("/garden_types/1")).to route_to("garden_types#show", id: "1") end it "routes to #edit" do - get("/garden_types/1/edit").should route_to("garden_types#edit", id: "1") + expect(get("/garden_types/1/edit")).to route_to("garden_types#edit", id: "1") end it "routes to #create" do - post("/garden_types").should route_to("garden_types#create") + expect(post("/garden_types")).to route_to("garden_types#create") end it "routes to #update" do - put("/garden_types/1").should route_to("garden_types#update", id: "1") + expect(put("/garden_types/1")).to route_to("garden_types#update", id: "1") end it "routes to #destroy" do - delete("/garden_types/1").should route_to("garden_types#destroy", id: "1") + expect(delete("/garden_types/1")).to route_to("garden_types#destroy", id: "1") end end end diff --git a/spec/routing/gardens_controller_routing_spec.rb b/spec/routing/gardens_controller_routing_spec.rb index 365fba5e7a..ff3d7e67a3 100644 --- a/spec/routing/gardens_controller_routing_spec.rb +++ b/spec/routing/gardens_controller_routing_spec.rb @@ -5,32 +5,32 @@ describe GardensController do describe "routing" do it "routes to #index" do - get("/gardens").should route_to("gardens#index") - get("/members/fred/gardens").should route_to("gardens#index", member_slug: 'fred') + expect(get("/gardens")).to route_to("gardens#index") + expect(get("/members/fred/gardens")).to route_to("gardens#index", member_slug: 'fred') end it "routes to #new" do - get("/gardens/new").should route_to("gardens#new") + expect(get("/gardens/new")).to route_to("gardens#new") end it "routes to #show" do - get("/gardens/sunny-bed").should route_to("gardens#show", slug: 'sunny-bed') + expect(get("/gardens/sunny-bed")).to route_to("gardens#show", slug: 'sunny-bed') end it "routes to #edit" do - get("/gardens/sunny-bed/edit").should route_to("gardens#edit", slug: 'sunny-bed') + expect(get("/gardens/sunny-bed/edit")).to route_to("gardens#edit", slug: 'sunny-bed') end it "routes to #create" do - post("/gardens").should route_to("gardens#create") + expect(post("/gardens")).to route_to("gardens#create") end it "routes to #update" do - put("/gardens/sunny-bed").should route_to("gardens#update", slug: 'sunny-bed') + expect(put("/gardens/sunny-bed")).to route_to("gardens#update", slug: 'sunny-bed') end it "routes to #destroy" do - delete("/gardens/sunny-bed").should route_to("gardens#destroy", slug: 'sunny-bed') + expect(delete("/gardens/sunny-bed")).to route_to("gardens#destroy", slug: 'sunny-bed') end end end diff --git a/spec/routing/harvests_controller_routing_spec.rb b/spec/routing/harvests_controller_routing_spec.rb index 22ee305fc6..4bb12b2885 100644 --- a/spec/routing/harvests_controller_routing_spec.rb +++ b/spec/routing/harvests_controller_routing_spec.rb @@ -5,32 +5,32 @@ describe HarvestsController do describe "routing" do it "routes to #index" do - get("/harvests").should route_to("harvests#index") - get("/members/fred/harvests").should route_to("harvests#index", member_slug: 'fred') + expect(get("/harvests")).to route_to("harvests#index") + expect(get("/members/fred/harvests")).to route_to("harvests#index", member_slug: 'fred') end it "routes to #new" do - get("/harvests/new").should route_to("harvests#new") + expect(get("/harvests/new")).to route_to("harvests#new") end it "routes to #show" do - get("/harvests/potato").should route_to("harvests#show", slug: "potato") + expect(get("/harvests/potato")).to route_to("harvests#show", slug: "potato") end it "routes to #edit" do - get("/harvests/potato/edit").should route_to("harvests#edit", slug: "potato") + expect(get("/harvests/potato/edit")).to route_to("harvests#edit", slug: "potato") end it "routes to #create" do - post("/harvests").should route_to("harvests#create") + expect(post("/harvests")).to route_to("harvests#create") end it "routes to #update" do - put("/harvests/potato").should route_to("harvests#update", slug: "potato") + expect(put("/harvests/potato")).to route_to("harvests#update", slug: "potato") end it "routes to #destroy" do - delete("/harvests/potato").should route_to("harvests#destroy", slug: "potato") + expect(delete("/harvests/potato")).to route_to("harvests#destroy", slug: "potato") end end end diff --git a/spec/routing/members_controller_routing_spec.rb b/spec/routing/members_controller_routing_spec.rb index 367656d83c..d70793fc2a 100644 --- a/spec/routing/members_controller_routing_spec.rb +++ b/spec/routing/members_controller_routing_spec.rb @@ -5,39 +5,39 @@ describe MembersController do describe "routing" do it "routes to #index" do - get("/members").should route_to("members#index") + expect(get("/members")).to route_to("members#index") end it "routes to #new" do - get("/members/new").should route_to("members#new") + expect(get("/members/new")).to route_to("members#new") end it "routes to #show" do - get("/members/name").should route_to("members#show", slug: "name") + expect(get("/members/name")).to route_to("members#show", slug: "name") end it "routes to #edit" do - get("/members/name/edit").should route_to("members#edit", slug: "name") + expect(get("/members/name/edit")).to route_to("members#edit", slug: "name") end # it "routes to #create" do - # post("/members").should route_to("members#create") + # expect(post("/members")).to route_to("members#create") # end it "routes to #update" do - put("/members/name").should route_to("members#update", slug: "name") + expect(put("/members/name")).to route_to("members#update", slug: "name") end it "routes to #destroy" do - delete("/members/name").should route_to("members#destroy", slug: "name") + expect(delete("/members/name")).to route_to("members#destroy", slug: "name") end it "routes to harvests#index" do - get("/members/name/harvests").should route_to("harvests#index", member_slug: 'name') + expect(get("/members/name/harvests")).to route_to("harvests#index", member_slug: 'name') end it "routes to plantings#index" do - get("/members/name/plantings").should route_to("plantings#index", member_slug: 'name') + expect(get("/members/name/plantings")).to route_to("plantings#index", member_slug: 'name') end end end diff --git a/spec/routing/photos_controller_routing_spec.rb b/spec/routing/photos_controller_routing_spec.rb index 812acf84ac..b83b6571c5 100644 --- a/spec/routing/photos_controller_routing_spec.rb +++ b/spec/routing/photos_controller_routing_spec.rb @@ -5,31 +5,31 @@ describe PhotosController do describe "routing" do it "routes to #index" do - get("/photos").should route_to("photos#index") + expect(get("/photos")).to route_to("photos#index") end it "routes to #new" do - get("/photos/new").should route_to("photos#new") + expect(get("/photos/new")).to route_to("photos#new") end it "routes to #show" do - get("/photos/1").should route_to("photos#show", id: "1") + expect(get("/photos/1")).to route_to("photos#show", id: "1") end it "routes to #edit" do - get("/photos/1/edit").should route_to("photos#edit", id: "1") + expect(get("/photos/1/edit")).to route_to("photos#edit", id: "1") end it "routes to #create" do - post("/photos").should route_to("photos#create") + expect(post("/photos")).to route_to("photos#create") end it "routes to #update" do - put("/photos/1").should route_to("photos#update", id: "1") + expect(put("/photos/1")).to route_to("photos#update", id: "1") end it "routes to #destroy" do - delete("/photos/1").should route_to("photos#destroy", id: "1") + expect(delete("/photos/1")).to route_to("photos#destroy", id: "1") end end end diff --git a/spec/routing/plant_parts_controller_routing_spec.rb b/spec/routing/plant_parts_controller_routing_spec.rb index 3e10372d77..7fe2dff71e 100644 --- a/spec/routing/plant_parts_controller_routing_spec.rb +++ b/spec/routing/plant_parts_controller_routing_spec.rb @@ -5,31 +5,31 @@ describe PlantPartsController do describe "routing" do it "routes to #index" do - get("/plant_parts").should route_to("plant_parts#index") + expect(get("/plant_parts")).to route_to("plant_parts#index") end it "routes to #new" do - get("/plant_parts/new").should route_to("plant_parts#new") + expect(get("/plant_parts/new")).to route_to("plant_parts#new") end it "routes to #show" do - get("/plant_parts/1").should route_to("plant_parts#show", id: "1") + expect(get("/plant_parts/1")).to route_to("plant_parts#show", id: "1") end it "routes to #edit" do - get("/plant_parts/1/edit").should route_to("plant_parts#edit", id: "1") + expect(get("/plant_parts/1/edit")).to route_to("plant_parts#edit", id: "1") end it "routes to #create" do - post("/plant_parts").should route_to("plant_parts#create") + expect(post("/plant_parts")).to route_to("plant_parts#create") end it "routes to #update" do - put("/plant_parts/1").should route_to("plant_parts#update", id: "1") + expect(put("/plant_parts/1")).to route_to("plant_parts#update", id: "1") end it "routes to #destroy" do - delete("/plant_parts/1").should route_to("plant_parts#destroy", id: "1") + expect(delete("/plant_parts/1")).to route_to("plant_parts#destroy", id: "1") end end end diff --git a/spec/routing/plantings_controller_routing_spec.rb b/spec/routing/plantings_controller_routing_spec.rb index e3a8b53443..c05cc83c70 100644 --- a/spec/routing/plantings_controller_routing_spec.rb +++ b/spec/routing/plantings_controller_routing_spec.rb @@ -5,32 +5,32 @@ describe PlantingsController do describe "routing" do it "routes to #index" do - get("/plantings").should route_to("plantings#index") - get("/members/fred/plantings").should route_to("plantings#index", member_slug: 'fred') + expect(get("/plantings")).to route_to("plantings#index") + expect(get("/members/fred/plantings")).to route_to("plantings#index", member_slug: 'fred') end it "routes to #new" do - get("/plantings/new").should route_to("plantings#new") + expect(get("/plantings/new")).to route_to("plantings#new") end it "routes to #show" do - get("/plantings/tomato").should route_to("plantings#show", slug: "tomato") + expect(get("/plantings/tomato")).to route_to("plantings#show", slug: "tomato") end it "routes to #edit" do - get("/plantings/tomato/edit").should route_to("plantings#edit", slug: "tomato") + expect(get("/plantings/tomato/edit")).to route_to("plantings#edit", slug: "tomato") end it "routes to #create" do - post("/plantings").should route_to("plantings#create") + expect(post("/plantings")).to route_to("plantings#create") end it "routes to #update" do - put("/plantings/tomato").should route_to("plantings#update", slug: "tomato") + expect(put("/plantings/tomato")).to route_to("plantings#update", slug: "tomato") end it "routes to #destroy" do - delete("/plantings/tomato").should route_to("plantings#destroy", slug: "tomato") + expect(delete("/plantings/tomato")).to route_to("plantings#destroy", slug: "tomato") end end end diff --git a/spec/routing/posts_controller_updates_routing_spec.rb b/spec/routing/posts_controller_updates_routing_spec.rb index 9c97155269..320095cd3f 100644 --- a/spec/routing/posts_controller_updates_routing_spec.rb +++ b/spec/routing/posts_controller_updates_routing_spec.rb @@ -5,31 +5,31 @@ describe PostsController do describe "routing" do it "routes to #index" do - get("/posts").should route_to("posts#index") + expect(get("/posts")).to route_to("posts#index") end it "routes to #new" do - get("/posts/new").should route_to("posts#new") + expect(get("/posts/new")).to route_to("posts#new") end it "routes to #show" do - get("/posts/1").should route_to("posts#show", id: "1") + expect(get("/posts/1")).to route_to("posts#show", id: "1") end it "routes to #edit" do - get("/posts/1/edit").should route_to("posts#edit", id: "1") + expect(get("/posts/1/edit")).to route_to("posts#edit", id: "1") end it "routes to #create" do - post("/posts").should route_to("posts#create") + expect(post("/posts")).to route_to("posts#create") end it "routes to #update" do - put("/posts/1").should route_to("posts#update", id: "1") + expect(put("/posts/1")).to route_to("posts#update", id: "1") end it "routes to #destroy" do - delete("/posts/1").should route_to("posts#destroy", id: "1") + expect(delete("/posts/1")).to route_to("posts#destroy", id: "1") end end end diff --git a/spec/routing/scientific_names_controller_routing_spec.rb b/spec/routing/scientific_names_controller_routing_spec.rb index b52f4b43cf..58b4f1419b 100644 --- a/spec/routing/scientific_names_controller_routing_spec.rb +++ b/spec/routing/scientific_names_controller_routing_spec.rb @@ -5,31 +5,31 @@ describe ScientificNamesController do describe "routing" do it "routes to #index" do - get("/scientific_names").should route_to("scientific_names#index") + expect(get("/scientific_names")).to route_to("scientific_names#index") end it "routes to #new" do - get("/scientific_names/new").should route_to("scientific_names#new") + expect(get("/scientific_names/new")).to route_to("scientific_names#new") end it "routes to #show" do - get("/scientific_names/1").should route_to("scientific_names#show", id: "1") + expect(get("/scientific_names/1")).to route_to("scientific_names#show", id: "1") end it "routes to #edit" do - get("/scientific_names/1/edit").should route_to("scientific_names#edit", id: "1") + expect(get("/scientific_names/1/edit")).to route_to("scientific_names#edit", id: "1") end it "routes to #create" do - post("/scientific_names").should route_to("scientific_names#create") + expect(post("/scientific_names")).to route_to("scientific_names#create") end it "routes to #update" do - put("/scientific_names/1").should route_to("scientific_names#update", id: "1") + expect(put("/scientific_names/1")).to route_to("scientific_names#update", id: "1") end it "routes to #destroy" do - delete("/scientific_names/1").should route_to("scientific_names#destroy", id: "1") + expect(delete("/scientific_names/1")).to route_to("scientific_names#destroy", id: "1") end end end diff --git a/spec/routing/seeds_controller_routing_spec.rb b/spec/routing/seeds_controller_routing_spec.rb index 65710acb12..2e80a61219 100644 --- a/spec/routing/seeds_controller_routing_spec.rb +++ b/spec/routing/seeds_controller_routing_spec.rb @@ -5,32 +5,32 @@ describe SeedsController do describe "routing" do it "routes to #index" do - get("/seeds").should route_to("seeds#index") - get("/members/fred/seeds").should route_to("seeds#index", member_slug: 'fred') + expect(get("/seeds")).to route_to("seeds#index") + expect(get("/members/fred/seeds")).to route_to("seeds#index", member_slug: 'fred') end it "routes to #new" do - get("/seeds/new").should route_to("seeds#new") + expect(get("/seeds/new")).to route_to("seeds#new") end it "routes to #show" do - get("/seeds/corn").should route_to("seeds#show", slug: 'corn') + expect(get("/seeds/corn")).to route_to("seeds#show", slug: 'corn') end it "routes to #edit" do - get("/seeds/corn/edit").should route_to("seeds#edit", slug: 'corn') + expect(get("/seeds/corn/edit")).to route_to("seeds#edit", slug: 'corn') end it "routes to #create" do - post("/seeds").should route_to("seeds#create") + expect(post("/seeds")).to route_to("seeds#create") end it "routes to #update" do - put("/seeds/corn").should route_to("seeds#update", slug: 'corn') + expect(put("/seeds/corn")).to route_to("seeds#update", slug: 'corn') end it "routes to #destroy" do - delete("/seeds/corn").should route_to("seeds#destroy", slug: 'corn') + expect(delete("/seeds/corn")).to route_to("seeds#destroy", slug: 'corn') end end end diff --git a/spec/views/comments/index.rss.haml_spec.rb b/spec/views/comments/index.rss.haml_spec.rb index ff8df501b5..ceb1c79f80 100644 --- a/spec/views/comments/index.rss.haml_spec.rb +++ b/spec/views/comments/index.rss.haml_spec.rb @@ -24,7 +24,7 @@ it 'escapes html for link to post' do # it's then unescaped by 'render' so we don't actually look for < - rendered.to_s.should have_content '