File: spec_helper.rb

package info (click to toggle)
ruby-parslet 1.8.2-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 788 kB
  • sloc: ruby: 5,400; sh: 4; makefile: 3
file content (40 lines) | stat: -rw-r--r-- 818 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40

require 'parslet'

require 'parslet/rig/rspec'
require 'parslet/atoms/visitor'
require 'parslet/export'

require 'ae'

RSpec.configure do |config|
  config.mock_with :flexmock

  begin
    # Here's to the worst idea ever, rspec. This is why we'll be leaving you soon.
    config.expect_with :rspec do |c|
      c.syntax = [:should, :expect]
    end
  rescue NoMethodError
    # If the feature is missing, ignore it. 
  end
  
  # Exclude other ruby versions by giving :ruby => 1.8 or :ruby => 1.9
  #
  config.filter_run_excluding :ruby => lambda { |version|
    RUBY_VERSION.to_s !~ /^#{Regexp.escape(version.to_s)}/
  }
end

def catch_failed_parse
  begin
    yield
  rescue Parslet::ParseFailed => exception
  end
  exception.parse_failure_cause
end

def slet name, &block
  let(name, &block)
  subject(&block)
end