Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- describe WelcomeHelper do
- context "when generating the manage samples link" do
- it "should check the current user against the standard administrative roles" do
- @current_user = double("A user")
- @administrative_roles = %w{submitter reviewer admin}
- helper.stub!(:current_user).and_return(@current_user)
- helper.should_receive!(:manage_samples_link_for).with(@current_user, @administrative_roles)
- helper.manage_samples_link
- end
- it "should reject a user in roles other than the acceptable ones" do
- wrong_role_user = stub("A user in none of the acceptable roles")
- acceptable_roles = %w{a b c d e f g}
- acceptable_roles.each { | each |
- wrong_role_user.stub!(:role?).with(each).and_return(false)
- }
- helper.manage_samples_link_for(wrong_role_user, acceptable_roles).should be_nil
- end
- end
- end
Add Comment
Please, Sign In to add comment