Sha256: 64aa325a6cdfca435bdd3478736eada3cc137b793eef8bd13866e6b2342e9b25

Contents?: true

Size: 1.25 KB

Versions: 14

Compression:

Stored size: 1.25 KB

Contents

require "spec_helper"


describe ActiveMetadata::History do

  describe "#value" do

    before do
      @h1 = ActiveMetadata::History.create! model_class: "Document", label: "name", value: "nome"
      @h2 = ActiveMetadata::History.create! model_class: "Document", label: "keep_alive", value: true
      @h3 = ActiveMetadata::History.create! model_class: "Document", label: "date", value: Time.now
      @h4 = ActiveMetadata::History.create! model_class: "Document", label: "price", value: 10.12
      @h5 = ActiveMetadata::History.create! model_class: "Document", label: "average", value: 10.123
      @h6 = ActiveMetadata::History.create! model_class: "Document", label: "does_not_exists", value: "pippo"
      @h7 = ActiveMetadata::History.create! model_class: "Document", label: "keep_alive", value: nil
    end

    specify{ @h1.value.should eq "nome" }
    specify{ @h2.value.should eq true }
    specify{ @h3.value.should be_kind_of ActiveSupport::TimeWithZone }
    specify{ @h4.value.should be_kind_of BigDecimal }
    specify{ @h4.value.to_s.should eq "10.12" }
    specify{ @h5.value.should be_kind_of BigDecimal }
    specify{ @h5.value.to_s.should eq "10.123" }
    specify{ @h6.value.to_s.should eq "pippo" }
    specify{ @h7.value.should eq nil }

  end
  
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
active_metadata-0.8.9 spec/models/history_spec.rb
active_metadata-0.8.8 spec/models/history_spec.rb
active_metadata-0.8.7.1 spec/models/history_spec.rb
active_metadata-0.8.7 spec/models/history_spec.rb
active_metadata-0.8.6 spec/models/history_spec.rb
active_metadata-0.8.5.2 spec/models/history_spec.rb
active_metadata-0.8.5.1 spec/models/history_spec.rb
active_metadata-0.8.5 spec/models/history_spec.rb
active_metadata-0.8.4 spec/models/history_spec.rb
active_metadata-0.8.3.1 spec/models/history_spec.rb
active_metadata-0.8.3 spec/models/history_spec.rb
active_metadata-0.8.2 spec/models/history_spec.rb
active_metadata-0.8.1 spec/models/history_spec.rb
active_metadata-0.8.0 spec/models/history_spec.rb