Skip to content

Instantly share code, notes, and snippets.

@aag1091
Created October 26, 2013 07:21
Show Gist options
  • Save aag1091/7166309 to your computer and use it in GitHub Desktop.
Save aag1091/7166309 to your computer and use it in GitHub Desktop.
A simple feature spec
require 'spec_helper'
feature 'Visitor signs up', :js => true do
scenario 'with valid details' do
visit root_path
find('#connect_id').hover
within('#connect_area') do
find('.share_mail').click
end
within('.sign_up') do
fill_in 'user_full_name', with: 'Bob Martin'
fill_in 'user_email', with: 'bob.martin@gmail.com'
fill_in 'user_password', with: '12345678'
fill_in 'user_password_confirmation', with: '12345678'
click_button('REGISTER')
end
sleep 4
expect(User.last.email).to eq("bob.martin@gmail.com")
end
scenario 'with invalid email details' do
visit root_path
find('#connect_id').hover
within('#connect_area') do
find('.share_mail').click
end
within('.sign_up') do
fill_in 'user_full_name', with: 'Bob Martin'
fill_in 'user_email', with: 'bob.martin'
fill_in 'user_password', with: '12345678'
fill_in 'user_password_confirmation', with: '12345678'
click_button('REGISTER')
end
expect(User.last.try(:email)).to_not eq('bob.martin')
end
scenario 'with invalid password details' do
visit root_path
find('#connect_id').hover
within('#connect_area') do
find('.share_mail').click
end
within('.sign_up') do
fill_in 'user_full_name', with: 'Bob Martin'
fill_in 'user_email', with: 'bob.martin@ymail.com'
fill_in 'user_password', with: '1234'
fill_in 'user_password_confirmation', with: '12345678'
click_button('REGISTER')
end
expect(User.last.try(:email)).to_not eq('bob.martin@ymail.com')
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment