Skip to content

Commit cccdcc1

Browse files
committedNov 6, 2014
Remove predicate matcher fixes as Opal supports $1..$9 now.
1 parent dbbb163 commit cccdcc1

File tree

3 files changed

+22
-8
lines changed

3 files changed

+22
-8
lines changed
 

‎CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
## edge
22

3+
* Remove predicate matcher fixes as Opal supports $1..$9 special gvars.
4+
35
* Update Opal dependency for ~> 0.6.0.
46

57
* Remove double-escaping in inline x-strings (from Opal bug fix).

‎opal/opal/rspec/fixes.rb

-8
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,6 @@ def underscore(camel_cased_word)
4242
end
4343
end
4444

45-
# Opal does not yet support $1..$9 backrefs
46-
class RSpec::Matchers::BuiltIn::BePredicate
47-
def prefix_and_expected(symbol)
48-
symbol.to_s =~ /^(be_(an?_)?)(.*)/
49-
return $~[1], $~[3]
50-
end
51-
end
52-
5345
module RSpec::ExampleGroups
5446
# opal cannot use mutable strings AND opal doesnt support `\A` or `\z` anchors
5547
def self.base_name_for(group)

‎spec/matchers_spec.rb

+20
Original file line numberDiff line numberDiff line change
@@ -179,3 +179,23 @@
179179
}.to raise_error(Exception)
180180
end
181181
end
182+
183+
class PredicateTest
184+
def foo?
185+
true
186+
end
187+
188+
def bar?
189+
false
190+
end
191+
end
192+
193+
describe "predicate matchers" do
194+
it "works with positive expectations" do
195+
expect(PredicateTest.new).to be_foo
196+
end
197+
198+
it "work with negative expectations" do
199+
expect(PredicateTest.new).to_not be_bar
200+
end
201+
end

0 commit comments

Comments
 (0)
Please sign in to comment.