Sha256: a5671d173569cc5b3560cbb9d207495566566101023a819284c4a8f6ef0dd311
Contents?: true
Size: 1.79 KB
Versions: 3
Compression:
Stored size: 1.79 KB
Contents
require 'spec_helper' describe AngellistApi::Request do class DummyRequest; include AngellistApi::Request; end before(:each) do @dummy = DummyRequest.new @sample_path = "/index" @sample_params = { :sample => "params" } @sample_options = { :sample => "options" } end describe "#get" do it "should call request with the passed params" do @dummy.expects(:request).with(:get, @sample_path, @sample_params, @sample_options).returns("result") @dummy.get(@sample_path, @sample_params, @sample_options).should == "result" end end describe "#post" do it "should call request with the passed params" do @dummy.expects(:request).with(:post, @sample_path, @sample_params, @sample_options).returns("result") @dummy.post(@sample_path, @sample_params, @sample_options).should == "result" end end describe "#put" do it "should call request with the passed params" do @dummy.expects(:request).with(:put, @sample_path, @sample_params, @sample_options).returns("result") @dummy.put(@sample_path, @sample_params, @sample_options).should == "result" end end describe "#delete" do it "should call request with the passed params" do @dummy.expects(:request).with(:delete, @sample_path, @sample_params, @sample_options).returns("result") @dummy.delete(@sample_path, @sample_params, @sample_options).should == "result" end end describe "#formatted_path" do it "should return a string with the path without the given format appended" do @dummy.send(:formatted_path, @sample_path, {:format => 'json'}).should == "/index" end it "should not throw an error options[:format] is not provided" do lambda { @dummy.send(:formatted_path, @sample_path) }.should_not raise_error end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
angellist_api-1.0.1 | spec/lib/angellist_api/request_spec.rb |
angellist_api-0.1.2 | spec/lib/angellist_api/request_spec.rb |
angellist_api-1.0.0 | spec/lib/angellist_api/request_spec.rb |