Skip to content

Commit

Permalink
Redefine Enumerable#flat_map for rspec to use
Browse files Browse the repository at this point in the history
  • Loading branch information
adambeynon committed Nov 20, 2013
1 parent 1d3edd3 commit fe80fe9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion opal-rspec.gemspec
Expand Up @@ -15,7 +15,7 @@ Gem::Specification.new do |s|

s.require_paths = ['lib']

s.add_dependency 'opal', '>= 0.5.1'
s.add_dependency 'opal', '= 0.5.4'
s.add_dependency 'opal-sprockets', '~> 0.3.0'

s.add_development_dependency 'rake'
Expand Down
9 changes: 9 additions & 0 deletions opal/opal/rspec/fixes.rb
@@ -1,3 +1,12 @@
# Opal defines enumerable#flat_map, but doesnt implement it
module RSpec::Core::FlatMap
def flat_map(array)
array.map { |item| yield item }.flatten
end

module_function :flat_map
end

# String#<< is not supported by Opal
module RSpec::Expectations
def self.fail_with(message, expected = nil, actual = nil)
Expand Down

0 comments on commit fe80fe9

Please sign in to comment.