summaryrefslogtreecommitdiff
path: root/spec/support/matchers.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support/matchers.rb')
-rw-r--r--spec/support/matchers.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/support/matchers.rb b/spec/support/matchers.rb
new file mode 100644
index 0000000..cb2b3c0
--- /dev/null
+++ b/spec/support/matchers.rb
@@ -0,0 +1,13 @@
+RSpec::Matchers.define :parse_as_valid_ruby do
+ require 'ripper'
+
+ match do |actual|
+ parsed = Ripper.sexp(actual)
+
+ !parsed.nil?
+ end
+
+ failure_message do |actual|
+ "expected that #{actual} would parse as valid Ruby"
+ end
+end