Enforce RSpec expect(..).not_to over to_not

This commit is contained in:
Maikel Linke
2024-03-07 16:57:54 +11:00
parent b4385623b2
commit bd6b0ddbf3
163 changed files with 616 additions and 613 deletions

View File

@@ -43,7 +43,7 @@ describe OrderShipment do
it "returns nil for empty shipping_method_id" do
empty_shipping_method_id = ' '
expect(shipment.shipping_rates).to_not receive(:find_by)
expect(shipment.shipping_rates).not_to receive(:find_by)
.with(shipping_method_id: empty_shipping_method_id)
expect(order.select_shipping_method(empty_shipping_method_id)).to be_nil

View File

@@ -63,7 +63,7 @@ describe Customer, type: :model do
c1 = Customer.create(enterprise:, email: non_existing_email, user: user1)
expect(c1.user).to eq user1
expect(c1.email).to eq non_existing_email
expect(c1.email).to_not eq user1.email
expect(c1.email).not_to eq user1.email
c2 = Customer.create(enterprise:, email: user2.email)
expect(c2.user).to eq user2

View File

@@ -196,7 +196,7 @@ describe EnterpriseFee do
end
it "soft-deletes the enterprise fee" do
expect(enterprise_fee.deleted_at).to_not be_nil
expect(enterprise_fee.deleted_at).not_to be_nil
end
it "can be accessed by old adjustments" do

View File

@@ -196,9 +196,9 @@ describe EnterpriseRelationship do
before { er.destroy }
it "should set permission_revoked_at to the current time " \
"for all variant overrides of the relationship" do
expect(vo1.reload.permission_revoked_at).to_not be_nil
expect(vo2.reload.permission_revoked_at).to_not be_nil
expect(vo2.reload.permission_revoked_at).to_not be_nil
expect(vo1.reload.permission_revoked_at).not_to be_nil
expect(vo2.reload.permission_revoked_at).not_to be_nil
expect(vo2.reload.permission_revoked_at).not_to be_nil
end
end
end
@@ -207,8 +207,8 @@ describe EnterpriseRelationship do
before { er.permissions_list = [:add_to_order_cycles]; er.save! }
it "should set permission_revoked_at to the current time " \
"for all relevant variant overrides" do
expect(vo1.reload.permission_revoked_at).to_not be_nil
expect(vo2.reload.permission_revoked_at).to_not be_nil
expect(vo1.reload.permission_revoked_at).not_to be_nil
expect(vo2.reload.permission_revoked_at).not_to be_nil
end
it "should not affect other variant overrides" do
@@ -277,7 +277,7 @@ describe EnterpriseRelationship do
end
it "should not affect other variant overrides" do
expect(vo3.reload.permission_revoked_at).to_not be_nil
expect(vo3.reload.permission_revoked_at).not_to be_nil
end
end
@@ -285,9 +285,9 @@ describe EnterpriseRelationship do
before { er.permissions_list = [:add_to_order_cycles, :manage_products]; er.save! }
it "should have no effect on existing variant_overrides" do
expect(vo1.reload.permission_revoked_at).to_not be_nil
expect(vo2.reload.permission_revoked_at).to_not be_nil
expect(vo3.reload.permission_revoked_at).to_not be_nil
expect(vo1.reload.permission_revoked_at).not_to be_nil
expect(vo2.reload.permission_revoked_at).not_to be_nil
expect(vo3.reload.permission_revoked_at).not_to be_nil
end
end
end

View File

@@ -96,7 +96,7 @@ describe Enterprise do
it "adds new owner to list of managers" do
expect(e.owner).to eq u1
expect(e.users).to include u1
expect(e.users).to_not include u2
expect(e.users).not_to include u2
e.owner = u2
e.save!
e.reload
@@ -132,14 +132,14 @@ describe Enterprise do
it "prevents duplicate names for new records" do
e = Enterprise.new name: enterprise.name
expect(e).to_not be_valid
expect(e).not_to be_valid
expect(e.errors[:name].first).to include enterprise_name_error(owner.email)
end
it "prevents duplicate names for existing records" do
e = create(:enterprise, name: 'foo')
e.name = enterprise.name
expect(e).to_not be_valid
expect(e).not_to be_valid
expect(e.errors[:name].first).to include enterprise_name_error(owner.email)
end
@@ -155,27 +155,27 @@ describe Enterprise do
describe "prevent a wrong instagram link pattern" do
it "invalidates the instagram attribute https://facebook.com/user" do
e = build(:enterprise, instagram: 'https://facebook.com/user')
expect(e).to_not be_valid
expect(e).not_to be_valid
end
it "invalidates the instagram attribute tagram.com/user" do
e = build(:enterprise, instagram: 'tagram.com/user')
expect(e).to_not be_valid
expect(e).not_to be_valid
end
it "invalidates the instagram attribute https://instagram.com/user/preferences" do
e = build(:enterprise, instagram: 'https://instagram.com/user/preferences')
expect(e).to_not be_valid
expect(e).not_to be_valid
end
it "invalidates the instagram attribute https://www.instagram.com/p/Cpg4McNPyJA/" do
e = build(:enterprise, instagram: 'https://www.instagram.com/p/Cpg4McNPyJA/')
expect(e).to_not be_valid
expect(e).not_to be_valid
end
it "invalidates the instagram attribute https://instagram.com/user-user" do
e = build(:enterprise, instagram: 'https://instagram.com/user-user')
expect(e).to_not be_valid
expect(e).not_to be_valid
end
end
@@ -368,7 +368,7 @@ describe Enterprise do
it "finds enterprises that have a sells property other than 'unspecified'" do
activated_enterprises = Enterprise.activated
expect(activated_enterprises).to include active_enterprise
expect(activated_enterprises).to_not include inactive_enterprise
expect(activated_enterprises).not_to include inactive_enterprise
end
end

View File

@@ -15,7 +15,7 @@ describe OrderCycle do
it 'should not be valid when open date is after close date' do
oc = build(:simple_order_cycle, orders_open_at: Time.zone.now, orders_close_at: 1.minute.ago)
expect(oc).to_not be_valid
expect(oc).not_to be_valid
end
it "has a coordinator and associated fees" do
@@ -246,7 +246,7 @@ describe OrderCycle do
it "does not consider soft-deleted variants to be currently distributed in the oc" do
p2_v.delete
expect(oc.variants_distributed_by(d1)).to_not include p2_v
expect(oc.variants_distributed_by(d1)).not_to include p2_v
end
end
end
@@ -564,12 +564,12 @@ describe OrderCycle do
it "it does not reset opened_at if open date is changed to be earlier" do
expect{ oc.update!(orders_open_at: 3.days.ago) }
.to_not change { oc.opened_at }
.not_to change { oc.opened_at }
end
it "it does not reset opened_at if open date does not change" do
expect{ oc.update!(orders_close_at: 1.day.from_now) }
.to_not change { oc.opened_at }
.not_to change { oc.opened_at }
end
end
@@ -580,21 +580,21 @@ describe OrderCycle do
}
it "reset processed_at if close date change in future" do
expect(oc.processed_at).to_not be_nil
expect(oc.processed_at).not_to be_nil
oc.update!(orders_close_at: 1.week.from_now)
expect(oc.processed_at).to be_nil
end
it "it does not reset processed_at if close date is changed to be earlier" do
expect(oc.processed_at).to_not be_nil
expect(oc.processed_at).not_to be_nil
oc.update!(orders_close_at: 2.days.ago)
expect(oc.processed_at).to_not be_nil
expect(oc.processed_at).not_to be_nil
end
it "it does not reset processed_at if close date does not change" do
expect(oc.processed_at).to_not be_nil
expect(oc.processed_at).not_to be_nil
oc.update!(orders_open_at: 2.weeks.ago)
expect(oc.processed_at).to_not be_nil
expect(oc.processed_at).not_to be_nil
end
end

View File

@@ -161,7 +161,7 @@ describe ProductImport::ProductImporter do
expect(carrots.variants.first.unit_value).to eq 500
expect(carrots.variant_unit).to eq 'weight'
expect(carrots.variant_unit_scale).to eq 1
expect(carrots.variants.first.on_demand).to_not eq true
expect(carrots.variants.first.on_demand).not_to eq true
expect(carrots.variants.first.import_date).to be_within(1.minute).of Time.zone.now
potatoes = Spree::Product.find_by(name: 'Potatoes')
@@ -171,7 +171,7 @@ describe ProductImport::ProductImporter do
expect(potatoes.variants.first.unit_value).to eq 2000
expect(potatoes.variant_unit).to eq 'weight'
expect(potatoes.variant_unit_scale).to eq 1000
expect(potatoes.variants.first.on_demand).to_not eq true
expect(potatoes.variants.first.on_demand).not_to eq true
expect(potatoes.variants.first.import_date).to be_within(1.minute).of Time.zone.now
pea_soup = Spree::Product.find_by(name: 'Pea Soup')
@@ -181,7 +181,7 @@ describe ProductImport::ProductImporter do
expect(pea_soup.variants.first.unit_value).to eq 0.75
expect(pea_soup.variant_unit).to eq 'volume'
expect(pea_soup.variant_unit_scale).to eq 0.001
expect(pea_soup.variants.first.on_demand).to_not eq true
expect(pea_soup.variants.first.on_demand).not_to eq true
expect(pea_soup.variants.first.import_date).to be_within(1.minute).of Time.zone.now
salad = Spree::Product.find_by(name: 'Salad')
@@ -191,7 +191,7 @@ describe ProductImport::ProductImporter do
expect(salad.variants.first.unit_value).to eq 1
expect(salad.variant_unit).to eq 'items'
expect(salad.variant_unit_scale).to eq nil
expect(salad.variants.first.on_demand).to_not eq true
expect(salad.variants.first.on_demand).not_to eq true
expect(salad.variants.first.import_date).to be_within(1.minute).of Time.zone.now
buns = Spree::Product.find_by(name: 'Hot Cross Buns')
@@ -550,7 +550,7 @@ describe ProductImport::ProductImporter do
beetroot = Spree::Product.find_by(name: 'Beetroot').variants.first
expect(beetroot.price).to eq 3.50
expect(beetroot.on_demand).to_not eq true
expect(beetroot.on_demand).not_to eq true
tomato = Spree::Product.find_by(name: 'Tomato').variants.first
expect(tomato.price).to eq 5.50

View File

@@ -205,8 +205,8 @@ describe ProxyOrder, type: :model do
end
it "returns the existing order" do
expect(OrderFactory).to_not receive(:new)
expect(proxy_order).to_not receive(:save!)
expect(OrderFactory).not_to receive(:new)
expect(proxy_order).not_to receive(:save!)
expect(proxy_order.initialise_order!).to eq existing_order
end
end

View File

@@ -9,6 +9,6 @@ describe ReportBlob, type: :model do
expect do
blob = ReportBlob.create!("customers.html", content)
content = blob.result
end.to_not change { content.encoding }.from(Encoding::UTF_8)
end.not_to change { content.encoding }.from(Encoding::UTF_8)
end
end

View File

@@ -55,10 +55,10 @@ describe Spree::Ability do
context 'with customer' do
it 'should not be able to admin' do
expect(subject).to_not be_able_to :admin, resource
expect(subject).to_not be_able_to :admin, resource_order
expect(subject).to_not be_able_to :admin, resource_product
expect(subject).to_not be_able_to :admin, resource_user
expect(subject).not_to be_able_to :admin, resource
expect(subject).not_to be_able_to :admin, resource_order
expect(subject).not_to be_able_to :admin, resource_product
expect(subject).not_to be_able_to :admin, resource_user
end
end
end

View File

@@ -36,9 +36,9 @@ describe Spree::Address do
expect(cloned.state_name).to eq original.state_name
expect(cloned.zipcode).to eq original.zipcode
expect(cloned.id).to_not eq original.id
expect(cloned.created_at).to_not eq original.created_at
expect(cloned.updated_at).to_not eq original.updated_at
expect(cloned.id).not_to eq original.id
expect(cloned.created_at).not_to eq original.created_at
expect(cloned.updated_at).not_to eq original.updated_at
end
end
@@ -74,7 +74,7 @@ describe Spree::Address do
it "errors when state_name is nil" do
address.state_name = nil
address.state = nil
expect(address).to_not be_valid
expect(address).not_to be_valid
end
it "full state name is in state_name and country does contain that state" do

View File

@@ -12,7 +12,7 @@ describe Spree::Address do
describe "destroy" do
it "can be deleted" do
expect { address.destroy }.to_not raise_error
expect { address.destroy }.not_to raise_error
end
it "cannot be deleted with associated enterprise" do

View File

@@ -107,7 +107,7 @@ module Spree
it "is false when adjustment state is open" do
adjustment.state = "open"
expect(adjustment).to_not be_immutable
expect(adjustment).not_to be_immutable
end
end
@@ -119,9 +119,9 @@ module Spree
it "is false when adjustment state isn't finalized" do
adjustment.state = "closed"
expect(adjustment).to_not be_finalized
expect(adjustment).not_to be_finalized
adjustment.state = "open"
expect(adjustment).to_not be_finalized
expect(adjustment).not_to be_finalized
end
end
end

View File

@@ -74,41 +74,41 @@ module Spree
context "#valid?" do
it "should validate presence of number" do
credit_card.attributes = valid_credit_card_attributes.except(:number)
expect(credit_card).to_not be_valid
expect(credit_card).not_to be_valid
expect(credit_card.errors[:number]).to eq ["can't be blank"]
end
it "should validate presence of security code" do
credit_card.attributes = valid_credit_card_attributes.except(:verification_value)
expect(credit_card).to_not be_valid
expect(credit_card).not_to be_valid
expect(credit_card.errors[:verification_value]).to eq ["can't be blank"]
end
it "should validate expiration is not in the past" do
credit_card.month = 1.month.ago.month
credit_card.year = 1.month.ago.year
expect(credit_card).to_not be_valid
expect(credit_card).not_to be_valid
expect(credit_card.errors[:base]).to eq ["has expired"]
end
it "does not run expiration in the past validation if month is not set" do
credit_card.month = nil
credit_card.year = Time.zone.now.year
expect(credit_card).to_not be_valid
expect(credit_card).not_to be_valid
expect(credit_card.errors[:base]).to be_blank
end
it "does not run expiration in the past validation if year is not set" do
credit_card.month = Time.zone.now.month
credit_card.year = nil
expect(credit_card).to_not be_valid
expect(credit_card).not_to be_valid
expect(credit_card.errors[:base]).to be_blank
end
it "does not run expiration in the past validation if year and month are empty" do
credit_card.year = ""
credit_card.month = ""
expect(credit_card).to_not be_valid
expect(credit_card).not_to be_valid
expect(credit_card.errors[:card]).to be_blank
end

View File

@@ -29,7 +29,7 @@ describe Spree::InventoryUnit do
# Regression for Spree #3066
it "returns modifiable objects" do
units = Spree::InventoryUnit.backordered_for_stock_item(stock_item)
expect { units.first.save! }.to_not raise_error
expect { units.first.save! }.not_to raise_error
end
it "finds inventory units from its stock location " \
@@ -44,7 +44,7 @@ describe Spree::InventoryUnit do
other_variant_unit.save!
expect(Spree::InventoryUnit.backordered_for_stock_item(stock_item))
.to_not include(other_variant_unit)
.not_to include(other_variant_unit)
end
end

View File

@@ -200,7 +200,7 @@ module Spree
li3.variant.product.destroy
expect(o.line_items.reload.sorted_by_name_and_unit_value).to eq([li6, li5, li4, li3])
expect(o.line_items.sorted_by_name_and_unit_value.to_sql).to_not match "deleted_at"
expect(o.line_items.sorted_by_name_and_unit_value.to_sql).not_to match "deleted_at"
end
end
@@ -340,7 +340,7 @@ module Spree
it "draws stock from the variant override" do
expect(vo.reload.count_on_hand).to eq 3
expect{ line_item.increment!(:quantity) }
.to_not change{ Spree::Variant.find(variant.id).on_hand }
.not_to change{ Spree::Variant.find(variant.id).on_hand }
expect(vo.reload.count_on_hand).to eq 2
end
end
@@ -367,7 +367,7 @@ module Spree
it "restores stock to the variant override" do
expect(vo.reload.count_on_hand).to eq 3
expect{ line_item.destroy }.to_not change{ Spree::Variant.find(variant.id).on_hand }
expect{ line_item.destroy }.not_to change{ Spree::Variant.find(variant.id).on_hand }
expect(vo.reload.count_on_hand).to eq 4
end
end
@@ -458,7 +458,7 @@ module Spree
end
it "returns false otherwise" do
expect(li_no_tax).to_not have_tax
expect(li_no_tax).not_to have_tax
end
end

View File

@@ -87,7 +87,7 @@ module Spree
expect(zero_order.payment_state).to eq "paid"
expect(zero_payment.reload.state).to eq "completed"
expect(zero_payment.captured_at).to_not be_nil
expect(zero_payment.captured_at).not_to be_nil
end
end

View File

@@ -159,7 +159,7 @@ module Spree
it "removes any legacy tax adjustments on order" do
order.create_tax_charge!
expect(order.reload.adjustments).to_not include legacy_tax_adjustment
expect(order.reload.adjustments).not_to include legacy_tax_adjustment
end
it "re-applies taxes on individual items" do

View File

@@ -146,7 +146,7 @@ describe Spree::OrderContents do
end
it "does not update the order's enterprise fees if not complete" do
expect(order).to_not receive(:update_order_fees!)
expect(order).not_to receive(:update_order_fees!)
subject.update_item(line_item, { quantity: 3 })
end

View File

@@ -34,7 +34,7 @@ describe Spree::Order do
end
it "can find a line item matching a given variant" do
expect(order.find_line_item_by_variant(order.line_items.third.variant)).to_not be_nil
expect(order.find_line_item_by_variant(order.line_items.third.variant)).not_to be_nil
expect(order.find_line_item_by_variant(build(:variant))).to be_nil
end
end
@@ -107,7 +107,7 @@ describe Spree::Order do
context "#create" do
it "should assign an order number" do
order = Spree::Order.create
expect(order.number).to_not be_nil
expect(order.number).not_to be_nil
end
end
@@ -1012,7 +1012,7 @@ describe Spree::Order do
it "returns only orders which have line items" do
expect(Spree::Order.not_empty).to include order_with_line_items
expect(Spree::Order.not_empty).to_not include order_without_line_items
expect(Spree::Order.not_empty).not_to include order_without_line_items
end
end
end
@@ -1041,19 +1041,19 @@ describe Spree::Order do
describe "#customer" do
it "is not required for new records" do
is_expected.to_not validate_presence_of(:customer)
is_expected.not_to validate_presence_of(:customer)
end
it "is not required for new complete orders" do
order = Spree::Order.new(state: "complete")
expect(order).to_not validate_presence_of(:customer)
expect(order).not_to validate_presence_of(:customer)
end
it "is not required for existing orders in cart state" do
order = create(:order)
expect(order).to_not validate_presence_of(:customer)
expect(order).not_to validate_presence_of(:customer)
end
it "is created for existing orders in complete state" do
@@ -1070,7 +1070,7 @@ describe Spree::Order do
it "does not create a customer" do
expect {
create(:order, distributor:)
}.to_not change {
}.not_to change {
Customer.count
}
end
@@ -1130,7 +1130,7 @@ describe Spree::Order do
expect {
other_order.update!(state: "complete")
}.to_not change { Customer.count }
}.not_to change { Customer.count }
expect(other_order.customer.email).to eq "new@email.org"
expect(order.customer).to eq other_order.customer
@@ -1334,7 +1334,7 @@ describe Spree::Order do
let!(:payment) { create(:payment, order:, payment_method:) }
it "does not include the :confirm step" do
expect(order.checkout_steps).to_not include "confirm"
expect(order.checkout_steps).not_to include "confirm"
end
end

View File

@@ -145,7 +145,7 @@ describe Spree::Payment do
it "should call capture if the payment is already authorized" do
expect(payment).to receive(:capture!)
expect(payment).to_not receive(:purchase!)
expect(payment).not_to receive(:purchase!)
payment.process_offline!
end
end
@@ -222,7 +222,7 @@ describe Spree::Payment do
it "should mark payment as failed" do
allow(payment_method).to receive(:authorize).and_return(failed_response)
expect(payment).to receive(:failure)
expect(payment).to_not receive(:pend)
expect(payment).not_to receive(:pend)
expect {
payment.authorize!
}.to raise_error(Spree::Core::GatewayError)
@@ -313,7 +313,7 @@ describe Spree::Payment do
it "should not make payment complete" do
allow(payment_method).to receive(:capture).and_return(failed_response)
expect(payment).to receive(:failure)
expect(payment).to_not receive(:complete)
expect(payment).not_to receive(:complete)
expect { payment.capture! }.to raise_error(Spree::Core::GatewayError)
end
end
@@ -323,9 +323,9 @@ describe Spree::Payment do
context "when payment is completed" do
it "should do nothing" do
payment = build_stubbed(:payment, :completed)
expect(payment).to_not receive(:complete)
expect(payment.payment_method).to_not receive(:capture)
expect(payment.log_entries).to_not receive(:create)
expect(payment).not_to receive(:complete)
expect(payment.payment_method).not_to receive(:capture)
expect(payment.log_entries).not_to receive(:create)
payment.capture!
end
end
@@ -382,7 +382,7 @@ describe Spree::Payment do
context "if unsuccessful" do
it "should not void the payment" do
allow(payment_method).to receive(:void).and_return(failed_response)
expect(payment).to_not receive(:void)
expect(payment).not_to receive(:void)
expect { payment.void_transaction! }.to raise_error(Spree::Core::GatewayError)
end
end
@@ -391,7 +391,7 @@ describe Spree::Payment do
context "if payment is already voided" do
it "should not void the payment" do
payment = build_stubbed(:payment, payment_method:, state: 'void')
expect(payment.payment_method).to_not receive(:void)
expect(payment.payment_method).not_to receive(:void)
payment.void_transaction!
end
end
@@ -570,8 +570,8 @@ describe Spree::Payment do
payment = build_stubbed(:payment)
payment.state = 'processing'
expect(payment).to_not receive(:authorize!)
expect(payment).to_not receive(:purchase!)
expect(payment).not_to receive(:authorize!)
expect(payment).not_to receive(:purchase!)
expect(payment.process!).to be_nil
end
end
@@ -717,7 +717,7 @@ describe Spree::Payment do
payment_method.distributors << create(:distributor_enterprise)
payment_method.save!
expect(payment_method).to_not receive :create_profile
expect(payment_method).not_to receive :create_profile
payment = Spree::Payment.create(
amount: 100,
order: create(:order),
@@ -1012,7 +1012,7 @@ describe Spree::Payment do
expect(payment.adjustment.eligible?).to be false
expect(payment.adjustment.finalized?).to be true
expect(order.all_adjustments.payment_fee.count).to eq 1
expect(order.all_adjustments.payment_fee.eligible).to_not include payment.adjustment
expect(order.all_adjustments.payment_fee.eligible).not_to include payment.adjustment
end
end
@@ -1031,7 +1031,7 @@ describe Spree::Payment do
expect(payment.adjustment.eligible?).to be false
expect(payment.adjustment.finalized?).to be true
expect(order.all_adjustments.payment_fee.count).to eq 1
expect(order.all_adjustments.payment_fee.eligible).to_not include payment.adjustment
expect(order.all_adjustments.payment_fee.eligible).not_to include payment.adjustment
end
end

View File

@@ -284,7 +284,7 @@ describe Spree::Preferences::Preferable do
expect(pref_test.preference_cache_key(:pref_test_pref)).to be_nil
pref_test.save
expect(pref_test.preference_cache_key(:pref_test_pref)).to_not be_nil
expect(pref_test.preference_cache_key(:pref_test_pref)).not_to be_nil
end
it "but returns default values" do
@@ -314,7 +314,7 @@ describe Spree::Preferences::Preferable do
@pt1 = PrefTest.new(col: 'aaaa')
@pt1.id = @pt.id
@pt1.save!
expect(@pt1.get_preference(:pref_test_pref)).to_not eq 'lmn'
expect(@pt1.get_preference(:pref_test_pref)).not_to eq 'lmn'
expect(@pt1.get_preference(:pref_test_pref)).to eq 'abc'
end
end

View File

@@ -21,7 +21,7 @@ module Spree
let(:expensive_variant) { build(:variant, price: 10_000_000) }
it "saves without error" do
expect{ expensive_variant.save }.to_not raise_error
expect{ expensive_variant.save }.not_to raise_error
expect(expensive_variant.persisted?).to be true
end
end

View File

@@ -7,7 +7,7 @@ describe Spree::ProductProperty do
it "should validate length of value" do
pp = create(:product_property)
pp.value = "x" * 256
expect(pp).to_not be_valid
expect(pp).not_to be_valid
end
end
end

View File

@@ -25,7 +25,7 @@ module Spree
context "#destroy" do
it "should set deleted_at value" do
product.destroy
expect(product.deleted_at).to_not be_nil
expect(product.deleted_at).not_to be_nil
expect(product.variants.all? { |v| !v.deleted_at.nil? }).to be_truthy
end
end
@@ -441,14 +441,14 @@ module Spree
distributors = Enterprise.where(id: [distributor1.id, distributor2.id]).to_a
expect(Product.in_distributors(distributors)).to include product1, product2, product3
expect(Product.in_distributors(distributors)).to_not include product4
expect(Product.in_distributors(distributors)).not_to include product4
end
it "returns distributed products for a given array of enterprise ids" do
distributors_ids = [distributor1.id, distributor2.id]
expect(Product.in_distributors(distributors_ids)).to include product1, product2, product3
expect(Product.in_distributors(distributors_ids)).to_not include product4
expect(Product.in_distributors(distributors_ids)).not_to include product4
end
end
@@ -569,7 +569,7 @@ module Spree
it "lists any products with variants that are listed as visible=true" do
expect(products.length).to eq(1)
expect(products).to include product
expect(products).to_not include new_variant.product, hidden_variant.product
expect(products).not_to include new_variant.product, hidden_variant.product
end
end
@@ -591,7 +591,7 @@ module Spree
it 'shows products produced by the enterprise and any producers granting P-OC' do
stockable_products = Spree::Product.stockable_by(shop)
expect(stockable_products).to include p1, p2
expect(stockable_products).to_not include p3
expect(stockable_products).not_to include p3
end
end

View File

@@ -49,7 +49,7 @@ describe Spree::ReturnAuthorization do
end
it "should not update order state" do
expect{ return_authorization.add_variant(variant.id, 1) }.to_not change{ order.state }
expect{ return_authorization.add_variant(variant.id, 1) }.not_to change{ order.state }
end
end
end

View File

@@ -124,7 +124,7 @@ describe Spree::Shipment do
to receive(:new).with(shipment.order).and_return(mock_estimator)
allow(shipment).to receive_messages(shipping_method: nil)
expect(shipment.refresh_rates).to eq shipping_rates
expect(shipment.reload.selected_shipping_rate).to_not be_nil
expect(shipment.reload.selected_shipping_rate).not_to be_nil
end
it 'should not refresh if shipment is shipped' do
@@ -347,10 +347,10 @@ describe Spree::Shipment do
it "should update shipped_at timestamp" do
allow(shipment).to receive(:send_shipped_email)
shipment.ship!
expect(shipment.shipped_at).to_not be_nil
expect(shipment.shipped_at).not_to be_nil
# Ensure value is persisted
shipment.reload
expect(shipment.shipped_at).to_not be_nil
expect(shipment.shipped_at).not_to be_nil
end
it "should send a shipment email if order.send_shipment_email is true" do

View File

@@ -191,7 +191,7 @@ module Spree
it "soft-deletes when destroy is called" do
shipping_method.destroy
expect(shipping_method.deleted_at).to_not be_blank
expect(shipping_method.deleted_at).not_to be_blank
end
end

View File

@@ -75,7 +75,7 @@ module Spree
it "is not valid" do
line_item.quantity = 999
validator.validate(line_item)
expect(line_item).to_not be_valid
expect(line_item).not_to be_valid
end
end
end

View File

@@ -218,7 +218,7 @@ module Spree
it "should apply adjustments for two tax rates to the order" do
expect(rate_1).to receive(:adjust)
expect(rate_2).to_not receive(:adjust)
expect(rate_2).not_to receive(:adjust)
Spree::TaxRate.adjust(order, line_items)
end
end
@@ -234,7 +234,7 @@ module Spree
it "should apply adjustments for two tax rates to the order" do
expect(rate_1).to receive(:adjust)
expect(rate_2).to_not receive(:adjust)
expect(rate_2).not_to receive(:adjust)
Spree::TaxRate.adjust(order, shipments)
end
end

View File

@@ -52,7 +52,7 @@ describe Spree::User do
it "enforces the limit on the number of enterprise owned" do
expect(u2.owned_enterprises.reload).to eq []
u2.owned_enterprises << e1
expect { u2.save! }.to_not raise_error
expect { u2.save! }.not_to raise_error
expect do
u2.owned_enterprises << e2
u2.save!
@@ -92,13 +92,13 @@ describe Spree::User do
it "detects emails without @" do
user.email = "examplemail.com"
expect(user).to_not be_valid
expect(user).not_to be_valid
expect(user.errors.messages[:email]).to include "is invalid"
end
it "detects backslashes at the end" do
user.email = "example@gmail.com\\\\"
expect(user).to_not be_valid
expect(user).not_to be_valid
end
it "is okay with numbers before the @" do
@@ -111,7 +111,7 @@ describe Spree::User do
# valid, the network requests slow down tests and could make them flaky.
expect_any_instance_of(ValidEmail2::Address).to receive(:valid_mx?).and_call_original
user.email = "example@ho020tmail.com"
expect(user).to_not be_valid
expect(user).not_to be_valid
end
end
@@ -164,10 +164,10 @@ describe Spree::User do
describe "as an enterprise user" do
it "returns a list of users which manage shared enterprises" do
expect(u1.known_users).to include u1, u2
expect(u1.known_users).to_not include u3
expect(u1.known_users).not_to include u3
expect(u2.known_users).to include u1, u2
expect(u2.known_users).to_not include u3
expect(u3.known_users).to_not include u1, u2, u3
expect(u2.known_users).not_to include u3
expect(u3.known_users).not_to include u1, u2, u3
end
end

View File

@@ -37,7 +37,7 @@ describe Spree::Variant do
expect(variant.tax_category).to eq default
expect {
variant.tax_category = nil
}.to_not change {
}.not_to change {
variant.tax_category
}
expect(variant).to be_valid
@@ -358,7 +358,7 @@ describe Spree::Variant do
it "lists any variants that are not listed as visible=false" do
expect(variants).to include new_variant, visible_variant
expect(variants).to_not include hidden_variant
expect(variants).not_to include hidden_variant
end
context "when inventory items exist for other enterprises" do
@@ -379,7 +379,7 @@ describe Spree::Variant do
it "lists any variants not listed as visible=false only for the relevant enterprise" do
expect(variants).to include new_variant, visible_variant
expect(variants).to_not include hidden_variant
expect(variants).not_to include hidden_variant
end
end
end
@@ -390,7 +390,7 @@ describe Spree::Variant do
it "lists any variants that are listed as visible=true" do
expect(variants).to include visible_variant
expect(variants).to_not include new_variant, hidden_variant
expect(variants).not_to include new_variant, hidden_variant
end
end
end
@@ -415,7 +415,7 @@ describe Spree::Variant do
it 'shows variants produced by the enterprise and any producers granting P-OC' do
stockable_variants = Spree::Variant.stockable_by(shop)
expect(stockable_variants).to include v1, v2
expect(stockable_variants).to_not include v3
expect(stockable_variants).not_to include v3
end
end
end

View File

@@ -43,7 +43,7 @@ describe StripeAccount do
it "destroys the record" do
# returns status 200
expect(Bugsnag).to_not receive(:notify) # and does not receive Bugsnag notification
expect(Bugsnag).not_to receive(:notify) # and does not receive Bugsnag notification
expect {
stripe_account.deauthorize_and_destroy
}.to change {
@@ -58,7 +58,7 @@ describe StripeAccount do
}
it "Doesn't make a Stripe API disconnection request " do
expect(Stripe::OAuth).to_not receive(:deauthorize)
expect(Stripe::OAuth).not_to receive(:deauthorize)
stripe_account.deauthorize_and_destroy
expect(StripeAccount.all).not_to include(stripe_account)
end

View File

@@ -47,7 +47,7 @@ describe Subscription, type: :model do
expect{ subscription.cancel }.to raise_error "Some error"
expect(subscription.reload.canceled_at).to be nil
expect(proxy_order1).to have_received(:cancel)
expect(proxy_order2).to_not have_received(:cancel)
expect(proxy_order2).not_to have_received(:cancel)
end
end
end

View File

@@ -20,7 +20,7 @@ describe VariantOverride do
}
it "ignores variant_overrides with revoked_permissions by default" do
expect(VariantOverride.all).to_not include vo3
expect(VariantOverride.all).not_to include vo3
expect(VariantOverride.unscoped).to include vo3
end
@@ -141,7 +141,7 @@ describe VariantOverride do
end
it "soft-deletes the price" do
expect(price_object.reload.deleted_at).to_not be_nil
expect(price_object.reload.deleted_at).not_to be_nil
end
it "can access the soft-deleted price" do