Sha256: fe9d44120c5b6cdd8d4f5c08d1ff02c3133bb4c85e99a376b5ee382a5d9f104a

Contents?: true

Size: 1.38 KB

Versions: 6

Compression:

Stored size: 1.38 KB

Contents

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

describe Seam::Effort do
  before do
    test_moped_session['efforts'].drop
  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
      test_moped_session['efforts'].find.count.must_equal 1
      first_effort.save
      test_moped_session['efforts'].find.count.must_equal 1

      second_effort = flow.start
      test_moped_session['efforts'].find.count.must_equal 2
      second_effort.save
      test_moped_session['efforts'].find.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

6 entries across 6 versions & 1 rubygems

Version Path
seam-0.0.6 spec/seam/effort_spec.rb
seam-0.0.5 spec/seam/effort_spec.rb
seam-0.0.4 spec/seam/effort_spec.rb
seam-0.0.3 spec/seam/effort_spec.rb
seam-0.0.2 spec/seam/effort_spec.rb
seam-0.0.1 spec/seam/effort_spec.rb