Sha256: dd7e5f15ce36977299c497ca0ab10d3dad92c6d4ff3aa2c7918c9a61132c99c9

Contents?: true

Size: 953 Bytes

Versions: 17

Compression:

Stored size: 953 Bytes

Contents

# encoding: utf-8
require 'spec_helper'

describe Encoder do
  class MyEncoder < Encoder; end

  module MyModule
    class MyEncoder < Encoder; end
  end

  context '#name' do
    it 'returns name' do
      expect(MyEncoder.new.name).to eq(:my_encoder)
    end
    
    it 'returns demodularized name' do
      expect(MyModule::MyEncoder.new.name).to eq(:my_encoder)
    end
  end

  context '#name?' do
    it 'checks name' do
      expect(MyEncoder.new.name?(MyEncoder.new.name)).to be_true
    end
  end

  context '#hash' do
    it 'generates a hash for name' do
      expect(MyEncoder.new.hash.to_s.size).to eq(40)
    end
  end

  context '#eql?' do
    it 'compares instances for hash' do
      e1 = MyEncoder.new
      e2 = MyEncoder.new
      expect(e1.eql? e2).to be_true
    end
  end

  context '#==' do
    it 'understands equality' do
      e1 = MyEncoder.new
      e2 = MyEncoder.new
      expect(e1 == e2).to be_true
    end
  end


end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
test_server-0.4.1 spec/encoder_spec.rb
test_server-0.4.0 spec/encoder_spec.rb
test_server-0.3.7 spec/encoder_spec.rb
test_server-0.3.6 spec/encoder_spec.rb
test_server-0.3.5 spec/encoder_spec.rb
test_server-0.3.4 spec/encoder_spec.rb
test_server-0.3.2 spec/encoder_spec.rb
test_server-0.3.1 spec/encoder_spec.rb
test_server-0.2.4 spec/encoder_spec.rb
test_server-0.2.3 spec/encoder_spec.rb
test_server-0.2.2 spec/encoder_spec.rb
test_server-0.2.1 spec/encoder_spec.rb
test_server-0.2.0 spec/encoder_spec.rb
test_server-0.1.2 spec/encoder_spec.rb
test_server-0.1.1 spec/encoder_spec.rb
test_server-0.1.0 spec/encoder_spec.rb
test_server-0.0.11 spec/encoder_spec.rb