mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-12 03:50:22 +00:00
Enforce RSpec expect(..).not_to over to_not
This commit is contained in:
@@ -182,7 +182,7 @@ module Admin
|
||||
customer: { email: 'new.email@gmail.com' }
|
||||
expect(response).to redirect_to unauthorized_path
|
||||
expect(assigns(:customer)).to eq nil
|
||||
expect(customer.email).to_not eq 'new.email@gmail.com'
|
||||
expect(customer.email).not_to eq 'new.email@gmail.com'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -168,7 +168,7 @@ describe Admin::EnterprisesController, type: :controller do
|
||||
spree_post :update, update_params
|
||||
|
||||
distributor.reload
|
||||
expect(distributor.users).to_not include user
|
||||
expect(distributor.users).not_to include user
|
||||
end
|
||||
|
||||
it "updates the contact for notifications" do
|
||||
@@ -190,7 +190,7 @@ describe Admin::EnterprisesController, type: :controller do
|
||||
}
|
||||
|
||||
expect { spree_post :update, params }.
|
||||
to_not change { distributor.contact }
|
||||
not_to change { distributor.contact }
|
||||
end
|
||||
|
||||
it "updates enterprise preferences" do
|
||||
@@ -223,7 +223,7 @@ describe Admin::EnterprisesController, type: :controller do
|
||||
expect(Spree::Property.count).to be 1
|
||||
expect(ProducerProperty.count).to be 0
|
||||
property_names = producer.reload.properties.map(&:name)
|
||||
expect(property_names).to_not include 'a different name'
|
||||
expect(property_names).not_to include 'a different name'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -721,7 +721,7 @@ describe Admin::EnterprisesController, type: :controller do
|
||||
it "scopes @collection to enterprises editable by the user" do
|
||||
get :index, format: :json
|
||||
expect(assigns(:collection)).to include enterprise1, enterprise2
|
||||
expect(assigns(:collection)).to_not include enterprise3
|
||||
expect(assigns(:collection)).not_to include enterprise3
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -37,7 +37,7 @@ module Admin
|
||||
context "where ransack conditions are specified" do
|
||||
it "loads order cycles closed within past month, and orders w/o a close_at date" do
|
||||
get :index, as: :json
|
||||
expect(assigns(:collection)).to_not include oc1, oc2
|
||||
expect(assigns(:collection)).not_to include oc1, oc2
|
||||
expect(assigns(:collection)).to include oc3, oc4
|
||||
end
|
||||
end
|
||||
@@ -47,7 +47,7 @@ module Admin
|
||||
|
||||
it "loads order cycles closed after specified date, and orders w/o a close_at date" do
|
||||
get :index, as: :json, params: { q: }
|
||||
expect(assigns(:collection)).to_not include oc1
|
||||
expect(assigns(:collection)).not_to include oc1
|
||||
expect(assigns(:collection)).to include oc2, oc3, oc4
|
||||
end
|
||||
|
||||
@@ -56,7 +56,7 @@ module Admin
|
||||
|
||||
it "loads order cycles that meet all conditions" do
|
||||
get :index, format: :json, params: { q: }
|
||||
expect(assigns(:collection)).to_not include oc1, oc2, oc4
|
||||
expect(assigns(:collection)).not_to include oc1, oc2, oc4
|
||||
expect(assigns(:collection)).to include oc3
|
||||
end
|
||||
end
|
||||
@@ -415,9 +415,9 @@ module Admin
|
||||
} } }
|
||||
|
||||
oc.reload
|
||||
expect(oc.name).to_not eq "Updated Order Cycle"
|
||||
expect(oc.orders_open_at.to_date).to_not eq Date.current - 21.days
|
||||
expect(oc.orders_close_at.to_date).to_not eq Date.current + 21.days
|
||||
expect(oc.name).not_to eq "Updated Order Cycle"
|
||||
expect(oc.orders_open_at.to_date).not_to eq Date.current - 21.days
|
||||
expect(oc.orders_close_at.to_date).not_to eq Date.current + 21.days
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -505,8 +505,8 @@ module Admin
|
||||
get :destroy, params: { id: cloned.id }
|
||||
|
||||
expect(OrderCycle.find_by(id: cloned.id)).to be nil
|
||||
expect(OrderCycle.find_by(id: oc.id)).to_not be nil
|
||||
expect(EnterpriseFee.find_by(id: enterprise_fee1.id)).to_not be nil
|
||||
expect(OrderCycle.find_by(id: oc.id)).not_to be nil
|
||||
expect(EnterpriseFee.find_by(id: enterprise_fee1.id)).not_to be nil
|
||||
expect(response).to redirect_to admin_order_cycles_path
|
||||
end
|
||||
end
|
||||
|
||||
@@ -162,7 +162,7 @@ describe Admin::ReportsController, type: :controller do
|
||||
report_types = assigns(:reports).keys
|
||||
expect(report_types).to include :orders_and_fulfillment,
|
||||
:products_and_inventory, :packing # and others
|
||||
expect(report_types).to_not include :sales_tax
|
||||
expect(report_types).not_to include :sales_tax
|
||||
end
|
||||
end
|
||||
|
||||
@@ -365,7 +365,7 @@ describe Admin::ReportsController, type: :controller do
|
||||
spree_get :show, report_type: :sales_tax, report_subtype: report_type
|
||||
expect(response).to have_http_status(:ok)
|
||||
expect(resulting_orders_prelim).to include(orderA1, orderB1)
|
||||
expect(resulting_orders_prelim).to_not include(orderA2, orderB2)
|
||||
expect(resulting_orders_prelim).not_to include(orderA2, orderB2)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -115,7 +115,7 @@ describe Admin::SchedulesController, type: :controller do
|
||||
uncoordinated_order_cycle,
|
||||
uncoordinated_order_cycle3
|
||||
# coordinated_order_cycle is removed, uncoordinated_order_cycle2 is NOT added
|
||||
expect(coordinated_schedule.reload.order_cycles).to_not include coordinated_order_cycle,
|
||||
expect(coordinated_schedule.reload.order_cycles).not_to include coordinated_order_cycle,
|
||||
uncoordinated_order_cycle2
|
||||
end
|
||||
|
||||
@@ -145,7 +145,7 @@ describe Admin::SchedulesController, type: :controller do
|
||||
schedule: { name: "my awesome schedule" }
|
||||
expect(response).to redirect_to unauthorized_path
|
||||
expect(assigns(:schedule)).to eq nil
|
||||
expect(coordinated_schedule.name).to_not eq "my awesome schedule"
|
||||
expect(coordinated_schedule.name).not_to eq "my awesome schedule"
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -173,7 +173,7 @@ describe Admin::SchedulesController, type: :controller do
|
||||
|
||||
context "where no order cycles ids are provided" do
|
||||
it "does not allow me to create the schedule" do
|
||||
expect { create_schedule params }.to_not change { Schedule.count }
|
||||
expect { create_schedule params }.not_to change { Schedule.count }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -187,7 +187,7 @@ describe Admin::SchedulesController, type: :controller do
|
||||
expect { create_schedule params }.to change { Schedule.count }.by(1)
|
||||
schedule = Schedule.last
|
||||
expect(schedule.order_cycles).to include coordinated_order_cycle
|
||||
expect(schedule.order_cycles).to_not include uncoordinated_order_cycle
|
||||
expect(schedule.order_cycles).not_to include uncoordinated_order_cycle
|
||||
end
|
||||
|
||||
it "sync proxy orders" do
|
||||
@@ -205,7 +205,7 @@ describe Admin::SchedulesController, type: :controller do
|
||||
end
|
||||
|
||||
it "prevents me from creating the schedule" do
|
||||
expect { create_schedule params }.to_not change { Schedule.count }
|
||||
expect { create_schedule params }.not_to change { Schedule.count }
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -257,7 +257,7 @@ describe Admin::SchedulesController, type: :controller do
|
||||
let!(:subscription) { create(:subscription, schedule: coordinated_schedule) }
|
||||
|
||||
it "returns an error message and prevents me from deleting the schedule" do
|
||||
expect { spree_delete :destroy, params }.to_not change { Schedule.count }
|
||||
expect { spree_delete :destroy, params }.not_to change { Schedule.count }
|
||||
json_response = JSON.parse(response.body)
|
||||
expect(json_response["errors"])
|
||||
.to include 'This schedule cannot be deleted ' \
|
||||
@@ -270,7 +270,7 @@ describe Admin::SchedulesController, type: :controller do
|
||||
before { params.merge!(id: uncoordinated_schedule.id) }
|
||||
|
||||
it "prevents me from destroying the schedule" do
|
||||
expect { spree_delete :destroy, params }.to_not change { Schedule.count }
|
||||
expect { spree_delete :destroy, params }.not_to change { Schedule.count }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -81,7 +81,7 @@ describe Admin::SubscriptionsController, type: :controller do
|
||||
expect(json_response.count).to be 1
|
||||
ids = json_response.map{ |so| so['id'] }
|
||||
expect(ids).to include subscription2.id
|
||||
expect(ids).to_not include subscription.id
|
||||
expect(ids).not_to include subscription.id
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -134,7 +134,7 @@ describe Admin::SubscriptionsController, type: :controller do
|
||||
|
||||
context 'when I submit insufficient params' do
|
||||
it 'returns errors' do
|
||||
expect{ spree_post :create, params }.to_not change{ Subscription.count }
|
||||
expect{ spree_post :create, params }.not_to change{ Subscription.count }
|
||||
json_response = JSON.parse(response.body)
|
||||
expect(json_response['errors'].keys).to include 'schedule', 'customer', 'payment_method',
|
||||
'shipping_method', 'begins_at'
|
||||
@@ -168,7 +168,7 @@ describe Admin::SubscriptionsController, type: :controller do
|
||||
end
|
||||
|
||||
it 'returns errors' do
|
||||
expect{ spree_post :create, params }.to_not change{ Subscription.count }
|
||||
expect{ spree_post :create, params }.not_to change{ Subscription.count }
|
||||
json_response = JSON.parse(response.body)
|
||||
expect(json_response['errors'].keys).to include 'schedule', 'customer', 'payment_method',
|
||||
'shipping_method', 'ends_at'
|
||||
@@ -197,7 +197,7 @@ describe Admin::SubscriptionsController, type: :controller do
|
||||
|
||||
context 'where the specified variants are not available from the shop' do
|
||||
it 'returns an error' do
|
||||
expect{ spree_post :create, params }.to_not change{ Subscription.count }
|
||||
expect{ spree_post :create, params }.not_to change{ Subscription.count }
|
||||
json_response = JSON.parse(response.body)
|
||||
expect(json_response['errors']['subscription_line_items'])
|
||||
.to eq ["#{variant.product.name} - #{variant.full_name} " \
|
||||
@@ -343,7 +343,7 @@ describe Admin::SubscriptionsController, type: :controller do
|
||||
end
|
||||
|
||||
it 'returns errors' do
|
||||
expect{ spree_post :update, params }.to_not change{ Subscription.count }
|
||||
expect{ spree_post :update, params }.not_to change{ Subscription.count }
|
||||
json_response = JSON.parse(response.body)
|
||||
expect(json_response['errors'].keys).to include 'payment_method', 'shipping_method'
|
||||
subscription.reload
|
||||
@@ -387,7 +387,7 @@ describe Admin::SubscriptionsController, type: :controller do
|
||||
context 'where the specified variants are not available from the shop' do
|
||||
it 'returns an error' do
|
||||
expect{ spree_post :update, params }
|
||||
.to_not change{ subscription.subscription_line_items.count }
|
||||
.not_to change{ subscription.subscription_line_items.count }
|
||||
json_response = JSON.parse(response.body)
|
||||
expect(json_response['errors']['subscription_line_items'])
|
||||
.to eq ["#{product2.name} - #{variant2.full_name} " \
|
||||
@@ -478,7 +478,7 @@ describe Admin::SubscriptionsController, type: :controller do
|
||||
it 'renders the cancelled subscription as json, and does not cancel the open order' do
|
||||
spree_put :cancel, params
|
||||
json_response = JSON.parse(response.body)
|
||||
expect(json_response['canceled_at']).to_not be nil
|
||||
expect(json_response['canceled_at']).not_to be nil
|
||||
expect(json_response['id']).to eq subscription.id
|
||||
expect(subscription.reload.canceled_at).to be_within(5.seconds).of Time.zone.now
|
||||
expect(order.reload.state).to eq 'complete'
|
||||
@@ -498,7 +498,7 @@ describe Admin::SubscriptionsController, type: :controller do
|
||||
it 'renders the cancelled subscription as json, and cancels the open order' do
|
||||
spree_put :cancel, params
|
||||
json_response = JSON.parse(response.body)
|
||||
expect(json_response['canceled_at']).to_not be nil
|
||||
expect(json_response['canceled_at']).not_to be nil
|
||||
expect(json_response['id']).to eq subscription.id
|
||||
expect(subscription.reload.canceled_at).to be_within(5.seconds).of Time.zone.now
|
||||
expect(order.reload.state).to eq 'canceled'
|
||||
@@ -512,7 +512,7 @@ describe Admin::SubscriptionsController, type: :controller do
|
||||
it 'renders the cancelled subscription as json' do
|
||||
spree_put :cancel, params
|
||||
json_response = JSON.parse(response.body)
|
||||
expect(json_response['canceled_at']).to_not be nil
|
||||
expect(json_response['canceled_at']).not_to be nil
|
||||
expect(json_response['id']).to eq subscription.id
|
||||
expect(subscription.reload.canceled_at).to be_within(5.seconds).of Time.zone.now
|
||||
end
|
||||
@@ -582,7 +582,7 @@ describe Admin::SubscriptionsController, type: :controller do
|
||||
it 'renders the paused subscription as json, and does not cancel the open order' do
|
||||
spree_put :pause, params
|
||||
json_response = JSON.parse(response.body)
|
||||
expect(json_response['paused_at']).to_not be nil
|
||||
expect(json_response['paused_at']).not_to be nil
|
||||
expect(json_response['id']).to eq subscription.id
|
||||
expect(subscription.reload.paused_at).to be_within(5.seconds).of Time.zone.now
|
||||
expect(order.reload.state).to eq 'complete'
|
||||
@@ -602,7 +602,7 @@ describe Admin::SubscriptionsController, type: :controller do
|
||||
it 'renders the paused subscription as json, and cancels the open order' do
|
||||
spree_put :pause, params
|
||||
json_response = JSON.parse(response.body)
|
||||
expect(json_response['paused_at']).to_not be nil
|
||||
expect(json_response['paused_at']).not_to be nil
|
||||
expect(json_response['id']).to eq subscription.id
|
||||
expect(subscription.reload.paused_at).to be_within(5.seconds).of Time.zone.now
|
||||
expect(order.reload.state).to eq 'canceled'
|
||||
@@ -616,7 +616,7 @@ describe Admin::SubscriptionsController, type: :controller do
|
||||
it 'renders the paused subscription as json' do
|
||||
spree_put :pause, params
|
||||
json_response = JSON.parse(response.body)
|
||||
expect(json_response['paused_at']).to_not be nil
|
||||
expect(json_response['paused_at']).not_to be nil
|
||||
expect(json_response['id']).to eq subscription.id
|
||||
expect(subscription.reload.paused_at).to be_within(5.seconds).of Time.zone.now
|
||||
end
|
||||
@@ -708,7 +708,7 @@ describe Admin::SubscriptionsController, type: :controller do
|
||||
expect(json_response['id']).to eq subscription.id
|
||||
expect(subscription.reload.paused_at).to be nil
|
||||
expect(order.reload.state).to eq 'canceled'
|
||||
expect(proxy_order.reload.canceled_at).to_not be nil
|
||||
expect(proxy_order.reload.canceled_at).not_to be nil
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -771,7 +771,7 @@ describe Admin::SubscriptionsController, type: :controller do
|
||||
it "only loads Stripe and Cash payment methods" do
|
||||
controller.send(:load_form_data)
|
||||
expect(assigns(:payment_methods)).to include payment_method, stripe
|
||||
expect(assigns(:payment_methods)).to_not include paypal
|
||||
expect(assigns(:payment_methods)).not_to include paypal
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -12,12 +12,12 @@ describe Admin::TermsOfServiceFilesController, type: :controller do
|
||||
|
||||
it "does not allow deletion" do
|
||||
post :destroy
|
||||
expect(TermsOfServiceFile).to_not receive(:current)
|
||||
expect(TermsOfServiceFile).not_to receive(:current)
|
||||
end
|
||||
|
||||
it "does not allow creation" do
|
||||
post :create
|
||||
expect(TermsOfServiceFile).to_not receive(:create!)
|
||||
expect(TermsOfServiceFile).not_to receive(:create!)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ describe Admin::VariantOverridesController, type: :controller do
|
||||
it "allows to update other variant overrides" do
|
||||
put :bulk_update, as: format, params: { variant_overrides: variant_override_params }
|
||||
|
||||
expect(response).to_not redirect_to unauthorized_path
|
||||
expect(response).not_to redirect_to unauthorized_path
|
||||
variant_override.reload
|
||||
expect(variant_override.price).to eq 123.45
|
||||
end
|
||||
@@ -193,7 +193,7 @@ describe Admin::VariantOverridesController, type: :controller do
|
||||
it "does not reset count_on_hand for variant_overrides not in params" do
|
||||
expect {
|
||||
put :bulk_reset, params:
|
||||
}.to_not change{ variant_override3.reload.count_on_hand }
|
||||
}.not_to change{ variant_override3.reload.count_on_hand }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -35,7 +35,7 @@ module Api
|
||||
expect(response.status).to eq 200
|
||||
expect(json_response["id"]).to eq enterprise.id
|
||||
enterprise.reload
|
||||
expect(enterprise.logo).to_not be_attached
|
||||
expect(enterprise.logo).not_to be_attached
|
||||
end
|
||||
|
||||
context "when logo does not exist" do
|
||||
|
||||
@@ -57,7 +57,7 @@ module Api
|
||||
q: { ransack_param => "Kangaroo" }
|
||||
|
||||
expect(product_ids).to include product1.id
|
||||
expect(product_ids).to_not include product2.id
|
||||
expect(product_ids).not_to include product2.id
|
||||
end
|
||||
|
||||
context "with variant overrides" do
|
||||
@@ -84,7 +84,7 @@ module Api
|
||||
it "does not return products where the variant overrides are out of stock" do
|
||||
api_get :products, id: order_cycle.id, distributor: distributor.id
|
||||
|
||||
expect(product_ids).to_not include product2.id
|
||||
expect(product_ids).not_to include product2.id
|
||||
end
|
||||
end
|
||||
|
||||
@@ -99,7 +99,7 @@ module Api
|
||||
|
||||
expect(response.status).to eq 200
|
||||
expect(product_ids).to eq [product1.id, product2.id]
|
||||
expect(product_ids).to_not include product3.id
|
||||
expect(product_ids).not_to include product3.id
|
||||
end
|
||||
|
||||
context "with supplier properties" do
|
||||
@@ -118,7 +118,7 @@ module Api
|
||||
|
||||
expect(response.status).to eq 200
|
||||
expect(product_ids).to match_array [product1.id, product2.id]
|
||||
expect(product_ids).to_not include product3.id
|
||||
expect(product_ids).not_to include product3.id
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -129,7 +129,7 @@ module Api
|
||||
q: { primary_taxon_id_in_any: [taxon2.id] }
|
||||
|
||||
expect(product_ids).to include product2.id, product3.id
|
||||
expect(product_ids).to_not include product1.id, product4.id
|
||||
expect(product_ids).not_to include product1.id, product4.id
|
||||
end
|
||||
end
|
||||
|
||||
@@ -176,7 +176,7 @@ module Api
|
||||
|
||||
api_get :products, id: order_cycle.id, distributor: distributor.id
|
||||
|
||||
expect(product_ids).to_not include product1.id
|
||||
expect(product_ids).not_to include product1.id
|
||||
end
|
||||
|
||||
it "does not return variants hidden for this specific customer" do
|
||||
@@ -185,7 +185,7 @@ module Api
|
||||
|
||||
api_get :products, id: order_cycle.id, distributor: distributor.id
|
||||
|
||||
expect(product_ids).to_not include product2.id
|
||||
expect(product_ids).not_to include product2.id
|
||||
end
|
||||
|
||||
it "returns hidden variants made visible for this specific customer" do
|
||||
@@ -197,7 +197,7 @@ module Api
|
||||
|
||||
api_get :products, id: order_cycle.id, distributor: distributor.id
|
||||
|
||||
expect(product_ids).to_not include product1.id
|
||||
expect(product_ids).not_to include product1.id
|
||||
expect(product_ids).to include product3.id
|
||||
end
|
||||
end
|
||||
|
||||
@@ -35,7 +35,7 @@ module Api
|
||||
expect(response.status).to eq 200
|
||||
expect(json_response["id"]).to eq enterprise.id
|
||||
enterprise.reload
|
||||
expect(enterprise.promo_image).to_not be_attached
|
||||
expect(enterprise.promo_image).not_to be_attached
|
||||
end
|
||||
|
||||
context "when promo image does not exist" do
|
||||
|
||||
@@ -194,14 +194,14 @@ describe Api::V0::ShipmentsController, type: :controller do
|
||||
expect {
|
||||
api_put :add, params.merge(variant_id: existing_variant.to_param)
|
||||
expect(response.status).to eq(422)
|
||||
}.to_not change { existing_variant.reload.on_hand }
|
||||
}.not_to change { existing_variant.reload.on_hand }
|
||||
end
|
||||
|
||||
it "doesn't adjust stock when removing a variant" do
|
||||
expect {
|
||||
api_put :remove, params.merge(variant_id: existing_variant.to_param)
|
||||
expect(response.status).to eq(422)
|
||||
}.to_not change { existing_variant.reload.on_hand }
|
||||
}.not_to change { existing_variant.reload.on_hand }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ module Api
|
||||
expect(response.status).to eq 200
|
||||
expect(json_response["id"]).to eq enterprise.id
|
||||
enterprise.reload
|
||||
expect(enterprise.terms_and_conditions).to_not be_attached
|
||||
expect(enterprise.terms_and_conditions).not_to be_attached
|
||||
end
|
||||
|
||||
context "when terms and conditions file does not exist" do
|
||||
|
||||
@@ -172,7 +172,7 @@ describe Api::V0::VariantsController, type: :controller do
|
||||
variant = product.variants.first
|
||||
spree_delete :destroy, id: variant.to_param
|
||||
|
||||
expect(variant.reload).to_not be_deleted
|
||||
expect(variant.reload).not_to be_deleted
|
||||
expect(assigns(:variant).errors[:product]).to include "must have at least one variant"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -17,7 +17,7 @@ describe BaseController, type: :controller do
|
||||
it "doesn't change anything without a user" do
|
||||
expect {
|
||||
get :index
|
||||
}.to_not change { Spree::Order.count }
|
||||
}.not_to change { Spree::Order.count }
|
||||
end
|
||||
|
||||
it "creates a new order" do
|
||||
@@ -36,7 +36,7 @@ describe BaseController, type: :controller do
|
||||
|
||||
expect {
|
||||
get :index
|
||||
}.to_not change { Spree::Order.count }
|
||||
}.not_to change { Spree::Order.count }
|
||||
|
||||
expect(session[:order_id]).to eq last_cart.id
|
||||
end
|
||||
@@ -63,7 +63,7 @@ describe BaseController, type: :controller do
|
||||
|
||||
expect {
|
||||
get :index
|
||||
}.to_not change { Spree::Order.count }
|
||||
}.not_to change { Spree::Order.count }
|
||||
|
||||
expect(current_cart.line_items.count).to eq 0
|
||||
end
|
||||
@@ -89,13 +89,13 @@ describe BaseController, type: :controller do
|
||||
get :index
|
||||
}.to change { Spree::Order.count }.by(1)
|
||||
|
||||
expect(session[:order_id]).to_not eq just_completed_order.id
|
||||
expect(session[:order_id]).to_not eq last_cart.id
|
||||
expect(session[:order_id]).not_to eq just_completed_order.id
|
||||
expect(session[:order_id]).not_to eq last_cart.id
|
||||
expect(controller.current_order.line_items.count).to eq 0
|
||||
end
|
||||
|
||||
it "doesn't load variant overrides without line items" do
|
||||
expect(VariantOverride).to_not receive(:indexed)
|
||||
expect(VariantOverride).not_to receive(:indexed)
|
||||
controller.current_order(true)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -148,7 +148,7 @@ describe CheckoutController, type: :controller do
|
||||
it "doesn't update default bill address on user" do
|
||||
expect {
|
||||
put :update, params: params.merge(order: { save_bill_address: "0" })
|
||||
}.to_not change {
|
||||
}.not_to change {
|
||||
order.user.reload.bill_address
|
||||
}
|
||||
end
|
||||
@@ -163,7 +163,7 @@ describe CheckoutController, type: :controller do
|
||||
it "doesn't update default ship address on user" do
|
||||
expect {
|
||||
put :update, params: params.merge(order: { save_ship_address: "0" })
|
||||
}.to_not change {
|
||||
}.not_to change {
|
||||
order.user.reload.ship_address
|
||||
}
|
||||
end
|
||||
@@ -196,7 +196,7 @@ describe CheckoutController, type: :controller do
|
||||
end
|
||||
|
||||
it "doesn't recalculate the voucher adjustment" do
|
||||
expect(service).to_not receive(:update)
|
||||
expect(service).not_to receive(:update)
|
||||
|
||||
put(:update, params:)
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ describe RaisingParameters do
|
||||
it "raises no error when all parameters are permitted" do
|
||||
expect {
|
||||
params.require(:data).permit(:id, :admin)
|
||||
}.to_not raise_error
|
||||
}.not_to raise_error
|
||||
end
|
||||
|
||||
it "doesn't change standard parameter objects" do
|
||||
@@ -34,7 +34,7 @@ describe RaisingParameters do
|
||||
|
||||
expect {
|
||||
original_params.permit(:one)
|
||||
}.to_not raise_error
|
||||
}.not_to raise_error
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -27,7 +27,7 @@ module Spree
|
||||
spree_get :index, order_id: order.number
|
||||
|
||||
expect(assigns(:collection)).to include adjustment1, adjustment2
|
||||
expect(assigns(:collection)).to_not include adjustment3
|
||||
expect(assigns(:collection)).not_to include adjustment3
|
||||
end
|
||||
|
||||
it "displays admin adjustments" do
|
||||
@@ -39,7 +39,7 @@ module Spree
|
||||
it "does not display enterprise fee adjustments" do
|
||||
spree_get :index, order_id: order.number
|
||||
|
||||
expect(assigns(:collection)).to_not include adjustment4
|
||||
expect(assigns(:collection)).not_to include adjustment4
|
||||
end
|
||||
end
|
||||
|
||||
@@ -237,7 +237,7 @@ module Spree
|
||||
expect {
|
||||
spree_post :create, order_id: order.number,
|
||||
adjustment: { label: "Testing", amount: "110" }
|
||||
}.to_not change { [Adjustment.count, order.reload.total] }
|
||||
}.not_to change { [Adjustment.count, order.reload.total] }
|
||||
|
||||
expect(response).to redirect_to spree.admin_order_adjustments_path(order)
|
||||
end
|
||||
@@ -246,7 +246,7 @@ module Spree
|
||||
expect {
|
||||
spree_put :update, order_id: order.number, id: adjustment.id,
|
||||
adjustment: { label: "Testing", amount: "110" }
|
||||
}.to_not change { [adjustment.reload.amount, order.reload.total] }
|
||||
}.not_to change { [adjustment.reload.amount, order.reload.total] }
|
||||
|
||||
expect(response).to redirect_to spree.admin_order_adjustments_path(order)
|
||||
end
|
||||
|
||||
@@ -13,7 +13,7 @@ describe Spree::Admin::GeneralSettingsController, type: :controller do
|
||||
end
|
||||
|
||||
it "updates available units" do
|
||||
expect(Spree::Config.available_units).to_not include("lb")
|
||||
expect(Spree::Config.available_units).not_to include("lb")
|
||||
settings_params = { available_units: { lb: "1" } }
|
||||
spree_put :update, settings_params
|
||||
expect(Spree::Config.available_units).to include("lb")
|
||||
|
||||
@@ -40,7 +40,7 @@ describe Spree::Admin::OrdersController, type: :controller do
|
||||
it "should allow me to send order invoices" do
|
||||
expect do
|
||||
spree_get :invoice, params
|
||||
end.to_not change{ Spree::OrderMailer.deliveries.count }
|
||||
end.not_to change{ Spree::OrderMailer.deliveries.count }
|
||||
expect(response).to redirect_to spree.edit_admin_order_path(order)
|
||||
expect(flash[:error])
|
||||
.to eq "#{distributor.name} must have a valid ABN before invoices can be used."
|
||||
|
||||
@@ -49,13 +49,13 @@ describe Spree::Admin::PaymentsController, type: :controller do
|
||||
|
||||
it "voids the payment" do
|
||||
order.reload
|
||||
expect(order.payment_total).to_not eq 0
|
||||
expect(order.payment_total).not_to eq 0
|
||||
expect(order.outstanding_balance.to_f).to eq 0
|
||||
spree_put :fire, params
|
||||
expect(payment.reload.state).to eq 'void'
|
||||
order.reload
|
||||
expect(order.payment_total).to eq 0
|
||||
expect(order.outstanding_balance.to_f).to_not eq 0
|
||||
expect(order.outstanding_balance.to_f).not_to eq 0
|
||||
end
|
||||
end
|
||||
|
||||
@@ -69,12 +69,12 @@ describe Spree::Admin::PaymentsController, type: :controller do
|
||||
|
||||
it "does not void the payment" do
|
||||
order.reload
|
||||
expect(order.payment_total).to_not eq 0
|
||||
expect(order.payment_total).not_to eq 0
|
||||
expect(order.outstanding_balance.to_f).to eq 0
|
||||
spree_put :fire, params
|
||||
expect(payment.reload.state).to eq 'completed'
|
||||
order.reload
|
||||
expect(order.payment_total).to_not eq 0
|
||||
expect(order.payment_total).not_to eq 0
|
||||
expect(order.outstanding_balance.to_f).to eq 0
|
||||
expect(flash[:error]).to eq "Bup-bow!"
|
||||
end
|
||||
@@ -92,13 +92,13 @@ describe Spree::Admin::PaymentsController, type: :controller do
|
||||
|
||||
it "can still void the payment" do
|
||||
order.reload
|
||||
expect(order.payment_total).to_not eq 0
|
||||
expect(order.payment_total).not_to eq 0
|
||||
expect(order.outstanding_balance.to_f).to eq 0
|
||||
spree_put :fire, params
|
||||
expect(payment.reload.state).to eq 'void'
|
||||
order.reload
|
||||
expect(order.payment_total).to eq 0
|
||||
expect(order.outstanding_balance.to_f).to_not eq 0
|
||||
expect(order.outstanding_balance.to_f).not_to eq 0
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -115,13 +115,13 @@ describe Spree::Admin::PaymentsController, type: :controller do
|
||||
|
||||
it "voids the payment" do
|
||||
order.reload
|
||||
expect(order.payment_total).to_not eq 0
|
||||
expect(order.payment_total).not_to eq 0
|
||||
expect(order.outstanding_balance.to_f).to eq 0
|
||||
spree_put :fire, params
|
||||
expect(payment.reload.state).to eq 'void'
|
||||
order.reload
|
||||
expect(order.payment_total).to eq 0
|
||||
expect(order.outstanding_balance.to_f).to_not eq 0
|
||||
expect(order.outstanding_balance.to_f).not_to eq 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -258,7 +258,7 @@ describe Spree::Admin::PaymentsController, type: :controller do
|
||||
it 'does not process the event' do
|
||||
spree_put :fire, params
|
||||
|
||||
expect(payment).to_not receive(:unrecognized_event)
|
||||
expect(payment).not_to receive(:unrecognized_event)
|
||||
expect(flash[:error]).to eq('Could not update the payment')
|
||||
end
|
||||
end
|
||||
|
||||
@@ -24,7 +24,7 @@ describe Spree::Admin::OrdersController, type: :controller do
|
||||
|
||||
spree_get :edit, id: order
|
||||
|
||||
expect(response.body).to_not match adjustment.label
|
||||
expect(response.body).not_to match adjustment.label
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -204,7 +204,7 @@ describe Spree::Admin::OrdersController, type: :controller do
|
||||
order.reload
|
||||
|
||||
expect(order.all_adjustments.tax.count).to eq 2
|
||||
expect(order.all_adjustments.tax).to_not include legacy_tax_adjustment
|
||||
expect(order.all_adjustments.tax).not_to include legacy_tax_adjustment
|
||||
expect(order.additional_tax_total).to eq 0.5
|
||||
end
|
||||
end
|
||||
|
||||
@@ -190,7 +190,7 @@ describe Spree::Admin::ProductsController, type: :controller do
|
||||
spree_put :update, id: product, product: { supplier_id: new_producer.id }
|
||||
|
||||
expect(product.reload.supplier.id).to eq new_producer.id
|
||||
expect(order_cycle.reload.distributed_variants).to_not include product.variants.first
|
||||
expect(order_cycle.reload.distributed_variants).not_to include product.variants.first
|
||||
end
|
||||
end
|
||||
|
||||
@@ -227,7 +227,7 @@ describe Spree::Admin::ProductsController, type: :controller do
|
||||
expect(Spree::Property.count).to be 1
|
||||
expect(Spree::ProductProperty.count).to be 0
|
||||
property_names = product.reload.properties.map(&:name)
|
||||
expect(property_names).to_not include 'a different name'
|
||||
expect(property_names).not_to include 'a different name'
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ describe Spree::Admin::SearchController, type: :controller do
|
||||
|
||||
it "returns a list of users that I share management of enteprises with" do
|
||||
expect(assigns(:users)).to include owner, manager
|
||||
expect(assigns(:users)).to_not include random
|
||||
expect(assigns(:users)).not_to include random
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ module Spree
|
||||
it "updates the record" do
|
||||
expect {
|
||||
spree_put :update, id: tax_rate.id, tax_rate: params
|
||||
}.to_not change{ Spree::TaxRate.with_deleted.count }
|
||||
}.not_to change{ Spree::TaxRate.with_deleted.count }
|
||||
|
||||
expect(response).to redirect_to spree.admin_tax_rates_url
|
||||
expect(tax_rate.reload.name).to eq "Updated Rate"
|
||||
|
||||
@@ -26,7 +26,7 @@ describe Spree::ApiKeysController, type: :controller, performance: true do
|
||||
expect {
|
||||
spree_post :create, id: other_user.id
|
||||
other_user.reload
|
||||
}.to_not change {
|
||||
}.not_to change {
|
||||
other_user.spree_api_key
|
||||
}
|
||||
end
|
||||
|
||||
@@ -94,7 +94,7 @@ describe Spree::CreditCardsController, type: :controller do
|
||||
{ status: 402, body: JSON.generate(error: { message: "Bup-bow..." }) }
|
||||
}
|
||||
it "doesn't save the card locally, and renders a flash error" do
|
||||
expect{ spree_post :new_from_token, params }.to_not change { Spree::CreditCard.count }
|
||||
expect{ spree_post :new_from_token, params }.not_to change { Spree::CreditCard.count }
|
||||
|
||||
json_response = JSON.parse(response.body)
|
||||
flash_message = "There was a problem with your payment information: %s" % 'Bup-bow...'
|
||||
@@ -172,7 +172,7 @@ describe Spree::CreditCardsController, type: :controller do
|
||||
let(:params) { { id: 123 } }
|
||||
|
||||
it "redirects to /account with a flash error, does not request deletion with Stripe" do
|
||||
expect(controller).to_not receive(:destroy_at_stripe)
|
||||
expect(controller).not_to receive(:destroy_at_stripe)
|
||||
spree_delete :destroy, params
|
||||
expect(flash[:error]).to eq 'Sorry, the card could not be removed'
|
||||
expect(response.status).to eq 200
|
||||
@@ -205,7 +205,7 @@ describe Spree::CreditCardsController, type: :controller do
|
||||
end
|
||||
|
||||
it "doesn't delete the card" do
|
||||
expect{ spree_delete :destroy, params }.to_not change { Spree::CreditCard.count }
|
||||
expect{ spree_delete :destroy, params }.not_to change { Spree::CreditCard.count }
|
||||
expect(flash[:error]).to eq 'Sorry, the card could not be removed'
|
||||
expect(response.status).to eq 422
|
||||
end
|
||||
|
||||
@@ -150,7 +150,7 @@ describe Spree::OrdersController, type: :controller do
|
||||
spree_registration_path = '/signup'
|
||||
ofn_registration_path = '/register'
|
||||
get :edit
|
||||
expect(response.body).to_not match spree_registration_path
|
||||
expect(response.body).not_to match spree_registration_path
|
||||
expect(response.body).to match ofn_registration_path
|
||||
end
|
||||
end
|
||||
|
||||
@@ -33,7 +33,7 @@ describe Spree::UsersController, type: :controller do
|
||||
get :show
|
||||
|
||||
expect(orders).to include d1o1, d1o2
|
||||
expect(orders).to_not include d1_order_for_u2, d1o3, d2o1
|
||||
expect(orders).not_to include d1_order_for_u2, d1o3, d2o1
|
||||
expect(shops).to include distributor1
|
||||
|
||||
# Doesn't return orders for irrelevant distributors" do
|
||||
|
||||
@@ -24,7 +24,7 @@ describe WebhookEndpointsController, type: :controller do
|
||||
it "shows error if parameters not specified" do
|
||||
expect {
|
||||
spree_post :create, { url: "" }
|
||||
}.to_not change {
|
||||
}.not_to change {
|
||||
user.webhook_endpoints.count
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user