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

Commit

Permalink
add location() to ExampleProxy and ExampleGroupProxy
Browse files Browse the repository at this point in the history
  • Loading branch information
dchelimsky committed Mar 21, 2009
1 parent f1177cd commit cd7b90a
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 3 deletions.
1 change: 0 additions & 1 deletion lib/spec/example/example_methods.rb
Expand Up @@ -45,7 +45,6 @@ def execute(run_options, instance_variables) # :nodoc:
end
end


run_options.reporter.example_finished(@_proxy.update(description), execution_error)
success = execution_error.nil? || ExamplePendingError === execution_error
end
Expand Down
4 changes: 3 additions & 1 deletion lib/spec/example/example_proxy.rb
@@ -1,7 +1,9 @@
module Spec
module Example
class ExampleProxy
attr_reader :description, :options, :backtrace
attr_accessor :description
attr_reader :options, :backtrace
alias_method :location, :backtrace

def initialize(description=nil, options={}, backtrace=nil)
@description, @options, @backtrace = description, options, backtrace
Expand Down
2 changes: 1 addition & 1 deletion spec/spec/example/example_group_proxy_spec.rb
Expand Up @@ -44,7 +44,7 @@ def proxy
end
end

describe "#backtrace (deprecated - use location)" do
describe "#backtrace (deprecated - use #location)" do
it "provides the location of the declaration of this group" do
group.stub!(:backtrace => "path/to/location:37")
proxy.backtrace.should == "path/to/location:37"
Expand Down
47 changes: 47 additions & 0 deletions spec/spec/example/example_proxy_spec.rb
@@ -0,0 +1,47 @@
require File.dirname(__FILE__) + '/../../spec_helper'

module Spec
module Example

describe ExampleProxy do

describe "#description" do
it "provides the submitted description" do
proxy = ExampleProxy.new("the description")
proxy.description.should == "the description"
end
end

describe "#update" do
it "updates the description" do
proxy = ExampleProxy.new("old description")
proxy.update("new description")
proxy.description.should == "new description"
end
end

describe "#options" do
it "provides the submitted options" do
proxy = ExampleProxy.new(:ignore, {:these => :options})
proxy.options.should == {:these => :options}
end
end

describe "#backtrace (deprecated - use #location)" do
it "provides the location of the declaration of this group" do
proxy = ExampleProxy.new(:ignore, {}, "path/to/location:37")
proxy.backtrace.should == "path/to/location:37"
end
end

describe "#location" do
it "provides the location of the declaration of this group" do
proxy = ExampleProxy.new(:ignore, {}, "path/to/location:37")
proxy.location.should == "path/to/location:37"
end
end

end

end
end

0 comments on commit cd7b90a

Please sign in to comment.