Sha256: 629c0f982e3e541a781c655664f739f6517dc9fae9ae09b023873f61f9c9530b

Contents?: true

Size: 1.04 KB

Versions: 20

Compression:

Stored size: 1.04 KB

Contents

require "helper"

class TestOhmBoundaries < Test::Unit::TestCase
  setup do
    Ohm.flush
  end

  class Person < Ohm::Model
    include Ohm::Boundaries

    attribute :name
  end

  context "when there are no People" do
    should "have a nil Person.first" do
      assert_nil Person.first
    end

    should "have a nil Person.last" do
      assert_nil Person.last
    end
  end

  context "after creating a single Person named matz" do
    setup do
      @matz = Person.create(:name => "matz")
    end

    should "have matz as the first person" do
      assert_equal @matz, Person.first
    end

    should "have matz as the last person" do
      assert_equal @matz, Person.last
    end
  end

  context "after creating matz first then linus next" do
    setup do
      @matz  = Person.create(:name => "matz")
      @linus = Person.create(:name => "linus")
    end

    should "have matz as the first Person" do
      assert_equal @matz, Person.first
    end

    should "have linus as the last Person" do
      assert_equal @linus, Person.last
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
ohm-contrib-0.0.24 test/test_ohm_boundaries.rb
ohm-contrib-0.0.23 test/test_ohm_boundaries.rb
ohm-contrib-0.0.22 test/test_ohm_boundaries.rb
ohm-contrib-0.0.21 test/test_ohm_boundaries.rb
ohm-contrib-0.0.20 test/test_ohm_boundaries.rb
ohm-contrib-0.0.19 test/test_ohm_boundaries.rb
ohm-contrib-0.0.18 test/test_ohm_boundaries.rb
ohm-contrib-0.0.17 test/test_ohm_boundaries.rb
ohm-contrib-0.0.16 test/test_ohm_boundaries.rb
ohm-contrib-0.0.15 test/test_ohm_boundaries.rb
ohm-contrib-0.0.14 test/test_ohm_boundaries.rb
ohm-contrib-0.0.13 test/test_ohm_boundaries.rb
ohm-contrib-0.0.12 test/test_ohm_boundaries.rb
ohm-contrib-0.0.11 test/test_ohm_boundaries.rb
ohm-contrib-0.0.10 test/test_ohm_boundaries.rb
ohm-contrib-0.0.9 test/test_ohm_boundaries.rb
ohm-contrib-0.0.8 test/test_ohm_boundaries.rb
ohm-contrib-0.0.7 test/test_ohm_boundaries.rb
ohm-contrib-0.0.6 test/test_ohm_boundaries.rb
ohm-contrib-0.0.5 test/test_ohm_boundaries.rb