Skip to content

Commit cb4b157

Browse files
authored
Revert "Fixes the HealthInsurence#index to return true and false custom value…" (#239)
This reverts commit 729271e.
1 parent 729271e commit cb4b157

File tree

3 files changed

+3
-30
lines changed

3 files changed

+3
-30
lines changed

app/operations/health_insurances/list.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def apply_custom_filter(query)
2323
if %w[true false].include?(params[:custom])
2424
query.by_custom(custom: params[:custom], user: user)
2525
else
26-
query.where(user: user)
26+
query.where(custom: false)
2727
end
2828
end
2929
end

spec/operations/health_insurances/list_spec.rb

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -26,32 +26,6 @@
2626
)
2727
end
2828

29-
context "when filtering by user" do
30-
it "returns only health insurances for the specified user" do
31-
user1 = create(:user)
32-
user2 = create(:user)
33-
health_insurance_user1 = create(:health_insurance, custom: true, user: user1)
34-
create(:health_insurance, custom: true, user: user2)
35-
36-
result_user1 = described_class.call(user: user1)
37-
expect(result_user1.health_insurances).to all(have_attributes(user: user1))
38-
expect(result_user1.health_insurances[0].id).to eq(health_insurance_user1.id)
39-
40-
result_user2 = described_class.call(user: user2)
41-
expect(result_user2.health_insurances).to all(have_attributes(user: user2))
42-
end
43-
44-
it "returns no health insurances for user without any" do
45-
user1 = create(:user)
46-
create(:health_insurance, custom: true, user: user1)
47-
user2 = create(:user)
48-
49-
result = described_class.call(user: user2)
50-
51-
expect(result.health_insurances).to be_empty
52-
end
53-
end
54-
5529
context "when custom is true" do
5630
it "returns only the custom health_insurances for the given user" do
5731
user = create(:user)

spec/requests/api/v1/health_insurances_request_spec.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818

1919
before do
2020
headers = auth_token_for(create(:user))
21-
params = { custom: false }
22-
get "/api/v1/health_insurances", headers: headers, params: params
21+
get "/api/v1/health_insurances", headers: headers
2322
end
2423

2524
it "returns ok" do
@@ -63,7 +62,7 @@
6362
before do
6463
create_list(:health_insurance, 8)
6564
headers = auth_token_for(create(:user))
66-
get "/api/v1/health_insurances", params: { page: 2, per_page: 5, custom: false }, headers: headers
65+
get "/api/v1/health_insurances", params: { page: 2, per_page: 5 }, headers: headers
6766
end
6867

6968
it "returns only 3 health_insurances" do

0 commit comments

Comments
 (0)