Skip to content

Commit

Permalink
Remove source_location from example, favouring #location
Browse files Browse the repository at this point in the history
  • Loading branch information
bestie committed Feb 12, 2014
1 parent 45d866e commit 5e38ae9
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
11 changes: 10 additions & 1 deletion Gemfile
Expand Up @@ -2,7 +2,7 @@ source "https://rubygems.org"

gemspec

%w[rspec rspec-expectations rspec-mocks rspec-support].each do |lib|
%w[rspec rspec-expectations rspec-mocks].each do |lib|
library_path = File.expand_path("../../#{lib}", __FILE__)
if File.exist?(library_path) && !ENV['USE_GIT_REPOS']
gem lib, :path => library_path
Expand All @@ -11,6 +11,15 @@ gemspec
end
end

%w[rspec-support].each do |lib|
library_path = File.expand_path("../../#{lib}", __FILE__)
if File.exist?(library_path) && !ENV['USE_GIT_REPOS']
gem lib, :path => library_path
else
gem lib, :git => "git://github.com/bestie/#{lib}.git", :branch => "warnings-module"
end
end

### deps for rdoc.info
platforms :ruby do
gem 'yard', '0.8.6.1', :require => false
Expand Down
5 changes: 0 additions & 5 deletions lib/rspec/core/example.rb
Expand Up @@ -56,11 +56,6 @@ def description
RSpec.configuration.format_docstrings_block.call(description)
end

# Returns the source location of the block passed to this spec.
def source_location
@example_block.source_location
end

# @attr_reader
#
# Returns the first exception raised in the context of running this
Expand Down
2 changes: 1 addition & 1 deletion lib/rspec/core/warnings.rb
Expand Up @@ -29,7 +29,7 @@ def warn_with(message, options = {})
if RSpec.current_example.nil?
message << " RSpec could not determine which call generated this warning."
else
message << " Warning generated from spec at `#{RSpec.current_example.source_location.join(":")}`."
message << " Warning generated from spec at `#{RSpec.current_example.location}`."
end
end

Expand Down
3 changes: 2 additions & 1 deletion spec/rspec/core/warnings_spec.rb
Expand Up @@ -33,7 +33,8 @@

it "adds the source location of spec" do
line = __LINE__ - 1
expect(Kernel).to receive(:warn).with("The warning. Warning generated from spec at `#{__FILE__}:#{line}`.")
file_path = RSpec::Core::Metadata.relative_path(__FILE__)
expect(Kernel).to receive(:warn).with("The warning. Warning generated from spec at `#{file_path}:#{line}`.")

RSpec.warn_with("The warning.", options)
end
Expand Down

0 comments on commit 5e38ae9

Please sign in to comment.