Skip to content

Commit

Permalink
Add helper methods to assist with spec'ing deprecations.
Browse files Browse the repository at this point in the history
The most consistently tricky part to get right is the call site,
so that's what this helper method helps with.
  • Loading branch information
myronmarston committed Jul 14, 2013
1 parent 2ee5fdb commit 969768c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions spec/support/helper_methods.rb
Expand Up @@ -23,4 +23,14 @@ def safely
end
end

def expect_deprecation_with_call_site(file, line)
expect(RSpec.configuration.reporter).to receive(:deprecation) do |options|
expect(options[:call_site]).to include([file, line].join(':'))
end
end

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

end

3 comments on commit 969768c

@JonRowe
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this :) 👍

@alindeman
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@cupakromer
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Nice

Please sign in to comment.