Sha256: 6d827eca221cd3c49c3f7914ce0cbdda8129a4d71bfb455dfa16b387858829aa
Contents?: true
Size: 1.08 KB
Versions: 3
Compression:
Stored size: 1.08 KB
Contents
module Opal module RSpec def self.get_constants_for(object) result = [] %x{ for (var prop in #{object}) { if (#{object}.hasOwnProperty(prop) && #{!`prop`.start_with?('$')}) { #{result << `prop`} } } } result.reject { |c| c == 'constructor' } end end end unless Opal::RSpec::Compatibility.constant_resolution_works_right? groups_are_in = RSpec::ExampleGroups built_in_spec = :BuiltInMatchers # in case we aren't running all of the examples if groups_are_in.const_defined? built_in_spec example_group = groups_are_in.const_get built_in_spec example_group.let(:matchers) do # .constants is broken in Opal, this is a hack constants = Opal::RSpec.get_constants_for(RSpec::Matchers::BuiltIn) - [:NullCapture, :CaptureStdOut, :CaptureStdErr] constants.map { |n| RSpec::Matchers::BuiltIn.const_get(n) }.select do |m| #BuiltIn.constants.map { |n| BuiltIn.const_get(n) }.select do |m| m.method_defined?(:matches?) && m.method_defined?(:failure_message) end end end end
Version data entries
3 entries across 3 versions & 2 rubygems