12346 - fix broken specs

This commit is contained in:
Ahmed Ejaz
2024-06-22 02:11:39 +05:00
parent 9dd427ab7f
commit afd09091a2
3 changed files with 10 additions and 10 deletions

View File

@@ -69,7 +69,7 @@ RSpec.describe Admin::SubscriptionsController, type: :controller do
get(:index, params:)
json_response = JSON.parse(response.body)
expect(json_response.count).to be 2
expect(json_response.pluck(:id)).to include subscription.id, subscription2.id
expect(json_response.pluck('id')).to include subscription.id, subscription2.id
end
context "when ransack predicates are submitted" do
@@ -79,7 +79,7 @@ RSpec.describe Admin::SubscriptionsController, type: :controller do
get(:index, params:)
json_response = JSON.parse(response.body)
expect(json_response.count).to be 1
ids = json_response.pluck(:id)
ids = json_response.pluck('id')
expect(ids).to include subscription2.id
expect(ids).not_to include subscription.id
end

View File

@@ -146,8 +146,8 @@ module Api
as: :json
expect(json_response['orders']
.pluck(:id)).to eq serialized_orders([order2, order3, order1, order4])
.pluck(:id)
.pluck('id')).to eq serialized_orders([order2, order3, order1, order4])
.pluck('id')
end
context "with an order without billing address" do
@@ -161,17 +161,17 @@ module Api
as: :json
expect(json_response['orders']
.pluck(:id)).to match_array serialized_orders([order2, order3, order1, order4,
order7])
.pluck(:id)
.pluck('id')).to match_array serialized_orders([order2, order3, order1, order4,
order7])
.pluck('id')
end
it 'can sort orders by bill_address.lastname' do
get :index, params: { q: { s: 'bill_address_lastname ASC' } },
as: :json
expect(json_response['orders']
.pluck(:id)).to eq serialized_orders([order2, order3, order1, order4, order7])
.pluck(:id)
.pluck('id')).to eq serialized_orders([order2, order3, order1, order4, order7])
.pluck('id')
end
end
end

View File

@@ -41,7 +41,7 @@ RSpec.describe Api::Admin::ForOrderCycle::SuppliedProductSerializer do
describe "supplied products" do
it "renders variants regardless of whether they are in the coordinators inventory" do
expect(serialized_product).to have_json_size(2).at_path 'variants'
variant_ids = parse_json(serialized_product)['variants'].pluck(:id)
variant_ids = parse_json(serialized_product)['variants'].pluck('id')
expect(variant_ids).to include non_inventory_variant.id, inventory_variant.id
end
end