Sha256: 55b0c2edb8ae9ed9b6dace463b8d65762c8071534014824abb8ee600744606eb

Contents?: true

Size: 644 Bytes

Versions: 5

Compression:

Stored size: 644 Bytes

Contents

require 'spec_helper'

describe Capgun::Base do

  before do
    @base = Capgun::Base.new('id' => 1)
  end

  describe "#[]" do
    it "should be able to call methods using [] with symbol" do
      @base[:object_id].should be_an Integer
    end
    it "should be able to call methods using [] with string" do
      @base['object_id'].should be_an Integer
    end
    it "should return nil for missing method" do
      @base[:foo].should be_nil
      @base['foo'].should be_nil
    end
  end

  describe "#to_hash" do
    it "should return a hash" do
      @base.to_hash.should be_a Hash
      @base.to_hash['id'].should == 1
    end
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
capgun-0.2.0 spec/capgun/base_spec.rb
capgun-0.1.2 spec/capgun/base_spec.rb
capgun-0.1.1 spec/capgun/base_spec.rb
capgun-0.1.0 spec/capgun/base_spec.rb
capgun-0.0.3 spec/capgun/base_spec.rb