Skip to content

Instantly share code, notes, and snippets.

@ch1ago
Created June 15, 2012 19:21
Show Gist options
  • Save ch1ago/2938294 to your computer and use it in GitHub Desktop.
Save ch1ago/2938294 to your computer and use it in GitHub Desktop.
require 'spec_helper'
describe 'Home' do
describe "GET /home/user" do
it "capybara: from login page until " do
Fabricate(:school)
# - creating user
visit '/auth/facebook'
current_path.should == home_user_path
# - submits email to become a student
#submits invalid email
expect do
fill_in('school_user_request_email', with: 'John')
click_button 'Register'
end.should change { SchoolUserRequest.count }.by(0)
page.should have_content('alert(')
#submits valid email
visit home_user_path
expect do
fill_in('school_user_request_email', with: "#{Faker::Internet.user_name}@uncc.edu")
click_button 'Register'
end.should change { SchoolUserRequest.count }.by(1)
page.should have_content('$("body").append')
# - clicks the confirmation email (currently mocked in the view)
#clicks invalid link
visit home_user_school_path('lalala')
page.should have_content('404')
#clicks valid link
#@current_user = User.first
#visit home_user_school_path(@current_user.school_user_requests.first.confirmation_token)
visit home_user_school_path(User.first.school_user_requests.first.confirmation_token)
current_path.should == home_student_path
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment