Sha256: c83ecc170e57ba26e1574eff6b94b7c0dd4ea2e6b52f07b4ac069e83191b8c8d

Contents?: true

Size: 909 Bytes

Versions: 13

Compression:

Stored size: 909 Bytes

Contents

require 'spec_helper'

describe SimpleService::ValidatesCommandsProperlyInherit do

  class ValidDummyCommand < SimpleService::Command
    def call; true; end
  end

  class InvalidDummyCommand
    def call; true; end
  end

  context '#call' do
    it 'raises error when commands do not inherit from SimpleService::Command' do
      expect {
        SimpleService::ValidatesCommandsProperlyInherit.new(
          provided_commands: [InvalidDummyCommand]
        ).call
      }.to raise_error(
        SimpleService::CommandParentClassInvalidError,
        'InvalidDummyCommand - must inherit from SimpleService::Command'
      )
    end

    it 'does not raises error when commands inherit from SimpleService::Command' do
      expect {
        SimpleService::ValidatesCommandsProperlyInherit.new(
          provided_commands: [ValidDummyCommand]
        ).call
      }.to_not raise_error
    end
  end

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
simple_service-1.4.1 spec/lib/commands/validates_commands_properly_inherit_spec.rb
simple_service-1.4.0 spec/lib/commands/validates_commands_properly_inherit_spec.rb
simple_service-1.3.91 spec/lib/commands/validates_commands_properly_inherit_spec.rb
simple_service-1.3.9 spec/lib/commands/validates_commands_properly_inherit_spec.rb
simple_service-1.3.8 spec/lib/commands/validates_commands_properly_inherit_spec.rb
simple_service-1.3.5 spec/lib/commands/validates_commands_properly_inherit_spec.rb
simple_service-1.3.4 spec/lib/commands/validates_commands_properly_inherit_spec.rb
simple_service-1.3.3 spec/lib/commands/validates_commands_properly_inherit_spec.rb
simple_service-1.3.2 spec/lib/commands/validates_commands_properly_inherit_spec.rb
simple_service-1.3.1 spec/lib/commands/validates_commands_properly_inherit_spec.rb
simple_service-1.3.0 spec/lib/commands/validates_commands_properly_inherit_spec.rb
simple_service-1.2.6 spec/lib/commands/validates_commands_properly_inherit_spec.rb
simple_service-1.2.5 spec/lib/commands/validates_commands_properly_inherit_spec.rb