Files
grecia/spec/features/beta_testers_spec.rb
2015-08-29 17:08:20 +02:00

37 lines
1007 B
Ruby

require 'rails_helper'
feature 'Beta testers' do
background do
allow_any_instance_of(ApplicationController).
to receive(:beta_site?).and_return(true)
allow_any_instance_of(ApplicationController).
to receive(:beta_testers).and_return(['isabel@example.com'])
end
scenario 'Beta testers should have access' do
visit root_path
sign_up('isabel@example.com', 'secretpassword')
confirm_email
fill_in 'user_email', with: 'isabel@example.com'
fill_in 'user_password', with: 'secretpassword'
click_button 'Log in'
expect(page).to have_content "Signed in successfully."
end
scenario 'Non beta testers should not have access' do
visit root_path
sign_up('other@example.com', 'secretpassword')
confirm_email
fill_in 'user_email', with: 'other@example.com'
fill_in 'user_password', with: 'secretpassword'
click_button 'Log in'
expect(page).to have_content "Sorry only Beta Testers are allowed access at the moment"
end
end