Sha256: 75f2f1c86f8b219ac3d5b191a97fbe4305e0bd29a85855185d3b595dd82fe5ff

Contents?: true

Size: 587 Bytes

Versions: 3

Compression:

Stored size: 587 Bytes

Contents

require_relative "helper"

require_relative "../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

3 entries across 3 versions & 1 rubygems

Version Path
glimmer-0.1.5.470 test/observable_model_test.rb
glimmer-0.1.4.470 test/observable_model_test.rb
glimmer-0.1.4.swt.pre.4.7.0 test/observable_model_test.rb