summaryrefslogtreecommitdiff
path: root/spec/mspec/spec/utils/deprecate_spec.rb
blob: 7fa60df26a4f67eea2981dce31463e4944aa246c (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'

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

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