Sha256: e73dffa57ad4bfb5720c16f0ae2dcb0ee7f245d9872d4eb04147053876ef8993

Contents?: true

Size: 536 Bytes

Versions: 3

Compression:

Stored size: 536 Bytes

Contents

require 'helper'



describe Moxy::WebMockHandler do
  before do
    set_app Moxy::WebMockHandler.new
    WebMock.reset!
  end

  it "should error 500 when no mock exists" do
    get '/'
    r.status.must_equal 500
    r.body.must_match "Unregistered request: GET http://example.org/ with headers"
  end

  it "should be able to set up a mock reply" do

    WebMock::API.stub_request(:get, "http://example.org/").to_return(:body => "hello moxy!")

    get '/'

    r.status.must_equal 200
    r.body.must_match "hello moxy!"
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
moxy-0.0.3 spec/integration/webmock_handler_spec.rb
moxy-0.0.2 spec/integration/webmock_handler_spec.rb
moxy-0.0.1 spec/integration/webmock_handler_spec.rb