File: mathn_integration_support.rb

package info (click to toggle)
ruby-rspec 3.12.0c0e1m1s0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 6,752 kB
  • sloc: ruby: 69,818; sh: 1,861; makefile: 99
file content (25 lines) | stat: -rw-r--r-- 524 bytes parent folder | download | duplicates (6)
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
require 'rspec/support/spec/in_sub_process'

module MathnIntegrationSupport
  include RSpec::Support::InSubProcess

  if RUBY_VERSION.to_f >= 2.2
    def with_mathn_loaded
      skip "lib/mathn.rb is deprecated in Ruby 2.2"
    end
  elsif RUBY_VERSION.to_f < 1.9
    def with_mathn_loaded
      in_sub_process do
        expect { require 'mathn' }.to output.to_stderr
        yield
      end
    end
  else
    def with_mathn_loaded
      in_sub_process do
        require 'mathn'
        yield
      end
    end
  end
end