Skip to content

Commit

Permalink
deprecate RakeTask#warning (use ruby_opts='-w' instead)
Browse files Browse the repository at this point in the history
  • Loading branch information
dchelimsky committed Sep 8, 2010
1 parent 39d3c77 commit 4fa7bd6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/rspec/core/rake_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,18 @@ class RakeTask < ::Rake::TaskLib
# 'spec/**/*_spec.rb'
attr_accessor :pattern

# Deprecated. Use ruby_opts="-w" instead.
# When true, requests that the specs be run with the warning flag set.
# e.g. "ruby -w"
#
# default:
# false
attr_accessor :warning
attr_reader :warning

def warning=(true_or_false)
RSpec.deprecate("warning", 'ruby_opts="-w"')
@warning = true_or_false
end

# Whether or not to fail Rake when an error occurs (typically when examples fail).
#
Expand Down
7 changes: 7 additions & 0 deletions spec/rspec/core/rake_task_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,17 @@ def spec_command
end

context "with warnings on" do
before { RSpec.stub(:deprecate) }

it "renders -w before the -S" do
task.warning = true
spec_command.should =~ /^-w -S rspec/
end

it "warns about deprecation" do
RSpec.should_receive(:deprecate)
task.warning = true
end
end

context "with ruby options" do
Expand Down

0 comments on commit 4fa7bd6

Please sign in to comment.