Skip to content

Commit 5ea52a1

Browse files
committed
Fix tests
1 parent 7b468ef commit 5ea52a1

File tree

5 files changed

+4
-63
lines changed

5 files changed

+4
-63
lines changed

app-rails/app/models/user.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ class User < ApplicationRecord
1313
validates :provider, presence: true
1414

1515
# == Methods ==============================================================
16-
def superadmin?
17-
email.include?("+admin")
18-
end
1916

2017
# Check if the access token is expired or will expire within the next `minutes` minutes.
2118
# Access token is only stored in the session, so it needs passed in, rather than accessed from the model.

app-rails/spec/controllers/users/registrations_controller_spec.rb

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,11 @@
99
)
1010
end
1111

12-
describe "GET new_applicant" do
13-
it "renders with applicant content and role" do
14-
get :new_applicant, params: { locale: "en" }
12+
describe "GET new" do
13+
it "renders" do
14+
get :new, params: { locale: "en" }
1515

16-
expect(response.body).to have_selector("h1", text: /create an applicant account/i)
17-
expect(response.body).to have_field("users_registration_form[role]", with: "applicant", type: :hidden)
18-
end
19-
end
20-
21-
describe "GET new_employer" do
22-
it "renders with employer content and role" do
23-
get :new_employer, params: { locale: "en" }
24-
25-
expect(response.body).to have_selector("h1", text: /create an employer account/i)
26-
expect(response.body).to have_field("users_registration_form[role]", with: "employer", type: :hidden)
16+
expect(response.body).to have_selector("h1", text: /create an account/i)
2717
end
2818
end
2919

app-rails/spec/factories/user_role_factory.rb

Lines changed: 0 additions & 18 deletions
This file was deleted.

app-rails/spec/factories/users_factory.rb

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,5 @@
44
uid { Faker::Internet.uuid }
55
provider { "factory_bot" }
66
mfa_preference { "opt_out" }
7-
8-
trait :applicant do
9-
user_role { create(:user_role, :applicant) }
10-
end
11-
12-
trait :employer do
13-
user_role { create(:user_role, :employer) }
14-
end
15-
16-
trait :superadmin do
17-
email { "test+admin@navapbc.com" }
18-
end
197
end
208
end

app-rails/spec/models/user_spec.rb

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,4 @@
2424
expect(user.access_token_expires_within_minutes?(access_token, 1)).to eq(false)
2525
end
2626
end
27-
28-
describe "superadmin?" do
29-
let(:user) { build(:user) }
30-
31-
pending "returns true for a superadmin"
32-
33-
it "returns false for a applicant" do
34-
user.user_role = build(:user_role, :applicant)
35-
expect(user.superadmin?).to eq(false)
36-
end
37-
38-
it "returns false for an employer" do
39-
user.user_role = build(:user_role, :employer)
40-
expect(user.superadmin?).to eq(false)
41-
end
42-
end
4327
end

0 commit comments

Comments
 (0)