Sha256: 3fa5cfe9aa3109b7398d0068cf980f4cb3ad894c74e7b651e136fbc3d52b5c66

Contents?: true

Size: 1.43 KB

Versions: 7

Compression:

Stored size: 1.43 KB

Contents

require 'rspec'
require 'rack/test'
require 'timecop'

require 'lookout/rack/test'
module Lookout::Rack::Test
  module RSpec
  end
end

require 'lookout/rack/test/rspec/fake_request'
require 'lookout/rack/test/rspec/model_examples'

module Lookout
  module Rack
    module Test
      module RSpec
        # Takes one argument, the Models class (or module) that has a .setup and
        # .unsetup method
        def setup_models(models)
          ::RSpec.configure do |c|
            c.around(:each, :speed => :slow) do |example|
              models.setup
              example.run
              models.unsetup
            end
      
            c.before(:all, :speed => :slow) do
              require 'lookout/rack/test/load_factories'
            end
          end
        end
  
        # Takes one argument, the application (e.g., SinatraApplication)
        def setup_routes(application)
          ::RSpec.configure do |c|
            c.include(::Rack::Test::Methods, :type => :route)
  
            require 'lookout/rack/test/rspec/route_helper'
            ::Lookout::Rack::Test.app = application
            c.include(::RouteHelper, :type => :route)
          end
        end
  
        def configure_rspec
          ::RSpec.configure do |c|
            c.around(:each, :timefreeze => true) do |example|
              ::Timecop.freeze do
                example.run
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
lookout-rack-test-2.3.1 lib/lookout/rack/test/rspec.rb
lookout-rack-test-2.3.0 lib/lookout/rack/test/rspec.rb
lookout-rack-test-2.2.0 lib/lookout/rack/test/rspec.rb
lookout-rack-test-2.1.0 lib/lookout/rack/test/rspec.rb
lookout-rack-test-2.0.2 lib/lookout/rack/test/rspec.rb
lookout-rack-test-2.0.1 lib/lookout/rack/test/rspec.rb
lookout-rack-test-2.0.0 lib/lookout/rack/test/rspec.rb