Skip to content
This repository has been archived by the owner on Oct 27, 2021. It is now read-only.

Commit

Permalink
Remove example_id from ExampleProxy
Browse files Browse the repository at this point in the history
- you can just use the proxy itself or it's object_id
- [#738]
  • Loading branch information
dchelimsky committed Mar 20, 2009
1 parent a5641fc commit a0a0a3b
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 20 deletions.
7 changes: 4 additions & 3 deletions History.txt
Expand Up @@ -10,9 +10,10 @@
variable, and RSpec won't force it on you.
* added -u/--debugger option (Rick DeNatale) #262.
* just add "debugger" anywhere in your code and run spec path/to/code --debugger
* Added example_id to ExampleDescription and pass ExampleDescription to
example_started() instead of an empty string (Tobias Grimm). Closes 738
* ExampleDescription renamed to ExampleProxy
* rename ExampleDescription to ExampleProxy
* pass ExampleProxy to example_started(). Closes #738, #743
* thanks to Tobias Grimm (Eclipse) fort the patch and Roman Chernyatchik
(JetBrains, RubyMine) for the assist

* bug fixes

Expand Down
2 changes: 1 addition & 1 deletion lib/spec/example/example_group_methods.rb
Expand Up @@ -213,7 +213,7 @@ def execute_examples(success, instance_variables, examples, run_options)

examples.each do |example|
example_group_instance = new(example, &example_implementations[example])
success &= example_group_instance.execute(run_options, instance_variables, example.backtrace, example.example_id)
success &= example_group_instance.execute(run_options, instance_variables)
after_all_instance_variables = example_group_instance.instance_variable_hash
end

Expand Down
5 changes: 3 additions & 2 deletions lib/spec/example/example_methods.rb
Expand Up @@ -25,7 +25,8 @@ def options # :nodoc:
@_proxy.options
end

def execute(run_options, instance_variables, backtrace, example_id) # :nodoc:
def execute(run_options, instance_variables) # :nodoc:
puts caller unless caller(0)[1] =~ /example_group_methods/
run_options.reporter.example_started(@_proxy)
set_instance_variables_from_hash(instance_variables)

Expand All @@ -45,7 +46,7 @@ def execute(run_options, instance_variables, backtrace, example_id) # :nodoc:
end


run_options.reporter.example_finished(@_proxy.update(description, backtrace), execution_error)
run_options.reporter.example_finished(@_proxy.update(description), execution_error)
success = execution_error.nil? || ExamplePendingError === execution_error
end

Expand Down
8 changes: 2 additions & 6 deletions lib/spec/example/example_proxy.rb
Expand Up @@ -7,15 +7,11 @@ def initialize(description=nil, options={}, backtrace=nil)
@description, @options, @backtrace = description, options, backtrace
end

def update(description, backtrace)
@description, @backtrace = description, backtrace
def update(description)
@description = description
self
end

def example_id
__id__
end

def ==(other)
(other.description == description) & (other.backtrace == backtrace)
end
Expand Down
4 changes: 0 additions & 4 deletions spec/spec/example/example_group_methods_spec.rb
Expand Up @@ -91,10 +91,6 @@ module Example
specify "with a backtrace" do
@example_proxy.backtrace.should == "the backtrace"
end

specify "with an example_id" do
@example_proxy.example_id.should == @example_proxy.object_id
end
end
end
end
Expand Down
6 changes: 2 additions & 4 deletions spec/spec/example/example_group_spec.rb
Expand Up @@ -111,16 +111,14 @@ class << example_group

it "should report the start of an example run" do
reporter.should_receive(:example_started) do |example|
example.example_id.should == example_group.examples[0].example_id
example.backtrace.should == example_group.examples[0].backtrace
example.should equal(example_group.examples[0])
end
example_group.run(options)
end

it "should report the end of an example run" do
reporter.should_receive(:example_finished) do |example, execution_error|
example.example_id.should == example_group.examples[0].example_id
example.backtrace.should == example_group.examples[0].backtrace
example.should equal(example_group.examples[0])
execution_error.should be_nil
end
example_group.run(options)
Expand Down

0 comments on commit a0a0a3b

Please sign in to comment.