Skip to content

Commit

Permalink
Upgrade to rspec v3
Browse files Browse the repository at this point in the history
Stick at 3.2 for now because later versions expose alexrothenberg/ammeter#49.
  • Loading branch information
bensymonds committed Sep 7, 2015
1 parent 015d9fa commit 9797067
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 37 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
34 changes: 18 additions & 16 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions spec/helpers/navigation_help_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions spec/lib/slices/asset/maker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion spec/models/asset/paperclip_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/models/asset/text_search_in_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions spec/models/slice/cache_key_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@
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,
)
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
Expand Down
2 changes: 1 addition & 1 deletion spec/requests/admin/set/deleting_entries_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 1 addition & 3 deletions spec/support/api_example_group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

2 changes: 1 addition & 1 deletion spec/support/generator_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions spec/support/matchers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

0 comments on commit 9797067

Please sign in to comment.