Sha256: b1914102fc0efcaccb9a85d781ee874570b2bb64840873c1e7d15fd8c1ce0fd0

Contents?: true

Size: 1.33 KB

Versions: 3

Compression:

Stored size: 1.33 KB

Contents

require 'spec_helper'

describe Capgun::Order do

  describe "#==" do
    it "should return true when ids and classes are equal" do
      order = Capgun::Order.new('id' => 1)
      other = Capgun::Order.new('id' => 1)
      (order == other).should be_true
    end
    it "should return false when classes are not equal" do
      order = Capgun::Order.new('id' => 1)
      other = Capgun::Job.new('id' => 1)
      (order == other).should be_false
    end
    it "should return false when ids are not equal" do
      order = Capgun::Order.new('id' => 1)
      other = Capgun::Order.new('id' => 2)
      (order == other).should be_false
    end
  end

  describe "#created_at" do
    it "should return a Time when created_at is set" do
      order = Capgun::Order.new('created_at' => "Mon Jul 16 12:59:01 +0000.1.17")
      order.created_at.should be_a Time
    end
    it "should return nil when created_at is not set" do
      order = Capgun::Order.new
      order.created_at.should be_nil
    end
  end

  describe "#updated_at" do
    it "should return a Time when updated_at is set" do
      order = Capgun::Order.new('updated_at' => "Mon Jul 16 12:59:01 +0000.1.17")
      order.updated_at.should be_a Time
    end
    it "should return nil when updated_at is not set" do
      order = Capgun::Order.new
      order.updated_at.should be_nil
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
capgun-0.2.0 spec/capgun/order_spec.rb
capgun-0.1.2 spec/capgun/order_spec.rb
capgun-0.1.1 spec/capgun/order_spec.rb