Created
February 23, 2011 03:36
-
-
Save ttdonovan/839970 to your computer and use it in GitHub Desktop.
Steak - User Sign In Spec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper") | |
require 'steak' | |
require 'capybara/rails' | |
require 'capybara/session' | |
Spec::Runner.configure do |config| | |
config.include Capybara | |
end | |
# Put your acceptance spec helpers inside /spec/acceptance/support | |
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module HelperMethods | |
def should_be_on(path) | |
page.current_path.should == path | |
end | |
end | |
Spec::Runner.configuration.include(HelperMethods) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require File.expand_path(File.dirname(__FILE__) + '/acceptance_helper') | |
feature "User Sign In", %q{ | |
In order to access private information | |
As an user | |
I want to sign in | |
} do | |
let(:user) do | |
User.create!(Factory.attributes_for(:email_confirmed_user)) | |
end | |
scenario "should successfully sign in with email" do | |
visit '/sign_in' | |
fill_in 'Email Address', :with => user.email | |
fill_in 'Password', :with => 'password' | |
click_button 'Sign In' | |
should_be_on '/account' | |
page.should have_content('Signed In.') | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ENV["RAILS_ENV"] ||= 'test' | |
require File.expand_path(File.join(File.dirname(__FILE__),'..','config','environment')) | |
require 'spec/autorun' | |
require 'spec/rails' | |
# Requires supporting files with custom matchers and macros, etc, | |
# in ./support/ and its subdirectories. | |
Dir[File.expand_path(File.join(File.dirname(__FILE__),'support','**','*.rb'))].each {|f| require f} | |
Spec::Runner.configure do |config| | |
# If you're not using ActiveRecord you should remove these | |
# lines, delete config/database.yml and disable :active_record | |
# in your config/boot.rb | |
config.use_transactional_fixtures = true | |
config.use_instantiated_fixtures = false | |
config.fixture_path = RAILS_ROOT + '/spec/fixtures/' | |
config.before(:suite) do | |
DatabaseCleaner.strategy = :truncation | |
end | |
config.before(:each) do | |
DatabaseCleaner.start | |
end | |
config.after(:each) do | |
DatabaseCleaner.clean | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment