Sha256: 64dff5c683300176f713f110fbe171e6a05b7ca27ad1b0cd562f1326d90ee470

Contents?: true

Size: 897 Bytes

Versions: 20

Compression:

Stored size: 897 Bytes

Contents

require 'spec_helper'

describe ROM::Registry do
  subject(:registry) { registry_class.new(mars: mars) }

  let(:mars) { double('mars') }

  let(:registry_class) do
    Class.new(ROM::Registry) do
      def self.name
        'Candy'
      end
    end
  end

  describe '#fetch' do
    it 'returns registered elemented identified by name' do
      expect(registry[:mars]).to be(mars)
    end

    it 'raises error when element is not found' do
      expect { registry[:twix] }.to raise_error(
        ROM::Registry::ElementNotFoundError,
        ":twix doesn't exist in Candy registry"
      )
    end
  end

  describe '.element_name' do
    it 'returns registered elemented identified by element_name' do
      expect(registry[:mars]).to be(mars)
    end

    it 'raises no-method error when element is not there' do
      expect { registry.twix }.to raise_error(NoMethodError)
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
rom-1.0.0 spec/unit/rom/registry_spec.rb
rom-1.0.0.rc1 spec/unit/rom/registry_spec.rb
rom-1.0.0.beta2 spec/unit/rom/registry_spec.rb
rom-1.0.0.beta1 spec/unit/rom/registry_spec.rb
rom-0.9.1 spec/unit/rom/registry_spec.rb
rom-0.9.0 spec/unit/rom/registry_spec.rb
rom-0.9.0.rc1 spec/unit/rom/registry_spec.rb
rom-0.9.0.beta1 spec/unit/rom/registry_spec.rb
rom-0.8.1 spec/unit/rom/registry_spec.rb
rom-0.8.0 spec/unit/rom/registry_spec.rb
rom-0.7.1 spec/unit/rom/registry_spec.rb
rom-0.7.0 spec/unit/rom/registry_spec.rb
rom-0.6.2 spec/unit/rom/registry_spec.rb
rom-0.6.1 spec/unit/rom/registry_spec.rb
rom-0.6.0 spec/unit/rom/registry_spec.rb
rom-0.6.0.rc1 spec/unit/rom/registry_spec.rb
rom-0.6.0.beta3 spec/unit/rom/registry_spec.rb
rom-0.6.0.beta2 spec/unit/rom/registry_spec.rb
rom-0.6.0.beta1 spec/unit/rom/registry_spec.rb
rom-0.5.0 spec/unit/rom/registry_spec.rb