Skip to content

Commit

Permalink
update tests for forwarding token generation
Browse files Browse the repository at this point in the history
  • Loading branch information
timcowlishaw committed May 12, 2024
1 parent b3c70ab commit ef39350
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions spec/models/user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,24 +74,27 @@
describe "forwarding" do
describe "generating a forwarding token" do
context "when the user is a citizen" do
it "does not generate a forwarding token" do
it "does not generate a forwarding token or username" do
user.role_mask = 0
user.regenerate_forwarding_token!
user.regenerate_forwarding_tokens!
expect(user.forwarding_token).to be(nil)
expect(user.forwarding_username).to be(nil)
end
end
context "when the user is a researcher" do
it "generates a forwarding token" do
it "generates a forwarding token and username" do
user.role_mask = 2
user.regenerate_forwarding_token!
user.regenerate_forwarding_tokens!
expect(user.forwarding_token).not_to be(nil)
expect(user.forwarding_username).not_to be(nil)
end
end
context "when the user is an admin" do
it "generates a forwarding token" do
it "generates a forwarding token and username" do
user.role_mask = 5
user.regenerate_forwarding_token!
user.regenerate_forwarding_tokens!
expect(user.forwarding_token).not_to be(nil)
expect(user.forwarding_username).not_to be(nil)
end
end
end
Expand Down

0 comments on commit ef39350

Please sign in to comment.