Created
January 3, 2012 01:48
-
-
Save mainej/1553039 to your computer and use it in GitHub Desktop.
This file contains 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
class SignUpPage | |
def initialize | |
current_path.should == sign_up_path | |
end | |
def with_email(email) | |
fill_in "Login", :with => email | |
end | |
def with_password(password, confirmation = password) | |
fill_in "Password", :with => password | |
fill_in "Please re-type your password", :with => confirmation | |
end | |
def sign_up_as(email, password) | |
with_email(email) | |
with_password(password) | |
submit_successfully | |
end | |
def submit_successfully | |
click_link "Sign Up" | |
return TOSPage.new | |
end | |
def submit_unsuccessfully | |
click_link "Sign Up" | |
return SignUpPage.new | |
end | |
end |
This file contains 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
class TOSPage | |
def initialize | |
current_path.should == terms_path | |
end | |
def agree_to_terms | |
check "Agree" | |
end | |
def submit | |
click_link 'Continue' | |
return EditProfilePage.new | |
end | |
end |
This file contains 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
class UrlBar | |
def go_to_sign_up | |
visit sign_up_path | |
return SignUpPage.new | |
end | |
def at_edit_profile_page? | |
current_path == edit_profile_path | |
end | |
end |
This file contains 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
describe "sign-up workflow" do | |
context 'with valid credentials and TOS acceptance' do | |
it 'should take you to the edit profile page' do | |
url = UrlBar.new | |
sign_up = url_bar.go_to_sign_up | |
sign_up.with_email("[email protected]") | |
sign_up.with_password("password") | |
tos = sign_up.submit_successfully | |
tos.agree_to_terms | |
tos.submit | |
url.should be_at_edit_profile_page | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment