Sha256: 378632411e660b51686c9dba312042f2e82d4825920214905d24f74415738953

Contents?: true

Size: 590 Bytes

Versions: 4

Compression:

Stored size: 590 Bytes

Contents

require 'helper'

describe Twitter::Base do
  before do
    @base = Twitter::Base.new(:id => 1)
  end

  describe "#[]" do
    it "calls methods using [] with symbol" do
      expect(@base[:object_id]).to be_an Integer
    end
    it "calls methods using [] with string" do
      expect(@base["object_id"]).to be_an Integer
    end
    it "returns nil for missing method" do
      expect(@base[:foo]).to be_nil
      expect(@base["foo"]).to be_nil
    end
  end

  describe "#attrs" do
    it "returns a hash of attributes" do
      expect(@base.attrs).to eq({:id => 1})
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
twitter-5.1.1 spec/twitter/base_spec.rb
twitter-5.1.0 spec/twitter/base_spec.rb
twitter-5.0.1 spec/twitter/base_spec.rb
twitter-5.0.0 spec/twitter/base_spec.rb