kookaburra 0.18.3 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,14 +0,0 @@
1
- require 'active_record'
2
-
3
- class ActiveRecord::Base
4
- mattr_accessor :shared_connection
5
- @@shared_connection = nil
6
-
7
- def self.connection
8
- @@shared_connection || retrieve_connection
9
- end
10
- end
11
-
12
- # Forces all threads to share the same connection. This works on
13
- # Capybara because it starts the web server in a thread.
14
- ActiveRecord::Base.shared_connection = ActiveRecord::Base.connection
@@ -1,42 +0,0 @@
1
- require 'kookaburra/rack_driver'
2
-
3
- describe Kookaburra::RackDriver do
4
- it 'has Rack::Test::Methods' do
5
- Kookaburra::RackDriver.should include(Rack::Test::Methods)
6
- end
7
-
8
- {
9
- 'post' => {:success => 201, :unexpected => 200},
10
- 'put' => {:success => 200, :unexpected => 404},
11
- 'get' => {:success => 200, :unexpected => 404}
12
- }.each_pair do |method, codes|
13
- describe "##{method}" do
14
- it 'returns the response body' do
15
- app = stub('Rack App', :call => [codes[:success], {}, 'response body'])
16
- driver = Kookaburra::RackDriver.new(app)
17
- driver.send(method.to_sym, '/foo', 'req body').should == 'response body'
18
- end
19
-
20
- it 'sets the specified headers on the request' do
21
- app = mock('Rack App')
22
- driver = Kookaburra::RackDriver.new(app)
23
- app.should_receive(:call) do |env|
24
- env['HTTP_HEADER_A'].should == 'foo'
25
- env['HTTP_HEADER_B'].should == 'bar'
26
- [codes[:success], {}, 'foo']
27
- end
28
- driver.send(method.to_sym, '/foo', 'req body', 'header-a' => 'foo', 'header-b' => 'bar')
29
- end
30
-
31
- it "raises a Kookabura::UnexpectedResponse if response status is not #{codes[:success]}" do
32
- app_response = [codes[:unexpected], {'Content-Type' => 'application/json'}, 'Here is the response body']
33
- app = stub('Rack App', :call => app_response)
34
- driver = Kookaburra::RackDriver.new(app)
35
- lambda { driver.send(method, '/foo', {:bar => :baz}) } \
36
- .should raise_error(Kookaburra::UnexpectedResponse,
37
- "#{method} to /foo unexpectedly responded with an HTTP status of #{codes[:unexpected]}:\n" \
38
- + 'Here is the response body')
39
- end
40
- end
41
- end
42
- end