Module: RSpecHelpers

Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-support-3.12.0/lib/rspec/support/spec/deprecation_helpers.rb

Instance Method Summary collapse

Instance Method Details

#allow_deprecationObject



22
23
24
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-support-3.12.0/lib/rspec/support/spec/deprecation_helpers.rb', line 22

def allow_deprecation
  allow(RSpec.configuration.reporter).to receive(:deprecation)
end

#allow_warningObject



45
46
47
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-support-3.12.0/lib/rspec/support/spec/deprecation_helpers.rb', line 45

def allow_warning
  allow(::Kernel).to receive(:warn)
end

#expect_deprecation_with_call_site(file, line, snippet = //) ⇒ Object



2
3
4
5
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-support-3.12.0/lib/rspec/support/spec/deprecation_helpers.rb', line 2

def expect_deprecation_with_call_site(file, line, snippet=//)
  expect(RSpec.configuration.reporter).to receive(:deprecation).
    with(include(:deprecated => match(snippet), :call_site => include([file, line].join(':'))))
end

#expect_deprecation_without_call_site(snippet = //) ⇒ Object



7
8
9
10
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-support-3.12.0/lib/rspec/support/spec/deprecation_helpers.rb', line 7

def expect_deprecation_without_call_site(snippet=//)
  expect(RSpec.configuration.reporter).to receive(:deprecation).
    with(include(:deprecated => match(snippet), :call_site => eq(nil)))
end

#expect_no_deprecationsObject Also known as: expect_no_deprecation



26
27
28
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-support-3.12.0/lib/rspec/support/spec/deprecation_helpers.rb', line 26

def expect_no_deprecations
  expect(RSpec.configuration.reporter).not_to receive(:deprecation)
end

#expect_no_warningsObject



41
42
43
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-support-3.12.0/lib/rspec/support/spec/deprecation_helpers.rb', line 41

def expect_no_warnings
  expect(::Kernel).not_to receive(:warn)
end

#expect_warn_deprecation(snippet = //) ⇒ Object



17
18
19
20
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-support-3.12.0/lib/rspec/support/spec/deprecation_helpers.rb', line 17

def expect_warn_deprecation(snippet=//)
  expect(RSpec.configuration.reporter).to receive(:deprecation).
    with(include(:message => match(snippet)))
end

#expect_warn_deprecation_with_call_site(file, line, snippet = //) ⇒ Object



12
13
14
15
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-support-3.12.0/lib/rspec/support/spec/deprecation_helpers.rb', line 12

def expect_warn_deprecation_with_call_site(file, line, snippet=//)
  expect(RSpec.configuration.reporter).to receive(:deprecation).
    with(include(:message => match(snippet), :call_site => include([file, line].join(':'))))
end

#expect_warning_with_call_site(file, line, expected = //) ⇒ Object



36
37
38
39
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-support-3.12.0/lib/rspec/support/spec/deprecation_helpers.rb', line 36

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

#expect_warning_without_call_site(expected = //) ⇒ Object



31
32
33
34
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-support-3.12.0/lib/rspec/support/spec/deprecation_helpers.rb', line 31

def expect_warning_without_call_site(expected=//)
  expect(::Kernel).to receive(:warn).
    with(match(expected).and(satisfy { |message| !(/Called from/ =~ message) }))
end