Skip to content

Instantly share code, notes, and snippets.

@rinaldifonseca
Created September 30, 2011 17:39
Show Gist options
  • Save rinaldifonseca/1254450 to your computer and use it in GitHub Desktop.
Save rinaldifonseca/1254450 to your computer and use it in GitHub Desktop.
require 'spec_helper'
require 'integration/helpers'
feature "Access control", %q{
In secure the project
As an admin
I want control access to the site
} do
before :each do
@user = Factory(:user)
User.any_instance.stub(:counts_and_write_points)
@answer = Factory.create(:answer_from_casual_profile)
@question = @answer.question
end
scenario "sign up, sign out and sign in" do
login = "[email protected]"
pass = "123abc"
answer_survey(@question)
visit new_user_registration_path
fill_in "user_name", :with => "Name"
fill_in "user_email", :with => login
fill_in "user_password", :with => pass
fill_in "user_password_confirmation", :with => pass
click_on "Sign up"
page.should have_content(I18n.t "devise.registrations.signed_up")
click_on "Logout"
visit new_user_session_path
fill_in "user_email", :with => @user.email
fill_in "user_password", :with => @user.password
click_button "Sign in"
page.should have_content(I18n.t "devise.sessions.signed_in")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment