Skip to content

Instantly share code, notes, and snippets.

@joshsmith
Created October 29, 2012 04:55
Show Gist options
  • Select an option

  • Save joshsmith/3971623 to your computer and use it in GitHub Desktop.

Select an option

Save joshsmith/3971623 to your computer and use it in GitHub Desktop.
require 'spec_helper'
feature 'Signing up' do
before do
OmniAuth.config.test_mode = true
visit '/signup'
end
scenario 'Successful art lover sign up with email' do
click_link "sign up with your email address."
fill_in "First name", :with => "Test"
fill_in "Last name", :with => "User"
fill_in "Username", :with => "testuser"
fill_in "Email", :with => "[email protected]"
fill_in "Password", :with => "password"
click_button "Create Account"
page.should have_content("Awesome! You're all signed up.");
end
scenario 'Successful artist sign up with email' do
click_link "sign up with your email address."
fill_in "First name", :with => "Test"
fill_in "Last name", :with => "User"
fill_in "Username", :with => "testuser"
fill_in "Email", :with => "[email protected]"
fill_in "Password", :with => "password"
page.check "I'm an artist and want to be invited to share my work!"
fill_in "Your Website or a link to your art", :with => "http://google.com"
click_button "Create Account"
page.should have_content("Awesome! You're all signed up.");
end
scenario "Successful Facebook sign up" do
OmniAuth.config.add_mock(:facebook, {
:uid => '12345',
:info => {
:email => '[email protected]',
:first_name => 'Test',
:last_name => 'User'
}
})
click_link "Sign up with Facebook"
page.should have_content("Your account on Artburst has been created via Facebook.")
end
scenario "Successful Twitter sign up" do
OmniAuth.config.add_mock(:twitter, { :uid => '12345' })
click_link "Sign up with Twitter"
fill_in "First name", :with => "Test"
fill_in "Last name", :with => "User"
fill_in "Username", :with => "testuser"
fill_in "Email", :with => "[email protected]"
fill_in "Password", :with => "password"
page.check "I'm an artist and want to be invited to share my work!"
fill_in "Your Website or a link to your art", :with => "http://google.com"
click_button "Create Account"
page.should have_content("Awesome! You're all signed up.")
end
scenario "Failed Facebook sign up - missing uid" do
OmniAuth.config.add_mock(:facebook, { :uid => nil })
click_link "Sign up with Facebook"
page.should have_content("Facebook returned invalid data for the user id.")
end
scenario "Failed Facebook sign up - missing email" do
OmniAuth.config.add_mock(:facebook, { :uid => '12345', :info => { :email => nil } })
click_link "Sign up with Facebook"
page.should have_content("Facebook can not be used to sign up for Artburst since no valid email address has been provided. Please use another authentication provider or sign up by email. If you already have an account, please sign-in and add Facebook from your profile.")
end
scenario "Failed email sign up" do
click_link "sign up with your email address."
# Only check artist invite request button and leave all else blank
page.check "I'm an artist and want to be invited to share my work!"
click_button "Create Account"
page.should have_content("Email can't be blank")
page.should have_content("Password can't be blank")
page.should have_content("Username can't be blank")
page.should have_content("First name can't be blank")
page.should have_content("Last name can't be blank")
page.should have_content("Invite request link URL should be in this format: http://artburst.com")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment