@@ -32,14 +32,14 @@ def config_file
3232
3333let ( :api_options ) { { :config => config_file } }
3434
35- def mock_mongo
36- @api_server . config [ 'mongo' ] = mock ( 'mongo' ) . as_null_object
35+ def mock_mongo ( api )
36+ api . config [ 'mongo' ] = mock ( 'mongo' ) . as_null_object
3737end
3838
3939it 'responds to requests' do
40- with_api ( HttpLog , api_options ) do
40+ with_api ( HttpLog , api_options ) do | api |
4141server ( Responder , 8080 )
42- mock_mongo
42+ mock_mongo ( api )
4343
4444get_request ( { } , err ) do |c |
4545c . response_header . status . should == 200
@@ -48,9 +48,9 @@ def mock_mongo
4848end
4949
5050it 'forwards to our API server' do
51- with_api ( HttpLog , api_options ) do
51+ with_api ( HttpLog , api_options ) do | api |
5252server ( Responder , 8080 )
53- mock_mongo
53+ mock_mongo ( api )
5454
5555get_request ( { } , err ) do |c |
5656c . response_header . status . should == 200
@@ -70,9 +70,9 @@ def mock_mongo
7070
7171context 'query parameters' do
7272it 'forwards the query parameters' do
73- with_api ( HttpLog , api_options ) do
73+ with_api ( HttpLog , api_options ) do | api |
7474server ( Responder , 8080 )
75- mock_mongo
75+ mock_mongo ( api )
7676
7777get_request ( { :query => { :first => :foo , :second => :bar , :third => :baz } } , err ) do |c |
7878c . response_header . status . should == 200
@@ -84,9 +84,9 @@ def mock_mongo
8484
8585context 'request path' do
8686it 'forwards the request path' do
87- with_api ( HttpLog , api_options ) do
87+ with_api ( HttpLog , api_options ) do | api |
8888server ( Responder , 8080 )
89- mock_mongo
89+ mock_mongo ( api )
9090
9191get_request ( { :path => '/my/request/path' } , err ) do |c |
9292c . response_header . status . should == 200
@@ -98,9 +98,9 @@ def mock_mongo
9898
9999context 'headers' do
100100it 'forwards the headers' do
101- with_api ( HttpLog , api_options ) do
101+ with_api ( HttpLog , api_options ) do | api |
102102server ( Responder , 8080 )
103- mock_mongo
103+ mock_mongo ( api )
104104
105105get_request ( { :head => { :first => :foo , :second => :bar } } , err ) do |c |
106106c . response_header . status . should == 200
@@ -112,9 +112,9 @@ def mock_mongo
112112
113113context 'request method' do
114114it 'forwards GET requests' do
115- with_api ( HttpLog , api_options ) do
115+ with_api ( HttpLog , api_options ) do | api |
116116server ( Responder , 8080 )
117- mock_mongo
117+ mock_mongo ( api )
118118
119119get_request ( { } , err ) do |c |
120120c . response_header . status . should == 200
@@ -124,9 +124,9 @@ def mock_mongo
124124end
125125
126126it 'forwards POST requests' do
127- with_api ( HttpLog , api_options ) do
127+ with_api ( HttpLog , api_options ) do | api |
128128server ( Responder , 8080 )
129- mock_mongo
129+ mock_mongo ( api )
130130
131131post_request ( { } , err ) do |c |
132132c . response_header . status . should == 200
0 commit comments