diff --git a/Gemfile b/Gemfile index 17dc224..b44c63f 100644 --- a/Gemfile +++ b/Gemfile @@ -11,7 +11,7 @@ group :development, :test do gem 'database_cleaner' , '~> 0.9.1' gem 'escape_utils' , '~> 0.2.4' gem 'pry-rails' , '~> 0.2.2' - gem 'rspec-rails' , '~> 2.99' + gem 'rspec-rails' , '~> 3.2.0' gem 'poltergeist' end diff --git a/Gemfile.lock b/Gemfile.lock index 5c8f08e..35ca0b2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -172,21 +172,23 @@ GEM rdoc (3.12.2) json (~> 1.4) redcarpet (3.0.0) - rspec-collection_matchers (1.0.0) - rspec-expectations (>= 2.99.0.beta1) - rspec-core (2.99.0) - rspec-expectations (2.99.0) - diff-lcs (>= 1.1.3, < 2.0) - rspec-mocks (2.99.1) - rspec-rails (2.99.0) - actionpack (>= 3.0) - activemodel (>= 3.0) - activesupport (>= 3.0) - railties (>= 3.0) - rspec-collection_matchers - rspec-core (~> 2.99.0) - rspec-expectations (~> 2.99.0) - rspec-mocks (~> 2.99.0) + rspec-core (3.2.3) + rspec-support (~> 3.2.0) + rspec-expectations (3.2.1) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.2.0) + rspec-mocks (3.2.1) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.2.0) + rspec-rails (3.2.3) + actionpack (>= 3.0, < 4.3) + activesupport (>= 3.0, < 4.3) + railties (>= 3.0, < 4.3) + rspec-core (~> 3.2.0) + rspec-expectations (~> 3.2.0) + rspec-mocks (~> 3.2.0) + rspec-support (~> 3.2.0) + rspec-support (3.2.2) ruby-hmac (0.4.0) sass (3.2.13) sass-rails (3.2.6) @@ -232,7 +234,7 @@ DEPENDENCIES launchy (~> 2.1.2) poltergeist pry-rails (~> 0.2.2) - rspec-rails (~> 2.99) + rspec-rails (~> 3.2.0) sass-rails (~> 3.2.5) slices! uglifier (~> 1.3.0) diff --git a/spec/helpers/navigation_help_spec.rb b/spec/helpers/navigation_help_spec.rb index 3a28c0c..cb299e2 100644 --- a/spec/helpers/navigation_help_spec.rb +++ b/spec/helpers/navigation_help_spec.rb @@ -28,11 +28,11 @@ def it_does_not_render_for(path, level, depth = 1) stripped_html(actual) == stripped_html(expected) end - failure_message_for_should do |actual| + failure_message do |actual| "expected that\n#{actual}\nwould be equlivent to\n#{expected}" end - failure_message_for_should_not do |actual| + failure_message_when_negated do |actual| "expected that\n#{actual} would not be equlivent to\n#{expected}" end diff --git a/spec/helpers/page_helper/google_analytics_tracking_code_spec.rb b/spec/helpers/page_helper/google_analytics_tracking_code_spec.rb index 5165b7b..9063106 100644 --- a/spec/helpers/page_helper/google_analytics_tracking_code_spec.rb +++ b/spec/helpers/page_helper/google_analytics_tracking_code_spec.rb @@ -6,7 +6,7 @@ context "when tracking" do before do - helper.stub(add_tracking_code?: true) + allow(helper).to receive_messages(add_tracking_code?: true) end context "tracking one account" do @@ -85,7 +85,7 @@ context "in production" do before do - Rails.stub_chain(:env, :production?).and_return(true) + allow(Rails).to receive_messages(env: double(production?: true)) end context "not signed in" do diff --git a/spec/lib/slices/asset/maker_spec.rb b/spec/lib/slices/asset/maker_spec.rb index 1bb02c5..f4600ab 100644 --- a/spec/lib/slices/asset/maker_spec.rb +++ b/spec/lib/slices/asset/maker_spec.rb @@ -3,7 +3,7 @@ describe 'Slices::Asset::Maker' do before do - Slices::Config.stub(s3_storage?: false) + allow(Slices::Config).to receive_messages(s3_storage?: false) end let :args do @@ -26,7 +26,7 @@ describe ".find_matching_asset" do it "looks for a mathching asset" do new_asset = double(:new_asset).as_null_object - maker.stub(new_asset: new_asset) + allow(maker).to receive_messages(new_asset: new_asset) matching_asset = double(:matching_asset).as_null_object expect(Asset).to receive(:where).and_return(double(first:matching_asset)) diff --git a/spec/models/asset/paperclip_spec.rb b/spec/models/asset/paperclip_spec.rb index bac0369..9be6ef4 100644 --- a/spec/models/asset/paperclip_spec.rb +++ b/spec/models/asset/paperclip_spec.rb @@ -160,7 +160,7 @@ it "processes the style" do asset = Asset.new(file_dimensions: {} ) - asset.file.stub(exists?: true) + allow(asset.file).to receive_messages(exists?: true) expect(asset.file).to receive(:reprocess!) asset.reprocess_for(:extended) end diff --git a/spec/models/asset/text_search_in_spec.rb b/spec/models/asset/text_search_in_spec.rb index 0093af4..4d73b8a 100644 --- a/spec/models/asset/text_search_in_spec.rb +++ b/spec/models/asset/text_search_in_spec.rb @@ -32,7 +32,7 @@ end before do - asset.stub(update_page_cache: true) + allow(asset).to receive_messages(update_page_cache: true) asset.page_cache = page_cache asset.save end diff --git a/spec/models/slice/cache_key_spec.rb b/spec/models/slice/cache_key_spec.rb index 71e91e2..15e5ffa 100644 --- a/spec/models/slice/cache_key_spec.rb +++ b/spec/models/slice/cache_key_spec.rb @@ -13,7 +13,7 @@ context "when the slice is embeded in a page" do before do page = double(updated_at: timestamp) - slice.stub( + allow(slice).to receive_messages( id: 'bson', model_key: 'slice', normal_or_set_page: page, @@ -21,13 +21,13 @@ end it "should have the slice id and page's updated at key name" do - slice.cache_key.should eq "slice/bson-20131211100908" + expect(slice.cache_key).to eq "slice/bson-20131211100908" end end context "when the slice is not embeded in a page" do it "should only have the slice id as the key name" do - slice.cache_key.should eq "slice/new" + expect(slice.cache_key).to eq "slice/new" end end end diff --git a/spec/requests/admin/set/deleting_entries_spec.rb b/spec/requests/admin/set/deleting_entries_spec.rb index 56c05f8..1b51a4e 100644 --- a/spec/requests/admin/set/deleting_entries_spec.rb +++ b/spec/requests/admin/set/deleting_entries_spec.rb @@ -34,7 +34,7 @@ end it "asks for confirmation" do - @message.should == 'Are you sure?' + expect(@message).to eq 'Are you sure?' end end end diff --git a/spec/support/api_example_group.rb b/spec/support/api_example_group.rb index 893ab5f..634fe7c 100644 --- a/spec/support/api_example_group.rb +++ b/spec/support/api_example_group.rb @@ -35,8 +35,6 @@ def json_errors end RSpec.configure do |config| - config.include RSpec::Rails::ApiExampleGroup, type: :api, example_group: { - file_path: config.escaped_path(%w[spec apis]) - } + config.include RSpec::Rails::ApiExampleGroup, type: :api, file_path: %r{spec/apis} end diff --git a/spec/support/generator_helpers.rb b/spec/support/generator_helpers.rb index aae518f..53d0428 100644 --- a/spec/support/generator_helpers.rb +++ b/spec/support/generator_helpers.rb @@ -25,7 +25,7 @@ def run_generator command end end - failure_message_for_should do |path| + failure_message do |path| if File.exists? path "#{path} did not contain the expected content" else diff --git a/spec/support/matchers.rb b/spec/support/matchers.rb index c245a93..2a80e69 100644 --- a/spec/support/matchers.rb +++ b/spec/support/matchers.rb @@ -9,11 +9,11 @@ end end - failure_message_for_should do |actual| + failure_message do |actual| "expected that '#{actual}' would be a page path" end - failure_message_for_should_not do |actual| + failure_message_when_negated do |actual| "expected that '#{actual}' would not be a page path" end end @@ -23,11 +23,11 @@ expect(actual).to have_no_css '#server-communication', visible: true end - failure_message_for_should do |actual| + failure_message do |actual| "expected to have stopped communicating with the server" end - failure_message_for_should_not do |actual| + failure_message_when_negated do |actual| "expected to still be communicating with the server" end end