Sha256: ce9839bfae4ebfc433f9284f71a54b829a8c38568f3778fc046b8c55e697bcf0

Contents?: true

Size: 1.32 KB

Versions: 28

Compression:

Stored size: 1.32 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe Seam::Effort do
  before do
    Seam::Persistence.destroy
  end

  let(:flow) do
    f = Seam::Flow.new
    f.step1
    f.step2
    f
  end

  describe "updating an effort" do
    it "should not create another document in the collection" do
      first_effort = flow.start
      Seam::Persistence.all.count.must_equal 1
      first_effort.save
      Seam::Persistence.all.count.must_equal 1

      second_effort = flow.start
      Seam::Persistence.all.count.must_equal 2
      second_effort.save
      Seam::Persistence.all.count.must_equal 2
    end

    it "should update the information" do
      first_effort = flow.start
      second_effort = flow.start

      first_effort.next_step = 'i_changed_the_first_one'
      first_effort.save
      first_effort.to_hash.contrast_with! Seam::Effort.find(first_effort.id).to_hash, [:id, :created_at]
      second_effort.to_hash.contrast_with! Seam::Effort.find(second_effort.id).to_hash, [:id, :created_at]

      second_effort.next_step = 'i_changed_the_second_one'
      second_effort.save
      first_effort.to_hash.contrast_with! Seam::Effort.find(first_effort.id).to_hash, [:id, :created_at]
      second_effort.to_hash.contrast_with! Seam::Effort.find(second_effort.id).to_hash, [:id, :created_at]
    end
  end
end

Version data entries

28 entries across 28 versions & 3 rubygems

Version Path
seam-1.1.3 spec/seam/effort_spec.rb
seam-1.1.2 spec/seam/effort_spec.rb
seam-active_record-1.0.2 test_app/spec/seam/effort_spec.rb
seam-1.1.1 spec/seam/effort_spec.rb
seam-active_record-1.0.1 test_app/spec/seam/effort_spec.rb
seam-1.1.0 spec/seam/effort_spec.rb
seam-active_record-1.0.0 test_app/spec/seam/effort_spec.rb
seam-1.0.1 spec/seam/effort_spec.rb
seam-mongodb-1.0.0 spec/seam/effort_spec.rb
seam-1.0.0 spec/seam/effort_spec.rb
seam-mongodb-0.0.5 spec/seam/effort_spec.rb
seam-0.0.20 spec/seam/effort_spec.rb
seam-0.0.19 spec/seam/effort_spec.rb
seam-0.0.18 spec/seam/effort_spec.rb
seam-0.0.17 spec/seam/effort_spec.rb
seam-0.0.16 spec/seam/effort_spec.rb
seam-0.0.15 spec/seam/effort_spec.rb
seam-mongodb-0.0.4 spec/seam/effort_spec.rb
seam-mongodb-0.0.3 spec/seam/effort_spec.rb
seam-0.0.14 spec/seam/effort_spec.rb