Sha256: efbe08ffb80148cb928979571f87027940690163d69fcb5a5e54f7c868505a0d

Contents?: true

Size: 710 Bytes

Versions: 10

Compression:

Stored size: 710 Bytes

Contents

require 'spec_helper'

if RUBY_PLATFORM != 'opal'
  describe Volt::ModelController do
    it 'should accept a promise as a model and resolve it' do
      controller = Volt::ModelController.new

      promise = Promise.new

      controller.model = promise

      expect(controller.model).to eq(nil)

      promise.resolve(20)

      expect(controller.model).to eq(20)
    end

    it 'should not return true from loaded until the promise is resolved' do
      controller = Volt::ModelController.new

      promise = Promise.new
      controller.model = promise

      expect(controller.loaded?).to eq(false)

      promise.resolve(Volt::Model.new)
      expect(controller.loaded?).to eq(true)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
volt-0.9.1 spec/controllers/model_controller_spec.rb
volt-0.9.1.pre5 spec/controllers/model_controller_spec.rb
volt-0.9.1.pre4 spec/controllers/model_controller_spec.rb
volt-0.9.1.pre3 spec/controllers/model_controller_spec.rb
volt-0.9.1.pre2 spec/controllers/model_controller_spec.rb
volt-0.9.1.pre1 spec/controllers/model_controller_spec.rb
volt-0.9.0 spec/controllers/model_controller_spec.rb
volt-0.9.0.pre7 spec/controllers/model_controller_spec.rb
volt-0.9.0.pre6 spec/controllers/model_controller_spec.rb
volt-0.9.0.pre5 spec/controllers/model_controller_spec.rb