Sha256: f94b230a6cbcf2363f50cc6253a10bffcb4450450f2a70425c442c3940ec0c69

Contents?: true

Size: 1.22 KB

Versions: 23

Compression:

Stored size: 1.22 KB

Contents

require 'volt/models'

describe ReactiveValue do
  it "should concat reactive strings" do
    a = ReactiveValue.new('cool')
    b = ReactiveValue.new('beans')

    c = a + b
    expect(c.cur).to eq('coolbeans')
    expect(c.reactive?).to eq(true)
  end

  it "should concat reactive and non-reactive" do
    a = ReactiveValue.new('cool')
    b = 'beans'

    c = a + b
    expect(c.cur).to eq('coolbeans')
    expect(c.reactive?).to eq(true)
  end

  it "should concat non-reactive and reactive" do
    a = 'cool'
    b = ReactiveValue.new('beans')

    c = a + b
    expect(c.cur).to eq('coolbeans')
    expect(c.reactive?).to eq(true)
  end

  if RUBY_PLATFORM != 'opal'
    it "should append reactive to reactive" do
      a = ReactiveValue.new('cool')
      b = ReactiveValue.new('beans')

      a << b
      expect(a.cur).to eq('coolbeans')
      expect(a.reactive?).to eq(true)
    end
  end

  it "should raise an exception when appending  non-reactive and reactive" do
    a = 'cool'
    b = ReactiveValue.new('beans')

    exception_count = 0
    begin
      a << b
    rescue => e
      expect(e.message[/Cannot append a reactive/].cur.true?).to eq(true)
      exception_count += 1
    end

    expect(exception_count).to eq(1)
  end

end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
volt-0.7.23 spec/models/string_extensions_spec.rb
volt-0.7.22 spec/models/string_extensions_spec.rb
volt-0.7.21 spec/models/string_extensions_spec.rb
volt-0.7.20 spec/models/string_extensions_spec.rb
volt-0.7.19 spec/models/string_extensions_spec.rb
volt-0.7.18 spec/models/string_extensions_spec.rb
volt-0.7.17 spec/models/string_extensions_spec.rb
volt-0.7.16 spec/models/string_extensions_spec.rb
volt-0.7.15 spec/models/string_extensions_spec.rb
volt-0.7.14 spec/models/string_extensions_spec.rb
volt-0.7.13 spec/models/string_extensions_spec.rb
volt-0.7.12 spec/models/string_extensions_spec.rb
volt-0.7.10 spec/models/string_extensions_spec.rb
volt-0.7.9 spec/models/string_extensions_spec.rb
volt-0.7.8 spec/models/string_extensions_spec.rb
volt-0.7.7 spec/models/string_extensions_spec.rb
volt-0.7.6 spec/models/string_extensions_spec.rb
volt-0.7.5 spec/models/string_extensions_spec.rb
volt-0.7.4 spec/models/string_extensions_spec.rb
volt-0.7.3 spec/models/string_extensions_spec.rb