Sha256: 6e9164ece97120849f2be10cb3b7c8e7f8e2e49c30ee2caf76cfa56893773bbc

Contents?: true

Size: 1.37 KB

Versions: 10

Compression:

Stored size: 1.37 KB

Contents

require 'spec_helper'
require 'simple_command'

describe 'Mutations - inheritance' do

  class SimpleInherited < SimpleCommand

    required do
      integer :age
    end

    def execute
      inputs
    end
  end

  it 'should filter with inherited command' do
    mutation = SimpleInherited.run(:name => "bob", :email => "jon@jones.com", :age => 10, :amount => 22)
    assert mutation.success?
    assert_equal HashWithIndifferentAccess.new(:name => "bob", :email => "jon@jones.com", :age => 10, :amount => 22), mutation.result
  end

  it 'should filter with original command' do
    mutation = SimpleCommand.run(:name => "bob", :email => "jon@jones.com", :age => 10, :amount => 22)
    assert mutation.success?
    assert_equal HashWithIndifferentAccess.new(:name => "bob", :email => "jon@jones.com", :amount => 22), mutation.result
  end

  it 'shouldnt collide' do
    mutation = SimpleInherited.run(:name => "bob", :email => "jon@jones.com", :age => 10, :amount => 22)
    assert mutation.success?
    assert_equal HashWithIndifferentAccess.new(:name => "bob", :email => "jon@jones.com", :age => 10, :amount => 22), mutation.result

    mutation = SimpleCommand.run(:name => "bob", :email => "jon@jones.com", :age => 10, :amount => 22)
    assert mutation.success?
    assert_equal HashWithIndifferentAccess.new(:name => "bob", :email => "jon@jones.com", :amount => 22), mutation.result
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
mutations-0.9.1 spec/inheritance_spec.rb
mutations-0.9.0 spec/inheritance_spec.rb
mutations-0.8.3 spec/inheritance_spec.rb
mutations-0.8.2 spec/inheritance_spec.rb
mutations-0.8.1 spec/inheritance_spec.rb
mutations-0.8.0 spec/inheritance_spec.rb
mutations-0.7.2 spec/inheritance_spec.rb
mutations-0.7.1 spec/inheritance_spec.rb
mutations-0.7.0 spec/inheritance_spec.rb
mutations-0.6.0 spec/inheritance_spec.rb