Sha256: c966c04204ba580f5f8304c853885af6b5e77aeb1cb0162cd8405bf6ffdd09ea

Contents?: true

Size: 525 Bytes

Versions: 4

Compression:

Stored size: 525 Bytes

Contents

require 'rspec'
require 'sinatra/base'
require 'webmock/rspec'

require 'spidr/agent'

RSpec.shared_context "example App" do
  let(:host) { 'example.com' }

  subject { Agent.new(host: host) }

  def self.app(&block)
    let(:app) do
      klass = Class.new(Sinatra::Base)
      klass.set :host, host
      klass.set :port, 80
      klass.class_eval(&block)
      return klass
    end

    before do
      stub_request(:any, /#{Regexp.escape(host)}/).to_rack(app)

      subject.start_at("http://#{host}/")
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
spidr-0.7.1 spec/example_app.rb
spidr-0.7.0 spec/example_app.rb
spidr-0.6.1 spec/example_app.rb
spidr-0.6.0 spec/example_app.rb