Sha256: 492c00a01017bf0bf40c68c19dbab37f893412705f7662add25533852ed66fa7

Contents?: true

Size: 677 Bytes

Versions: 3

Compression:

Stored size: 677 Bytes

Contents

require 'helper'

class TestSentientUser < Test::Unit::TestCase
  should "allow making the 'person' class sentient" do
    p = Person.new
    p.make_current
    assert_equal Person.current, p
  end
  
  should "allow making the 'user' class sentient" do
    u = User.new
    u.make_current
    assert_equal User.current, u
  end
  
  should "not allow making Person.current a user" do
    assert_raise ArgumentError do
      Person.current = User.new
    end
  end
  
  should "allow making person.current a person" do
    Person.current = Person.new
  end
  
  should "allow subclasses of user to be assigned to user.current" do
    User.current = AnonymousUser.new
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sentient_user-0.3.1 test/test_sentient_user.rb
sentient_user-0.3.0 test/test_sentient_user.rb
sentient_user-0.2.0 test/test_sentient_user.rb