Created
February 1, 2013 22:22
-
-
Save ogredude/4694559 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
feature "New invitation" do | |
let!(:user) { Fabricate(:user) } | |
background do | |
reset_mailer | |
user.activate! | |
activate_authlogic | |
sign_in user | |
end | |
scenario "user should be able to send invitations" do | |
visit root_url | |
should_see "(5 left)" | |
click_link "invite_link" | |
fill_in "Recipient email", :with => "[email protected]" | |
click_button "invite_submit" | |
should_see "Invitation sent" | |
should_see "(4 left)" | |
click_link "logout" | |
open_email_for "[email protected]" | |
current_email.should have_subject("[destico] You have been invited to participate!") | |
end | |
scenario "invited user should be able to sign up" do | |
sign_out | |
invitation = Fabricate(:invitation, :recipient_email => "[email protected]") | |
invitation.deliver! | |
open_email_for "[email protected]" | |
current_email.should have_subject("[destico] You have been invited to participate!") | |
click_first_link_in_email | |
should_see "New User" | |
page.should have_selector("input", :type => "text", :value => invitation.token) | |
fill_in "user_first_name", :with => "Joe" | |
fill_in "user_last_name", :with => "Doe" | |
fill_in "user_username", :with => "joeydoey" | |
fill_in "user_password", :with => "sekrit" | |
fill_in "user_password_confirmation", :with => "sekrit" | |
click_button "register_submit" | |
should_see "Your account has been created" | |
open_last_email | |
current_email.should have_subject("[destico] Activation Instructions") | |
click_first_link_in_email | |
should_see "your account has been activated" | |
should_see "Profile - Joe Doe" | |
open_last_email | |
current_email.should have_subject("[destico] Activation Complete") | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment