diff --git a/spec/lib/spree/core/calculated_adjustments_spec.rb b/spec/lib/spree/core/calculated_adjustments_spec.rb index b701fff3e0..b9210c4f29 100644 --- a/spec/lib/spree/core/calculated_adjustments_spec.rb +++ b/spec/lib/spree/core/calculated_adjustments_spec.rb @@ -24,7 +24,7 @@ describe Spree::Core::CalculatedAdjustments do let(:target) { order } it "should be associated with the target" do - target.adjustments.should_receive(:create) + expect(target.adjustments).to receive(:create) tax_rate.create_adjustment("foo", target, order) end @@ -42,7 +42,7 @@ describe Spree::Core::CalculatedAdjustments do end context "when the calculator returns 0" do - before { calculator.stub(compute: 0) } + before { allow(calculator).to receive_messages(compute: 0) } context "when adjustment is mandatory" do before { tax_rate.create_adjustment("foo", target, order, true) } @@ -66,7 +66,7 @@ describe Spree::Core::CalculatedAdjustments do it "should update the adjustment using its calculator (and the specified source)" do adjustment = double(:adjustment).as_null_object calculable = double :calculable - adjustment.should_receive(:update_column).with(:amount, 10) + expect(adjustment).to receive(:update_column).with(:amount, 10) tax_rate.update_adjustment(adjustment, calculable) end end diff --git a/spec/lib/spree/core/mail_settings_spec.rb b/spec/lib/spree/core/mail_settings_spec.rb index 753f8465ee..a8db4d5eed 100644 --- a/spec/lib/spree/core/mail_settings_spec.rb +++ b/spec/lib/spree/core/mail_settings_spec.rb @@ -12,8 +12,8 @@ module Spree context "init" do it "calls override!" do - MailSettings.should_receive(:new).and_return(subject) - subject.should_receive(:override!) + expect(MailSettings).to receive(:new).and_return(subject) + expect(subject).to receive(:override!) MailSettings.init end end @@ -80,7 +80,7 @@ module Spree context "init" do it "doesnt calls override!" do - subject.should_not_receive(:override!) + expect(subject).not_to receive(:override!) MailSettings.init end end diff --git a/spec/lib/spree/core/token_resource_spec.rb b/spec/lib/spree/core/token_resource_spec.rb index b5be7195c0..087c5b9350 100644 --- a/spec/lib/spree/core/token_resource_spec.rb +++ b/spec/lib/spree/core/token_resource_spec.rb @@ -16,8 +16,8 @@ describe Spree::Core::TokenResource do context '#token' do it 'should return the token of the associated permission' do - order.stub tokenized_permission: permission - permission.stub token: 'foo' + allow(order).to receive_messages tokenized_permission: permission + allow(permission).to receive_messages token: 'foo' expect(order.token).to eq 'foo' end diff --git a/spec/lib/spree/product_duplicator_spec.rb b/spec/lib/spree/product_duplicator_spec.rb index 0a9a702eed..7978465a5e 100644 --- a/spec/lib/spree/product_duplicator_spec.rb +++ b/spec/lib/spree/product_duplicator_spec.rb @@ -49,36 +49,36 @@ module Spree end before do - product.should_receive(:dup).and_return(new_product) - variant.should_receive(:dup).and_return(new_variant) - image.should_receive(:dup).and_return(new_image) - property.should_receive(:dup).and_return(new_property) + expect(product).to receive(:dup).and_return(new_product) + expect(variant).to receive(:dup).and_return(new_variant) + expect(image).to receive(:dup).and_return(new_image) + expect(property).to receive(:dup).and_return(new_property) end it "can duplicate a product" do duplicator = Spree::ProductDuplicator.new(product) - new_product.should_receive(:name=).with("COPY OF foo") - new_product.should_receive(:taxons=).with([]) - new_product.should_receive(:product_properties=).with([new_property]) - new_product.should_receive(:created_at=).with(nil) - new_product.should_receive(:updated_at=).with(nil) - new_product.should_receive(:deleted_at=).with(nil) - new_product.should_receive(:master=).with(new_variant) + expect(new_product).to receive(:name=).with("COPY OF foo") + expect(new_product).to receive(:taxons=).with([]) + expect(new_product).to receive(:product_properties=).with([new_property]) + expect(new_product).to receive(:created_at=).with(nil) + expect(new_product).to receive(:updated_at=).with(nil) + expect(new_product).to receive(:deleted_at=).with(nil) + expect(new_product).to receive(:master=).with(new_variant) - new_variant.should_receive(:sku=).with("COPY OF 12345") - new_variant.should_receive(:deleted_at=).with(nil) - new_variant.should_receive(:images=).with([new_image]) - new_variant.should_receive(:price=).with(variant.price) - new_variant.should_receive(:currency=).with(variant.currency) + expect(new_variant).to receive(:sku=).with("COPY OF 12345") + expect(new_variant).to receive(:deleted_at=).with(nil) + expect(new_variant).to receive(:images=).with([new_image]) + expect(new_variant).to receive(:price=).with(variant.price) + expect(new_variant).to receive(:currency=).with(variant.currency) - image.attachment.should_receive(:clone).and_return(image.attachment) + expect(image.attachment).to receive(:clone).and_return(image.attachment) - new_image.should_receive(:assign_attributes). + expect(new_image).to receive(:assign_attributes). with(attachment: image.attachment). and_return(new_image) - new_property.should_receive(:created_at=).with(nil) - new_property.should_receive(:updated_at=).with(nil) + expect(new_property).to receive(:created_at=).with(nil) + expect(new_property).to receive(:updated_at=).with(nil) duplicator.duplicate end