Sha256: 04cbebd08171de5e19b522f3ed87b8cf14bc8bb90a9cf700a4c77abea37e6dbf
Contents?: true
Size: 925 Bytes
Versions: 3
Compression:
Stored size: 925 Bytes
Contents
require 'helper' describe Moxy::App do SCRIPT=<<-EOF stub_request(:get, "http://example.org").to_return(:body=>"hello") EOF before do set_app Moxy::App WebMock.reset! end it "should set up a mock" do post '/', {:mock_text=>SCRIPT} WebMock::StubRegistry.instance.request_stubs.size.must_equal 1 WebMock::StubRegistry.instance.request_stubs.first.response.body.must_equal "hello" end it "should reset mocks" do post '/', {:mock_text => SCRIPT} get '/reset' WebMock::StubRegistry.instance.request_stubs.size.must_equal 0 end it "should list out all existing mocks" do post '/', {:mock_text => SCRIPT} get '/current' r.body.must_match "GET http://example.org" end it "should indicate error" do post '/', {:mock_text => "foobar"} get '/' r.body.must_match "Error registering this request: undefined local variable or method" end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
moxy-0.0.3 | spec/integration/app_spec.rb |
moxy-0.0.2 | spec/integration/app_spec.rb |
moxy-0.0.1 | spec/integration/app_spec.rb |