Sha256: 0b3970245d23744e9b694201ac2e304a24475f60b19d98d4ac008a3788e4bf29

Contents?: true

Size: 789 Bytes

Versions: 2

Compression:

Stored size: 789 Bytes

Contents

describe "Walt::Operation" do
  it "should return proper subclass for :type" do
    o = Walt::Operation.for({type: :move})
    o.is_a?(Walt::Operation::MoveOperation).should == true

    o = Walt::Operation.for({type: :fade})
    o.is_a?(Walt::Operation::FadeOperation).should == true

    Walt::Operation.operation_types.each do |op|
      string = "#{op.to_s.downcase}_operation".camelize
      klass = Walt::Operation.const_get(string)

      o = Walt::Operation.for({op => :blue})
      o.is_a?(klass).should == true
      o.id.should == :blue
    end
  end

  it "should have nested attributes" do
    o = Walt::Operation.for(type: :move, id: :herp, from: 0, to: 10)
    o.type.should == :move
    o.id.should == :herp
    o.from.should.not == nil
    o.to.should.not == nil
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
walt-0.1.2 spec/operation_spec.rb
walt-0.1 spec/operation_spec.rb