Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Follow up to #2278 #2287

Merged
merged 2 commits into from
Jul 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
### Development
[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.5.1...master)

Enhancements:

* Warn when duplicate shared exmaples definitions are loaded due to being
defined in files matching the spec pattern (e.g. `_spec.rb`) (#2278, Devon Estes)

### 3.5.1 / 2016-07-06
[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.5.0...v3.5.1)

Expand Down
12 changes: 10 additions & 2 deletions lib/rspec/core/shared_example_group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,16 @@ def warn_if_key_taken(context, key, new_block)
end
end

def formatted_location(block)
block.source_location.join(":").gsub(/:in.*$/, '')
if RUBY_VERSION.to_f >= 1.9
def formatted_location(block)
block.source_location.join(":")
end
else # 1.8.7
# :nocov:
def formatted_location(block)
block.source_location.join(":").gsub(/:in.*$/, '')
end
# :nocov:
end

if Proc.method_defined?(:source_location)
Expand Down