[rspec-users] preferred place for methods used by both rspec and cucumber?

Patrick J. Collins patrick at collinatorstudios.com
Wed Sep 21 22:35:06 EDT 2011


Hi,

I have some helper methods such as:

def mock_omniauth
  OmniAuth.config.test_mode = true
  OmniAuth.config.mock_auth[:facebook] = facebook_user
end

def facebook_user
  @facebook_user ||= HashWithIndifferentAccess.new(YAML.load(File.read("#{Rails.root}/test/fixtures/fb_user.yml")))
end

that I want to use in both cucumber step definitions and rspec.  Is there a
preferred place to store this code, or is it standard practice to just define
them in a module in config/inititalizers and include that in both cucumber's
env.rb and rspec's spec_helper.rb?

Thanks.

Patrick J. Collins
http://collinatorstudios.com



More information about the rspec-users mailing list