spec/spec_helper.rb in music-transcription-0.9.2 vs spec/spec_helper.rb in music-transcription-0.10.0
- old
+ new
@@ -27,5 +27,17 @@
RSpec::Matchers.define :be_invalid do
match do |obj|
obj.invalid?
end
end
+
+RSpec::Matchers.define :parse do |str|
+ match do |parser|
+ !parser.parse(str).nil?
+ end
+end
+
+RSpec::Matchers.define :parse_as do |str,nodeclass|
+ match do |parser|
+ parser.parse(str).is_a?(nodeclass)
+ end
+end