Sha256: d183e1aff21be2677ce9f438d0a9ba2f7ba9f6e8c40a25369ae1295d92762214

Contents?: true

Size: 589 Bytes

Versions: 3

Compression:

Stored size: 589 Bytes

Contents

require 'spec_helper'

describe Http::Options do

  let(:options){ Http::Options.new(:response => :body) }

  it 'behaves like a Hash for reading' do
    options[:response].should eq(:body)
    options[:nosuchone].should be_nil
  end

  it 'is able to coerce to a Hash' do
    options.to_hash.should be_a(Hash)
    options.to_hash[:response].should eq(:body)
  end

  it 'is stacktrace friendly' do
    begin
      options.with_response(:notrecognized)
      true.should be_false
    rescue ArgumentError => ex
      puts ex.backtrace.first.should match(/options_spec/)
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
http-0.4.0 spec/http/options_spec.rb
http-0.3.0 spec/http/options_spec.rb
http-0.2.0 spec/http/options_spec.rb