From 9c8eba9ea9a094e9a5081f9f02c1b47eaa953517 Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Tue, 29 Nov 2016 00:07:28 +0200 Subject: [PATCH] Add session helper for feature specs --- spec/rails_helper.rb | 2 ++ spec/support/features/session_helpers.rb | 12 ++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 spec/support/features/session_helpers.rb diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 9411702f5..ab5842baf 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -5,6 +5,7 @@ require 'rspec/rails' require 'capybara/poltergeist' require 'paper_trail/frameworks/rspec' require 'money-rails/test_helpers' +require 'support/features/session_helpers' if ENV['ROBOT'] require 'simplecov' @@ -23,6 +24,7 @@ ActiveRecord::Migration.maintain_test_schema! RSpec.configure do |config| config.include ActionView::TestCase::Behavior, type: :presenter config.include ActiveSupport::Testing::TimeHelpers + config.include Features::SessionHelpers, type: :feature config.define_derived_metadata(file_path: %r{/spec/presenters/}) do |metadata| metadata[:type] = :presenter diff --git a/spec/support/features/session_helpers.rb b/spec/support/features/session_helpers.rb new file mode 100644 index 000000000..de0203e1a --- /dev/null +++ b/spec/support/features/session_helpers.rb @@ -0,0 +1,12 @@ +module Features + module SessionHelpers + def sign_in_to_registrar_area(user: FactoryGirl.create(:api_user)) + visit registrar_login_path + + fill_in 'depp_user_tag', with: user.username + fill_in 'depp_user_password', with: user.password + + click_button 'Login' + end + end +end