Sha256: 3e1346df21f0bb1b648c163dd77e70923692f94157cf3af74f6c0ec94173cd55

Contents?: true

Size: 1.09 KB

Versions: 5

Compression:

Stored size: 1.09 KB

Contents

require 'spec_helper'

describe Restfulie::Client::Feature::Verb do
  
  before do
    @request = Object.new
    @request.extend Restfulie::Client::Feature::Verb
  end
  
  context "when invoking throw error based methods" do
    
    it "should invoke throw error and delegate invocations on get" do
      @request.should_receive(:request).with(:throw_error_request)
      @request.should_receive(:get).with({:key => :value})
      @request.get!({:key => :value})
    end
    
    ["head", "delete"].each do |method|
      it "should invoke throw error and delegate invocations on #{method}" do
        @request.should_receive(:request).with(:throw_error_request)
        @request.should_receive(method)
        @request.send "#{method}!"
      end
    end

    ["put", "post", "patch"].each do |method|
      it "should invoke throw error and delegate invocations on #{method}" do
        body = "{ 'data' : 'content' }"
        @request.should_receive(:request).with(:throw_error_request)
        @request.should_receive(method).with(body)
        @request.send "#{method}!", body
      end
    end

  end

end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
restfulie-nosqlite-1.0.4 spec/unit/client/feature/verb_spec.rb
restfulie-1.1.1 spec/unit/client/feature/verb_spec.rb
restfulie-1.1.0 spec/unit/client/feature/verb_spec.rb
restfulie-nosqlite-1.0.3 spec/unit/client/feature/verb_spec.rb
restfulie-1.0.3 spec/unit/client/feature/verb_spec.rb