Guest User

Untitled

a guest
Jun 20th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. describe WelcomeHelper do
  2. context "when generating the manage samples link" do
  3. it "should check the current user against the standard administrative roles" do
  4. @current_user = double("A user")
  5. @administrative_roles = %w{submitter reviewer admin}
  6.  
  7. helper.stub!(:current_user).and_return(@current_user)
  8.  
  9. helper.should_receive!(:manage_samples_link_for).with(@current_user, @administrative_roles)
  10.  
  11. helper.manage_samples_link
  12. end
  13.  
  14. it "should reject a user in roles other than the acceptable ones" do
  15. wrong_role_user = stub("A user in none of the acceptable roles")
  16. acceptable_roles = %w{a b c d e f g}
  17. acceptable_roles.each { | each |
  18. wrong_role_user.stub!(:role?).with(each).and_return(false)
  19. }
  20.  
  21. helper.manage_samples_link_for(wrong_role_user, acceptable_roles).should be_nil
  22. end
  23. end
  24. end
Add Comment
Please, Sign In to add comment