summaryrefslogtreecommitdiff
path: root/spec/mspec/spec/utils/deprecate_spec.rb
blob: 73eaf7d04ee7cbd4e5f872781add25d923c97b88 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
require 'spec_helper'
require 'mspec/utils/deprecate'

RSpec.describe MSpec, "#deprecate" do
  it "warns when using a deprecated method" do
    warning = nil
    allow($stderr).to receive(:puts) { |str| warning = str }
    MSpec.deprecate(:some_method, :other_method)
    expect(warning).to start_with(<<-EOS.chomp)

some_method is deprecated, use other_method instead.
from
EOS
    expect(warning).to include(__FILE__)
    expect(warning).to include('8')
  end
end