Sha256: af419f9628547b99c94b56a3a839944d19c1522b18bc338752fc3fc4ea5cf5dc

Contents?: true

Size: 731 Bytes

Versions: 9

Compression:

Stored size: 731 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(volt_app)

      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(volt_app)

      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

9 entries across 9 versions & 1 rubygems

Version Path
volt-0.9.4.pre3 spec/controllers/model_controller_spec.rb
volt-0.9.4.pre2 spec/controllers/model_controller_spec.rb
volt-0.9.4.pre1 spec/controllers/model_controller_spec.rb
volt-0.9.3 spec/controllers/model_controller_spec.rb
volt-0.9.3.pre6 spec/controllers/model_controller_spec.rb
volt-0.9.3.pre5 spec/controllers/model_controller_spec.rb
volt-0.9.3.pre4 spec/controllers/model_controller_spec.rb
volt-0.9.3.pre3 spec/controllers/model_controller_spec.rb
volt-0.9.3.pre2 spec/controllers/model_controller_spec.rb