Sha256: 55d7e90ef0157fab198fdfcc9eb1c29ea79edc732021fa0678a34ec868824c3c

Contents?: true

Size: 600 Bytes

Versions: 10

Compression:

Stored size: 600 Bytes

Contents

shared_examples_for 'a command' do
  describe '#method_missing' do
    it 'forwards to relation and wraps response if it returned another relation' do
      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

    it 'returns original response if it was not a relation' do
      expect(command.name).to eql(command.relation.name)
    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

10 entries across 10 versions & 1 rubygems

Version Path
rom-1.0.0 spec/shared/command_behavior.rb
rom-1.0.0.rc1 spec/shared/command_behavior.rb
rom-1.0.0.beta2 spec/shared/command_behavior.rb
rom-1.0.0.beta1 spec/shared/command_behavior.rb
rom-0.9.1 spec/shared/command_behavior.rb
rom-0.9.0 spec/shared/command_behavior.rb
rom-0.9.0.rc1 spec/shared/command_behavior.rb
rom-0.9.0.beta1 spec/shared/command_behavior.rb
rom-0.8.1 spec/shared/command_behavior.rb
rom-0.8.0 spec/shared/command_behavior.rb