Sha256: 085042855bc5c67a87ddaa44a29c49ad9a23c488feebecce1cc69c7d7a96b88a

Contents?: true

Size: 945 Bytes

Versions: 3

Compression:

Stored size: 945 Bytes

Contents

require "click_session"
require "factory_girl_rails"
require "factories/test_unit_model_factory"
require "shoulda-matchers"
require "active_record"
require "webmock/rspec"

WebMock.disable_net_connect!(allow_localhost: true)

# Use memeory database when testing
ActiveRecord::Base.establish_connection adapter: "sqlite3", database: ":memory:"
require 'support/schema'


RSpec.configure do |config|
  config.include FactoryGirl::Syntax::Methods
  config.order = :random

  config.expect_with :rspec do |expectations|
    expectations.syntax = :expect
  end

  config.mock_with :rspec do |mocks|
    mocks.syntax = :expect
  end
end

# Helper methods
def mock_configuration_model_class_with(model)
  model_double = class_double(TestUnitModel)

  allow(model_double).
    to receive(:find_by_id).
    with(model.id).
    and_return(model)

  allow(ClickSession.configuration).
    to receive(:model_class).
    and_return(model_double)

  model
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
click_session-0.1.1 spec/spec_helper.rb
click_session-0.1.0 spec/spec_helper.rb
click_session-0.0.1 spec/spec_helper.rb