Skip to content

Instantly share code, notes, and snippets.

@cupakromer
Created February 12, 2014 02:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cupakromer/8948898 to your computer and use it in GitHub Desktop.
Save cupakromer/8948898 to your computer and use it in GitHub Desktop.
# spec/support/feature_sigin_helpers.rb
# Just some useful namespace
module KrackenFeatures
module SignInHelpers
def sign_in(person)
visit new_user_session_path
fill_in 'Email', with: person.email
fill_in 'Password', with: person.password
click_button 'Sign in'
end
end
end
# Manually include per feature spec
require 'spec_helper'
feature 'Placing an order' do
include KrackenFeatures::SignInHelpers
given(:john_smith) { }
# stuff
end
# If you wish to use metadata instead
# spec/spec_helper.rb
# stuff
RSpec.configure do |config|
# stuff
config.include KrackenFeatures::SignInHelpers, signinable: true
end
# then in the spec file
feature 'Placing an order', :signinable do
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment