Sha256: 0f603b23b27e81d0f892ff74f217dc4822f9f8e99551c51293520a4a825e79b1

Contents?: true

Size: 420 Bytes

Versions: 49

Compression:

Stored size: 420 Bytes

Contents

require 'spec_helper'

describe "Mass assignment" do
  it "supports setting attributes on lhs" do
    object = Class.new { attr_accessor :foo, :bar }.new

    object.foo, object.bar = 100, 200

    object.foo.should == 100
    object.bar.should == 200
  end

  it "supports setting []= on lhs" do
    hash = {}
    hash[:foo], hash[:bar] = 3.142, 42

    hash[:foo].should == 3.142
    hash[:bar].should == 42
  end
end

Version data entries

49 entries across 49 versions & 3 rubygems

Version Path
opal-0.10.6 spec/opal/core/runtime/variables_spec.rb
opal-0.10.6.beta spec/opal/core/runtime/variables_spec.rb
opal-0.10.5 spec/opal/core/runtime/variables_spec.rb
opal-0.10.4 spec/opal/core/runtime/variables_spec.rb
opal-0.11.0.rc1 spec/opal/core/runtime/variables_spec.rb
opal-0.10.3 spec/opal/core/runtime/variables_spec.rb
opal-0.10.2 spec/opal/core/runtime/variables_spec.rb
opal-0.10.1 spec/opal/core/runtime/variables_spec.rb
opal-0.10.0 spec/opal/core/runtime/variables_spec.rb
opal-0.10.0.rc2 spec/opal/core/runtime/variables_spec.rb
opal-0.9.4 spec/opal/core/runtime/variables_spec.rb
opal-0.9.3 spec/opal/core/runtime/variables_spec.rb
opal-0.10.0.rc1 spec/opal/core/runtime/variables_spec.rb
opal-0.10.0.beta5 spec/opal/core/runtime/variables_spec.rb
opal-0.10.0.beta4 spec/opal/core/runtime/variables_spec.rb
opal-0.10.0.beta3 spec/opal/core/runtime/variables_spec.rb
opal-0.10.0.beta2 spec/opal/core/runtime/variables_spec.rb
opal-0.10.0.beta1 spec/opal/core/runtime/variables_spec.rb
opal-0.9.2 spec/opal/core/runtime/variables_spec.rb
opal-0.9.0 spec/opal/core/runtime/variables_spec.rb