Sha256: 9b1c7e1a6bf0c2e4e00e424dacc197438b39e64c64ad52592beeeb1a0d46a5b5

Contents?: true

Size: 1015 Bytes

Versions: 7

Compression:

Stored size: 1015 Bytes

Contents

require 'spec_helper'

use_case "reading and writting enums" do

  async "can change the enum and read it back" do
    React::IsomorphicHelpers.load_context
    set_acting_user "super-user"
    user = User.find(1)
    user.test_enum = :no
    user.save.then do
      React::IsomorphicHelpers.load_context
      ReactiveRecord.load do
        User.find(1).test_enum
      end.then do |test_enum|
        async { expect(test_enum).to eq(:no) }
      end
    end
  end

  async "can set it back" do
    React::IsomorphicHelpers.load_context
    set_acting_user "super-user"
    user = User.find(1)
    user.test_enum = :yes
    user.save.then do
      React::IsomorphicHelpers.load_context
      ReactiveRecord.load do
        User.find(1).test_enum
      end.then do |test_enum|
        async { expect(test_enum).to eq(:yes) }
      end
    end
  end

  it "can change it back" do
    user = User.find(1)
    user.test_enum = :yes
    user.save.then do |success|
      expect(success).to be_truthy
    end
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
hyper-mesh-0.6.0 reactive_record_test_app/spec-opal/active-record/enum_spec.rb
hyper-mesh-0.5.4 reactive_record_test_app/spec-opal/active-record/enum_spec.rb
hyper-mesh-0.5.3 reactive_record_test_app/spec-opal/active-record/enum_spec.rb
hyper-mesh-0.5.2 reactive_record_test_app/spec-opal/active-record/enum_spec.rb
hyper-mesh-0.5.1 reactive_record_test_app/spec-opal/active-record/enum_spec.rb
hyper-mesh-0.5.0 reactive_record_test_app/spec-opal/active-record/enum_spec.rb
hyper-mesh-0.4.0 reactive_record_test_app/spec-opal/active-record/enum_spec.rb