Sha256: e80bb6efc852e3e636d402d564e5ca611bbdce046ac41516b185fc79d70057d5

Contents?: true

Size: 403 Bytes

Versions: 25

Compression:

Stored size: 403 Bytes

Contents

class Boolean
  def self_as_an_object
    self
  end
end

describe "Opal truthyness" do
  it "should evaluate to true using js `true` as an object" do
    if true.self_as_an_object
      called = true
    end

    called.should be_true
  end

  it "should evaluate to false using js `false` as an object" do
    if false.self_as_an_object
      called = true
    end

    called.should be_nil
  end
end

Version data entries

25 entries across 25 versions & 3 rubygems

Version Path
opal-0.9.0 spec/opal/core/runtime/truthy_spec.rb
opal-0.9.0.rc1 spec/opal/core/runtime/truthy_spec.rb
opal-0.9.0.beta2 spec/opal/core/runtime/truthy_spec.rb
opal-0.9.0.beta1 spec/opal/core/runtime/truthy_spec.rb
opal-0.8.1 spec/opal/core/runtime/truthy_spec.rb
opal-0.8.1.rc1 spec/opal/core/runtime/truthy_spec.rb
opal-wedge-0.9.0.dev spec/opal/core/runtime/truthy_spec.rb
opal-0.8.0 spec/opal/core/runtime/truthy_spec.rb
opal-0.8.0.rc3 spec/opal/core/runtime/truthy_spec.rb
opal-0.8.0.rc2 spec/opal/core/runtime/truthy_spec.rb
opal-0.8.0.rc1 spec/opal/core/runtime/truthy_spec.rb
opal-0.8.0.beta1 spec/opal/core/runtime/truthy_spec.rb
opal-0.7.2 spec/opal/core/runtime/truthy_spec.rb
opal-0.7.1 spec/opal/core/runtime/truthy_spec.rb
opal-0.7.0 spec/opal/core/runtime/truthy_spec.rb
opal-0.7.0.rc1 spec/opal/core/runtime/truthy_spec.rb
opal-0.7.0.beta3 spec/opal/core/runtime/truthy_spec.rb
opal-0.6.3 spec/opal/core/runtime/truthy_spec.rb
opal-0.7.0.beta2 spec/opal/core/runtime/truthy_spec.rb
opal-cj-0.7.0.beta2 spec/opal/core/runtime/truthy_spec.rb