mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-26 05:55:15 +00:00
Enforce RSpec expect(..).not_to over to_not
This commit is contained in:
@@ -22,7 +22,7 @@ describe Checkout::PostCheckoutActions do
|
||||
it "sets customer's terms_and_conditions to the current time if terms have been accepted" do
|
||||
params = { order: { terms_and_conditions_accepted: true } }
|
||||
postCheckoutActions.success(params, current_user)
|
||||
expect(order.customer.terms_and_conditions_accepted_at).to_not be_nil
|
||||
expect(order.customer.terms_and_conditions_accepted_at).not_to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ describe CustomerOrderCancellation do
|
||||
|
||||
CustomerOrderCancellation.new(order).call
|
||||
|
||||
expect(Spree::OrderMailer).to_not have_received(:cancel_email_for_shop)
|
||||
expect(Spree::OrderMailer).not_to have_received(:cancel_email_for_shop)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -14,7 +14,7 @@ describe ImageImporter do
|
||||
Spree::Image.count
|
||||
}.by(1)
|
||||
|
||||
expect(product.image).to_not be_nil
|
||||
expect(product.image).not_to be_nil
|
||||
expect(product.reload.image.attachment_blob.byte_size).to eq 6274
|
||||
end
|
||||
end
|
||||
|
||||
@@ -129,7 +129,7 @@ describe OrderAvailablePaymentMethods do
|
||||
|
||||
it "applies default action (hide)" do
|
||||
expect(available_payment_methods).to include untagged_payment_method
|
||||
expect(available_payment_methods).to_not include tagged_payment_method
|
||||
expect(available_payment_methods).not_to include tagged_payment_method
|
||||
end
|
||||
end
|
||||
|
||||
@@ -156,7 +156,7 @@ describe OrderAvailablePaymentMethods do
|
||||
|
||||
it "applies the default action (hide)" do
|
||||
expect(available_payment_methods).to include untagged_payment_method
|
||||
expect(available_payment_methods).to_not include tagged_payment_method
|
||||
expect(available_payment_methods).not_to include tagged_payment_method
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -195,7 +195,7 @@ describe OrderAvailablePaymentMethods do
|
||||
|
||||
it "applies the action (hide)" do
|
||||
expect(available_payment_methods).to include untagged_payment_method
|
||||
expect(available_payment_methods).to_not include tagged_payment_method
|
||||
expect(available_payment_methods).not_to include tagged_payment_method
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ describe OrderAvailableShippingMethods do
|
||||
|
||||
it "applies default action (hide)" do
|
||||
expect(available_shipping_methods).to include untagged_sm
|
||||
expect(available_shipping_methods).to_not include tagged_sm
|
||||
expect(available_shipping_methods).not_to include tagged_sm
|
||||
end
|
||||
end
|
||||
|
||||
@@ -138,7 +138,7 @@ describe OrderAvailableShippingMethods do
|
||||
|
||||
it "applies the default action (hide)" do
|
||||
expect(available_shipping_methods).to include untagged_sm
|
||||
expect(available_shipping_methods).to_not include tagged_sm
|
||||
expect(available_shipping_methods).not_to include tagged_sm
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -174,7 +174,7 @@ describe OrderAvailableShippingMethods do
|
||||
|
||||
it "applies the action (hide)" do
|
||||
expect(available_shipping_methods).to include untagged_sm
|
||||
expect(available_shipping_methods).to_not include tagged_sm
|
||||
expect(available_shipping_methods).not_to include tagged_sm
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ describe OrderCheckoutRestart do
|
||||
describe "#call" do
|
||||
context "when the order is already in the 'cart' state" do
|
||||
it "does nothing" do
|
||||
expect(order).to_not receive(:restart_checkout!)
|
||||
expect(order).not_to receive(:restart_checkout!)
|
||||
OrderCheckoutRestart.new(order).call
|
||||
end
|
||||
end
|
||||
|
||||
@@ -30,7 +30,7 @@ describe OrderCycleDistributedProducts do
|
||||
|
||||
it "does not return product" do
|
||||
expect(described_class.new(distributor, order_cycle,
|
||||
customer).products_relation).to_not include product
|
||||
customer).products_relation).not_to include product
|
||||
end
|
||||
end
|
||||
|
||||
@@ -42,7 +42,7 @@ describe OrderCycleDistributedProducts do
|
||||
|
||||
it "does not return product" do
|
||||
expect(described_class.new(distributor, order_cycle,
|
||||
customer).products_relation).to_not include product
|
||||
customer).products_relation).not_to include product
|
||||
end
|
||||
end
|
||||
|
||||
@@ -56,7 +56,7 @@ describe OrderCycleDistributedProducts do
|
||||
it "does not return product when variant is out of stock" do
|
||||
variant.update_attribute(:on_hand, 0)
|
||||
expect(described_class.new(distributor, order_cycle,
|
||||
customer).products_relation).to_not include product
|
||||
customer).products_relation).not_to include product
|
||||
end
|
||||
end
|
||||
|
||||
@@ -67,7 +67,7 @@ describe OrderCycleDistributedProducts do
|
||||
|
||||
it "does not return product when an override is out of stock" do
|
||||
expect(described_class.new(distributor, order_cycle,
|
||||
customer).products_relation).to_not include product
|
||||
customer).products_relation).not_to include product
|
||||
end
|
||||
|
||||
it "returns product when an override is in stock" do
|
||||
@@ -93,11 +93,11 @@ describe OrderCycleDistributedProducts do
|
||||
|
||||
it "returns variants in the oc" do
|
||||
expect(variants).to include v1
|
||||
expect(variants).to_not include v2
|
||||
expect(variants).not_to include v2
|
||||
end
|
||||
|
||||
it "does not return variants where override is out of stock" do
|
||||
expect(variants).to_not include v3
|
||||
expect(variants).not_to include v3
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -25,7 +25,7 @@ describe OrderCycleForm do
|
||||
it "returns false" do
|
||||
expect do
|
||||
expect(form.save).to be false
|
||||
end.to_not change { OrderCycle.count }
|
||||
end.not_to change { OrderCycle.count }
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -51,7 +51,7 @@ describe OrderCycleForm do
|
||||
it "returns false" do
|
||||
expect do
|
||||
expect(form.save).to be false
|
||||
end.to_not change{ order_cycle.reload.name }
|
||||
end.not_to change{ order_cycle.reload.name }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -101,7 +101,7 @@ describe OrderCycleForm do
|
||||
it "associates the order cycle to the schedule" do
|
||||
expect(form.save).to be true
|
||||
expect(coordinated_order_cycle.reload.schedules).to include coordinated_schedule2
|
||||
expect(coordinated_order_cycle.reload.schedules).to_not include coordinated_schedule
|
||||
expect(coordinated_order_cycle.reload.schedules).not_to include coordinated_schedule
|
||||
expect(syncer_mock).to have_received(:sync!)
|
||||
end
|
||||
end
|
||||
@@ -112,8 +112,8 @@ describe OrderCycleForm do
|
||||
it "ignores the schedule that I don't own" do
|
||||
expect(form.save).to be true
|
||||
expect(coordinated_order_cycle.reload.schedules).to include coordinated_schedule
|
||||
expect(coordinated_order_cycle.reload.schedules).to_not include uncoordinated_schedule
|
||||
expect(syncer_mock).to_not have_received(:sync!)
|
||||
expect(coordinated_order_cycle.reload.schedules).not_to include uncoordinated_schedule
|
||||
expect(syncer_mock).not_to have_received(:sync!)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -123,7 +123,7 @@ describe OrderCycleForm do
|
||||
it "ignores the schedule that I don't own" do
|
||||
expect(form.save).to be true
|
||||
expect(coordinated_order_cycle.reload.schedules).to include coordinated_schedule
|
||||
expect(syncer_mock).to_not have_received(:sync!)
|
||||
expect(syncer_mock).not_to have_received(:sync!)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -256,7 +256,7 @@ describe OrderCycleForm do
|
||||
supplier.users.first
|
||||
)
|
||||
|
||||
expect{ form.save }.to_not change{ order_cycle.distributor_payment_methods.pluck(:id) }
|
||||
expect{ form.save }.not_to change{ order_cycle.distributor_payment_methods.pluck(:id) }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -306,7 +306,7 @@ describe OrderCycleForm do
|
||||
distributor2.users.first
|
||||
)
|
||||
|
||||
expect{ form.save }.to_not change{
|
||||
expect{ form.save }.not_to change{
|
||||
order_cycle.distributor_payment_methods.pluck(:id)
|
||||
}
|
||||
end
|
||||
|
||||
@@ -22,7 +22,7 @@ describe OrderCycleWebhookService do
|
||||
coordinator_user.webhook_endpoints.create!(url: "http://coordinator_user_url")
|
||||
|
||||
expect{ OrderCycleWebhookService.create_webhook_job(order_cycle, "order_cycle.opened") }
|
||||
.to_not enqueue_job(WebhookDeliveryJob).with("http://coordinator_user_url", any_args)
|
||||
.not_to enqueue_job(WebhookDeliveryJob).with("http://coordinator_user_url", any_args)
|
||||
end
|
||||
|
||||
context "coordinator owner has endpoint configured" do
|
||||
@@ -128,7 +128,7 @@ describe OrderCycleWebhookService do
|
||||
|
||||
it "doesn't create a webhook payload for supplier owner" do
|
||||
expect{ OrderCycleWebhookService.create_webhook_job(order_cycle, "order_cycle.opened") }
|
||||
.to_not enqueue_job(WebhookDeliveryJob).with("http://supplier_owner_url", any_args)
|
||||
.not_to enqueue_job(WebhookDeliveryJob).with("http://supplier_owner_url", any_args)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -33,7 +33,7 @@ describe OrderFeesHandler do
|
||||
|
||||
it "skips per-order fee adjustments for orders that don't have an order cycle" do
|
||||
allow(service).to receive(:order_cycle) { nil }
|
||||
expect(calculator).to_not receive(:create_order_adjustments_for)
|
||||
expect(calculator).not_to receive(:create_order_adjustments_for)
|
||||
|
||||
service.create_order_fees!
|
||||
end
|
||||
|
||||
@@ -171,7 +171,7 @@ describe OrderSyncer do
|
||||
it "updates all bill_address attrs and ship_address names + phone" do
|
||||
subscription.assign_attributes(params)
|
||||
expect(syncer.sync!).to be true
|
||||
expect(syncer.order_update_issues.keys).to_not include order.id
|
||||
expect(syncer.order_update_issues.keys).not_to include order.id
|
||||
order.reload;
|
||||
expect(order.bill_address.firstname).to eq "Bill"
|
||||
expect(order.bill_address.lastname).to eq bill_address_attrs["lastname"]
|
||||
@@ -216,7 +216,7 @@ describe OrderSyncer do
|
||||
it "only updates bill_address attrs" do
|
||||
subscription.assign_attributes(params)
|
||||
expect(syncer.sync!).to be true
|
||||
expect(syncer.order_update_issues.keys).to_not include order.id
|
||||
expect(syncer.order_update_issues.keys).not_to include order.id
|
||||
order.reload;
|
||||
expect(order.bill_address.firstname).to eq "Bill"
|
||||
expect(order.bill_address.lastname).to eq bill_address_attrs["lastname"]
|
||||
@@ -278,7 +278,7 @@ describe OrderSyncer do
|
||||
it "does not change the ship address" do
|
||||
subscription.assign_attributes(params)
|
||||
expect(syncer.sync!).to be true
|
||||
expect(syncer.order_update_issues.keys).to_not include order.id
|
||||
expect(syncer.order_update_issues.keys).not_to include order.id
|
||||
order.reload;
|
||||
expect(order.ship_address.firstname).to eq bill_address_attrs["firstname"]
|
||||
expect(order.ship_address.lastname).to eq bill_address_attrs["lastname"]
|
||||
@@ -355,7 +355,7 @@ describe OrderSyncer do
|
||||
it "updates ship_address attrs" do
|
||||
subscription.assign_attributes(params)
|
||||
expect(syncer.sync!).to be true
|
||||
expect(syncer.order_update_issues.keys).to_not include order.id
|
||||
expect(syncer.order_update_issues.keys).not_to include order.id
|
||||
order.reload;
|
||||
expect(order.ship_address.firstname).to eq "Ship"
|
||||
expect(order.ship_address.lastname).to eq ship_address_attrs["lastname"]
|
||||
|
||||
@@ -70,9 +70,9 @@ module Permissions
|
||||
|
||||
it "only returns completed, non-cancelled orders within search filter range" do
|
||||
expect(permissions.visible_orders).to include order_completed
|
||||
expect(permissions.visible_orders).to_not include order_cancelled
|
||||
expect(permissions.visible_orders).to_not include order_cart
|
||||
expect(permissions.visible_orders).to_not include order_from_last_year
|
||||
expect(permissions.visible_orders).not_to include order_cancelled
|
||||
expect(permissions.visible_orders).not_to include order_cart
|
||||
expect(permissions.visible_orders).not_to include order_from_last_year
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -99,7 +99,7 @@ module Permissions
|
||||
|
||||
context "which does not contain my products" do
|
||||
it "should not let me see the order" do
|
||||
expect(permissions.visible_orders).to_not include order
|
||||
expect(permissions.visible_orders).not_to include order
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -113,7 +113,7 @@ module Permissions
|
||||
end
|
||||
|
||||
it "should not let me see the order" do
|
||||
expect(permissions.visible_orders).to_not include order
|
||||
expect(permissions.visible_orders).not_to include order
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -172,7 +172,7 @@ module Permissions
|
||||
it "should let me see the line_items pertaining to variants I produce" do
|
||||
ps = permissions.visible_line_items
|
||||
expect(ps).to include line_item1
|
||||
expect(ps).to_not include line_item2
|
||||
expect(ps).not_to include line_item2
|
||||
end
|
||||
end
|
||||
|
||||
@@ -185,7 +185,7 @@ module Permissions
|
||||
end
|
||||
|
||||
it "should not let me see the line_items" do
|
||||
expect(permissions.visible_line_items).to_not include line_item1, line_item2
|
||||
expect(permissions.visible_line_items).not_to include line_item1, line_item2
|
||||
end
|
||||
end
|
||||
|
||||
@@ -205,10 +205,10 @@ module Permissions
|
||||
it "only returns line items from completed, " \
|
||||
"non-cancelled orders within search filter range" do
|
||||
expect(permissions.visible_line_items).to include order_completed.line_items.first
|
||||
expect(permissions.visible_line_items).to_not include order_cancelled.line_items.first
|
||||
expect(permissions.visible_line_items).to_not include order_cart.line_items.first
|
||||
expect(permissions.visible_line_items).not_to include order_cancelled.line_items.first
|
||||
expect(permissions.visible_line_items).not_to include order_cart.line_items.first
|
||||
expect(permissions.visible_line_items)
|
||||
.to_not include order_from_last_year.line_items.first
|
||||
.not_to include order_from_last_year.line_items.first
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -57,7 +57,7 @@ describe PlaceProxyOrder do
|
||||
|
||||
it "records an issue and ignores it" do
|
||||
expect(summarizer).to receive(:record_issue).with(:complete, order).once
|
||||
expect { subject.call }.to_not change { order.reload.state }
|
||||
expect { subject.call }.not_to change { order.reload.state }
|
||||
expect(order.payments.first.state).to eq "checkout"
|
||||
expect(ActionMailer::Base.deliveries.count).to be 0
|
||||
end
|
||||
|
||||
@@ -195,13 +195,13 @@ describe ProductsRenderer do
|
||||
|
||||
it "scopes variants to distribution" do
|
||||
expect(variants[p.id]).to include v1
|
||||
expect(variants[p.id]).to_not include v2
|
||||
expect(variants[p.id]).not_to include v2
|
||||
end
|
||||
|
||||
it "does not render variants that have been hidden by the hub" do
|
||||
# but does render 'new' variants, ie. v1
|
||||
expect(variants[p.id]).to include v1, v3
|
||||
expect(variants[p.id]).to_not include v4
|
||||
expect(variants[p.id]).not_to include v4
|
||||
end
|
||||
|
||||
context "when hub opts to only see variants in its inventory" do
|
||||
@@ -212,7 +212,7 @@ describe ProductsRenderer do
|
||||
it "doesn't render variants that haven't been explicitly added to inventory for the hub" do
|
||||
# but does render 'new' variants, ie. v1
|
||||
expect(variants[p.id]).to include v3
|
||||
expect(variants[p.id]).to_not include v1, v4
|
||||
expect(variants[p.id]).not_to include v1, v4
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -79,7 +79,7 @@ describe Sets::ModelSet do
|
||||
expect(subject.errors.full_messages).to eq ["Product Name can't be blank"]
|
||||
|
||||
expect(subject.invalid).to include product_a
|
||||
expect(subject.invalid).to_not include product_b
|
||||
expect(subject.invalid).not_to include product_b
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -130,7 +130,7 @@ describe Sets::ProductSet do
|
||||
}.to change { product.supplier }.to(producer).
|
||||
and change { order_cycle.distributed_variants.count }.by(-1)
|
||||
|
||||
expect(order_cycle.distributed_variants).to_not include product.variants.first
|
||||
expect(order_cycle.distributed_variants).not_to include product.variants.first
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -163,7 +163,7 @@ describe Sets::ProductSet do
|
||||
expect {
|
||||
product_set.save
|
||||
product.reload
|
||||
}.to_not change { product.sku }
|
||||
}.not_to change { product.sku }
|
||||
|
||||
expect(product_set.saved_count).to be_zero
|
||||
expect(product_set.invalid.count).to be_positive
|
||||
@@ -173,7 +173,7 @@ describe Sets::ProductSet do
|
||||
expect {
|
||||
product_set.save
|
||||
variant.reload
|
||||
}.to_not change { variant.sku }
|
||||
}.not_to change { variant.sku }
|
||||
end
|
||||
|
||||
it 'assigns the in-memory attributes of the variant' do
|
||||
@@ -239,7 +239,7 @@ describe Sets::ProductSet do
|
||||
let(:variant_attributes) { { sku: "var_sku", display_name: "A" * 256 } } # maximum length
|
||||
|
||||
include_examples "nothing saved" do
|
||||
after { expect(variant2.reload.sku).to_not eq "var_sku2" }
|
||||
after { expect(variant2.reload.sku).not_to eq "var_sku2" }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -12,7 +12,7 @@ describe TaxRateUpdater do
|
||||
|
||||
describe "#updated_rate" do
|
||||
it "returns a cloned (unsaved) tax rate with the new attributes assigned" do
|
||||
expect(new_tax_rate).to_not be old_tax_rate
|
||||
expect(new_tax_rate).not_to be old_tax_rate
|
||||
expect(new_tax_rate.amount).to eq params[:amount]
|
||||
expect(new_tax_rate.id).to be_nil
|
||||
expect(new_tax_rate.calculator.class).to eq old_tax_rate.calculator.class
|
||||
@@ -34,9 +34,9 @@ describe TaxRateUpdater do
|
||||
context "when saving the new tax_rate fails" do
|
||||
it "does not delete the old tax_rate and returns a falsey value" do
|
||||
expect(new_tax_rate).to receive(:save) { false }
|
||||
expect(old_tax_rate).to_not receive(:destroy)
|
||||
expect(old_tax_rate).not_to receive(:destroy)
|
||||
|
||||
expect(service.transition_rate!).to_not be_truthy
|
||||
expect(service.transition_rate!).not_to be_truthy
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -37,7 +37,7 @@ describe TermsOfService do
|
||||
it "should always return true" do
|
||||
expect {
|
||||
allow(TermsOfServiceFile).to receive(:exists?) { false }
|
||||
}.to_not change {
|
||||
}.not_to change {
|
||||
TermsOfService.tos_accepted?(customer)
|
||||
}.from(true)
|
||||
end
|
||||
|
||||
@@ -264,7 +264,7 @@ describe VoucherAdjustmentsService do
|
||||
|
||||
context 'when no order given' do
|
||||
it "doesn't blow up" do
|
||||
expect { VoucherAdjustmentsService.new(nil).update }.to_not raise_error
|
||||
expect { VoucherAdjustmentsService.new(nil).update }.not_to raise_error
|
||||
end
|
||||
end
|
||||
|
||||
@@ -272,7 +272,7 @@ describe VoucherAdjustmentsService do
|
||||
let(:order) { create(:order_with_line_items, line_items_count: 1, distributor: enterprise) }
|
||||
|
||||
it "doesn't blow up" do
|
||||
expect { VoucherAdjustmentsService.new(order).update }.to_not raise_error
|
||||
expect { VoucherAdjustmentsService.new(order).update }.not_to raise_error
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user