Sha256: 181c80d10916570771bd2f695827c7b7f84aae87476296949153a1ac08bdfa6b

Contents?: true

Size: 425 Bytes

Versions: 26

Compression:

Stored size: 425 Bytes

Contents

def def_test_bar
  42
end

def self.def_test_foo
  "bar"
end

$top_level_object = self

describe "Defining top level methods" do
  it "should work with def self.x" do
    $top_level_object.def_test_foo.should == "bar"
  end

  it "should work with def x" do
    $top_level_object.def_test_bar.should == 42
  end

  it "defines methods on singleton class" do
    Object.new.respond_to?(:def_test_bar).should == false
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
opal-0.4.1 spec/opal/runtime2/def_spec.rb
opal-0.4.0 spec/opal/runtime2/def_spec.rb
opal-0.3.44 spec/rubyspec/core/runtime/def_spec.rb
opal-0.3.43 spec/rubyspec/core/runtime/def_spec.rb
opal-0.3.42 spec/core/runtime/def_spec.rb
opal-0.3.41 spec/core/runtime/def_spec.rb
opal-0.3.40 spec/core/runtime/def_spec.rb
opal-0.3.39 spec/core/runtime/def_spec.rb
opal-0.3.38 spec/core/runtime/def_spec.rb
opal-0.3.37 spec/core/runtime/def_spec.rb
opal-0.3.36 spec/core/runtime/def_spec.rb
opal-0.3.35 spec/core/runtime/def_spec.rb
opal-0.3.34 spec/core/runtime/def_spec.rb
opal-0.3.33 spec/core/runtime/def_spec.rb
opal-0.3.32 spec/core/runtime/def_spec.rb
opal-0.3.31 spec/core/runtime/def_spec.rb
opal-0.3.30 spec/core/runtime/def_spec.rb
opal-0.3.29 spec/core/runtime/def_spec.rb
opal-0.3.28 spec/core/runtime/def_spec.rb
opal-0.3.27 spec/opal/runtime/def_spec.rb