Sha256: de001f9f00bd48fe213941e2d6e0cb1c8823c259cf3a5a62ebc7bec46095b636

Contents?: true

Size: 1.01 KB

Versions: 134

Compression:

Stored size: 1.01 KB

Contents

require 'spec_helper'

describe Flexirest::Recording do
  it "can confirm if a recording callback is set" do
    class MyObject1
      include Flexirest::Recording
    end
    expect(MyObject1.record_response?).to be_falsey
    MyObject1.record_response do
      puts "Hello world"
    end
    expect(MyObject1.record_response?).to be_truthy
  end

  it "remembers a block given to it to later be called back" do
    class MyObject2
      include Flexirest::Recording
    end
    MyObject2.record_response do
      puts "Hello world"
    end
    expect(MyObject2.instance_variable_get(:@record_response)).to_not be_nil
  end

  it "calls back to the block if record_response is given a url and response" do
    class MyObject3
      include Flexirest::Recording
    end
    MyObject3.record_response do |url, response|
      raise Exception.new("#{url}|#{response}")
    end
    expect{MyObject3.record_response("http://www.example.com/", "Hello world")}.to raise_error(Exception, 'http://www.example.com/|Hello world')
  end
end

Version data entries

134 entries across 134 versions & 1 rubygems

Version Path
flexirest-1.10.1 spec/lib/recording_spec.rb
flexirest-1.10.0 spec/lib/recording_spec.rb
flexirest-1.9.18 spec/lib/recording_spec.rb
flexirest-1.9.17 spec/lib/recording_spec.rb
flexirest-1.9.16 spec/lib/recording_spec.rb
flexirest-1.9.15 spec/lib/recording_spec.rb
flexirest-1.9.14 spec/lib/recording_spec.rb
flexirest-1.9.13 spec/lib/recording_spec.rb
flexirest-1.9.12 spec/lib/recording_spec.rb
flexirest-1.9.11 spec/lib/recording_spec.rb
flexirest-1.9.10 spec/lib/recording_spec.rb
flexirest-1.8.9 spec/lib/recording_spec.rb
flexirest-1.8.8 spec/lib/recording_spec.rb
flexirest-1.8.7 spec/lib/recording_spec.rb
flexirest-1.8.6 spec/lib/recording_spec.rb
flexirest-1.8.5 spec/lib/recording_spec.rb
flexirest-1.8.4 spec/lib/recording_spec.rb
flexirest-1.8.3 spec/lib/recording_spec.rb
flexirest-1.8.2 spec/lib/recording_spec.rb
flexirest-1.8.1 spec/lib/recording_spec.rb