Sha256: 7d14b46c56be08f227bb7340aa563c0b68d00254baf95215da0d212b2430df50

Contents?: true

Size: 922 Bytes

Versions: 7

Compression:

Stored size: 922 Bytes

Contents

require 'volt/controllers/reactive_accessors'

class TestReactiveAccessors
  include ReactiveAccessors

  reactive_accessor :_name
end

describe ReactiveAccessors do
  it "should return the same reactive value after each read" do
    inst = TestReactiveAccessors.new

    expect(inst._name.reactive_manager.object_id).to eq(inst._name.reactive_manager.object_id)
  end

  it "should assign a reactive value" do
    inst = TestReactiveAccessors.new

    inst._name = 'Ryan'
    expect(inst._name).to eq('Ryan')
  end

  it "should start nil" do
    inst = TestReactiveAccessors.new

    expect(inst._name.cur).to eq(nil)
  end

  it "should keep the same reactive value when reassigning" do
    inst = TestReactiveAccessors.new

    inst._name = 'Ryan'
    rv1_id = inst._name.reactive_manager.object_id

    inst._name = 'Jim'
    rv2_id = inst._name.reactive_manager.object_id

    expect(rv1_id).to eq(rv2_id)
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
volt-0.7.20 spec/controllers/reactive_accessors_spec.rb
volt-0.7.19 spec/controllers/reactive_accessors_spec.rb
volt-0.7.18 spec/controllers/reactive_accessors_spec.rb
volt-0.7.17 spec/controllers/reactive_accessors_spec.rb
volt-0.7.16 spec/controllers/reactive_accessors_spec.rb
volt-0.7.15 spec/controllers/reactive_accessors_spec.rb
volt-0.7.14 spec/controllers/reactive_accessors_spec.rb