Sha256: cb9977896e825f05c2e22aeade357c0d75acaa918950ddb842f395d66b943085

Contents?: true

Size: 621 Bytes

Versions: 2

Compression:

Stored size: 621 Bytes

Contents

require File.dirname(__FILE__) + "/helper"

require File.dirname(__FILE__) + "/../lib/command_handlers/models/observable_model"

require "test/unit"
class ObservableModelTest < Test::Unit::TestCase
  class Person 
    attr_accessor :name
  end

  def test_observe_model
    person = Person.new
    person.name = "Marty"
    assert_equal "Marty", person.name
    person.extend ObservableModel
    person.add_observer(:name, self)
    person.name = "Julia"
    assert_equal "Julia", @observed_name
    assert_equal "Julia", person.name
  end
  
  def update(name)
    @observed_name = name
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
glimmer-0.1.3 test/observable_model_test.rb
glimmer-0.1.2 test/observable_model_test.rb