Skip to content

Commit

Permalink
Emit deprecation warning for running_example
Browse files Browse the repository at this point in the history
Note that we set this up only for the "running_example" getter, not the
setter, as the latter should only ever be used internally by RSpec
itself, not by external callers.
  • Loading branch information
wincent authored and dchelimsky committed Jun 18, 2010
1 parent 39d692b commit c58b90a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/rspec/core/example_group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ class ExampleGroup

attr_accessor :example

def running_example
RSpec.deprecate('running_example', 'example')
end

def self.world
RSpec.world
end
Expand Down
9 changes: 9 additions & 0 deletions spec/rspec/core/deprecations_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,13 @@
Spec
end
end

describe RSpec::Core::ExampleGroup do
describe 'running_example' do
it 'is deprecated' do
RSpec.should_receive(:warn_deprecation).with /running_example.*example/m
self.running_example
end
end
end
end

0 comments on commit c58b90a

Please sign in to comment.