Sha256: ed008bf9da01d8087bcb5c11e1413ed2648759956c5083e1f38696269b664d12
Contents?: true
Size: 1.26 KB
Versions: 4
Compression:
Stored size: 1.26 KB
Contents
require 'spec_helper' describe MWS::API::Base do class FakeApi < MWS::API::Base def self.test_params { :verb => :get, :uri => '/FakeApi/2011-01-01', :version => '2011-01-01' } end def_request [:list_fake_objects, :list_fake_objects_by_next_token], self.test_params end before :all do @api = FakeApi.new(mws_object.connection) end context "def_request" do it "should generate methods for each request defined" do @api.respond_to?(:list_fake_objects).should be_true @api.respond_to?(:list_fake_objects_by_next_token).should be_true end it "should store request options as a class variable" do FakeApi.class_variable_get('@@list_fake_objects_options').should be FakeApi.class_variable_get('@@list_fake_objects_by_next_token_options').should be FakeApi.class_variable_get('@@list_fake_objects_options').should == FakeApi.test_params end end context "methods generated by def_request" do it "should call send_request with the right params" do @api.should_receive(:send_request). with(:list_fake_objects, {}, FakeApi.test_params). and_raise(TestWorksError) lambda{ @api.list_fake_objects }.should raise_error TestWorksError end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
ruby-mws-0.1 | spec/ruby-mws/api/base_spec.rb |
ruby-mws-0.0.4 | spec/ruby-mws/api/base_spec.rb |
ruby-mws-0.0.3 | spec/ruby-mws/api/base_spec.rb |
ruby-mws-0.0.2 | spec/ruby-mws/api/base_spec.rb |