Sha256: 5105f4eefc6c455d4d3aa3c11d22f0e70ba8266b86c9f32f50fc275c4dc092ff

Contents?: true

Size: 1.17 KB

Versions: 7

Compression:

Stored size: 1.17 KB

Contents

# Since our call site (locating which line a test is on does not yet work, we don't want to fail all of these mocks)
module RSpecHelpers
  def expect_deprecation_with_call_site(file, line, snippet=//)
    expect(RSpec.configuration.reporter).to receive(:deprecation) do |options|
      #expect(options[:call_site]).to include([file, line].join(':'))
      expect(options[:deprecated]).to match(snippet)
    end
  end

  def expect_deprecation_without_call_site(snippet=//)
    expect(RSpec.configuration.reporter).to receive(:deprecation) do |options|
      #expect(options[:call_site]).to eq nil
      expect(options[:deprecated]).to match(snippet)
    end
  end

  def expect_warn_deprecation_with_call_site(file, line, snippet=//)
    expect(RSpec.configuration.reporter).to receive(:deprecation) do |options|
      message = options[:message]
      expect(message).to match(snippet)
      #expect(message).to include([file, line].join(':'))
    end
  end

  def expect_warning_with_call_site(file, line, expected=//)
    expect(::Kernel).to receive(:warn) do |message|
      expect(message).to match expected
      #expect(message).to match(/Called from #{file}:#{line}/)
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
opal-rspec-0.6.2 spec/rspec/shared/opal/fixes/deprecation_helpers.rb
opal-rspec-0.6.1 spec/rspec/shared/opal/fixes/deprecation_helpers.rb
opal-rspec-0.6.0 spec/rspec/shared/opal/fixes/deprecation_helpers.rb
opal-rspec-0.6.0.beta1 spec/rspec/shared/opal/fixes/deprecation_helpers.rb
opal-connect-rspec-0.5.0 spec/rspec/shared/opal/fixes/deprecation_helpers.rb
opal-rspec-0.5.0 spec/rspec/shared/opal/fixes/deprecation_helpers.rb
opal-rspec-0.5.0.beta3 spec/rspec/shared/opal/fixes/deprecation_helpers.rb