Sha256: 51682f722ec52e621271c796dc146bfb1385efdfceadd84b670d6df4e36730aa
Contents?: true
Size: 1.24 KB
Versions: 3
Compression:
Stored size: 1.24 KB
Contents
require 'kookaburra/json_api_driver' describe Kookaburra::JsonApiDriver do describe 'private methods (for use by subclasses)' do describe '#post' do it 'posts data as JSON to the specified path within the application' do app_driver = mock('RackDriver') app_driver.should_receive(:post) \ .with('/foo', '{"bar":"baz"}', 'Content-Type' => 'application/json', 'Accept' => 'application/json') \ .and_return('{"foo":"bar"}') driver = Kookaburra::JsonApiDriver.new(app_driver) driver.send(:post, '/foo', {:bar => :baz}) end it 'returns the response body parsed from JSON' do app_driver = stub('RackDriver', :post => '{"ham":"spam"}') driver = Kookaburra::JsonApiDriver.new(app_driver) driver.send(:post, '/foo', {:bar => :baz}) \ .should == {:ham => 'spam'} end end describe '#authorize' do it 'sets the authorization credentials on the app driver' do app_driver = mock('RackDriver') app_driver.should_receive(:authorize).with('a user', 'a password') driver = Kookaburra::JsonApiDriver.new(app_driver) driver.send(:authorize, 'a user', 'a password') end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
kookaburra-0.16.1 | spec/kookaburra/json_api_driver_spec.rb |
kookaburra-0.16.0 | spec/kookaburra/json_api_driver_spec.rb |
kookaburra-0.15.1 | spec/kookaburra/json_api_driver_spec.rb |