Sha256: db3f747ed4b3afbe406300a62522b37131af134d8dc1fcd020698ca10ffb0483

Contents?: true

Size: 791 Bytes

Versions: 21

Compression:

Stored size: 791 Bytes

Contents

shared_examples_for 'a command' do
  describe '#name' do
    it 'returns relation name' do
      expect(command.name).to eql(command.relation.name)
    end
  end

  describe '#gateway' do
    it 'returns relation gateway' do
      expect(command.gateway).to eql(command.relation.gateway)
    end
  end

  describe '#method_missing' do
    it 'forwards to relation and wraps response if it returned another relation' do
      if command.class.restrictable
        new_command = command.by_id(1)

        expect(new_command).to be_instance_of(command.class)
        expect(new_command.relation).to eql(command.by_id(1).relation)
      end
    end

    it 'raises error when message is not known' do
      expect { command.not_here }.to raise_error(NoMethodError, /not_here/)
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
rom-3.3.3 spec/shared/command_behavior.rb
rom-3.3.2 spec/shared/command_behavior.rb
rom-3.3.1 spec/shared/command_behavior.rb
rom-3.3.0 spec/shared/command_behavior.rb
rom-3.2.3 spec/shared/command_behavior.rb
rom-3.2.2 spec/shared/command_behavior.rb
rom-3.2.1 spec/shared/command_behavior.rb
rom-3.2.0 spec/shared/command_behavior.rb
rom-3.1.0 spec/shared/command_behavior.rb
rom-3.0.3 spec/shared/command_behavior.rb
rom-3.0.2 spec/shared/command_behavior.rb
rom-3.0.1 spec/shared/command_behavior.rb
rom-3.0.0 spec/shared/command_behavior.rb
rom-3.0.0.rc2 spec/shared/command_behavior.rb
rom-3.0.0.rc1 spec/shared/command_behavior.rb
rom-3.0.0.beta3 spec/shared/command_behavior.rb
rom-3.0.0.beta2 spec/shared/command_behavior.rb
rom-3.0.0.beta1 spec/shared/command_behavior.rb
rom-2.0.2 spec/shared/command_behavior.rb
rom-2.0.1 spec/shared/command_behavior.rb