Skip to content

Commit

Permalink
Better deprecation warnings
Browse files Browse the repository at this point in the history
Ref #942
  • Loading branch information
mattwynne committed Jan 20, 2016
1 parent 33089a9 commit 7c6dd80
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/cucumber/deprecate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module ForUsers
AnsiEscapes = Cucumber::Gherkin::Formatter::AnsiEscapes

def self.call(message, method, remove_after_version)
STDERR.puts AnsiEscapes.failed + "WARNING: #{method} is deprecated and will be removed after version #{remove_after_version}. #{message}" + AnsiEscapes.reset
STDERR.puts AnsiEscapes.failed + "\nWARNING: ##{method} is deprecated and will be removed after version #{remove_after_version}. #{message}.\n(Called from #{caller[2]})" + AnsiEscapes.reset
end
end

Expand Down
14 changes: 10 additions & 4 deletions lib/cucumber/running_test_case.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,18 @@ def passed?
end

def title
warn("deprecated: call #name instead")
Cucumber.deprecate(
"Call #name instead",
"RunningTestCase#title",
"2.9.9")
name
end

def source_tags
#warn('deprecated: call #tags instead')
Cucumber.deprecate(
"Call #tags instead",
"RunningTestCase#source_tags",
"2.9.9")
tags
end

Expand All @@ -96,8 +102,8 @@ def source_tag_names

def skip_invoke!
Cucumber.deprecate(
"Just call #skip_this_scenario directly",
"skip_invoke!",
"Call #skip_this_scenario directly (not on any object)",
"RunningTestCase#skip_invoke!",
"2.9.9")
raise Cucumber::Core::Test::Result::Skipped
end
Expand Down

0 comments on commit 7c6dd80

Please sign in to comment.