Sha256: 0e594a655532886f7980f5664b5ff27c3c290dca98efd4c3c401863f8d9766f9
Contents?: true
Size: 1.38 KB
Versions: 5
Compression:
Stored size: 1.38 KB
Contents
# frozen_string_literal: true require 'database_cleaner/active_record' require 'factory_bot' require 'faker' require 'omniauth' require 'pry' require 'rack/test' require 'rspec' require 'webmock/rspec' ENV['RACK_ENV'] = 'test' ENV['SESSION_SECRET'] = 'supersecret' require File.expand_path '../lib/osso.rb', __dir__ module RSpecMixin include Rack::Test::Methods def app Rack::URLMap.new( '/admin' => Osso::Admin, '/auth' => Osso::Auth, '/oauth' => Osso::Oauth, ) end def mock_saml_omniauth(email: 'user@enterprise.com', id: SecureRandom.uuid) OmniAuth.config.add_mock(:saml, extra: { response_object: { attributes: { 'id': id, 'email': email, }, }, }) end def last_json_response JSON.parse(last_response.body, symbolize_names: true) end end RSpec.configure do |config| config.include RSpecMixin config.include FactoryBot::Syntax::Methods config.before(:suite) do ActiveRecord::Base.establish_connection FactoryBot.find_definitions DatabaseCleaner.strategy = :transaction DatabaseCleaner.clean_with(:truncation) end config.around(:each) do |example| DatabaseCleaner.cleaning do example.run end end OmniAuth.config.test_mode = true OmniAuth.config.logger = Logger.new('/dev/null') WebMock.disable_net_connect!(allow_localhost: true) end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
osso-0.0.3.3 | spec/spec_helper.rb |
osso-0.0.3 | spec/spec_helper.rb |
osso-0.0.2.10 | spec/spec_helper.rb |
osso-0.0.2.9 | spec/spec_helper.rb |
osso-0.0.2.8 | spec/spec_helper.rb |