Skip to content
Browse files

even shorter description of Proc location

  • Loading branch information...
1 parent aecda56 commit 52eca405614468155f1413644f4089dd5cf84334 @dchelimsky dchelimsky committed
Showing with 9 additions and 3 deletions.
  1. +2 −1 lib/rspec/core/configuration.rb
  2. +7 −2 spec/rspec/core/configuration_spec.rb
View
3 lib/rspec/core/configuration.rb
@@ -338,10 +338,11 @@ def alias_it_should_behave_like_to(new_name, report_label = '')
end
PROC_HEX_NUMBER = /0x[0-9a-f]+@/
+ PROJECT_DIR = File.expand_path('.')
def exclusion_filter=(filter)
def filter.description
- reject { |k, v| DEFAULT_EXCLUSION_FILTERS[k] == v }.inspect.gsub(PROC_HEX_NUMBER, '')
+ reject { |k, v| DEFAULT_EXCLUSION_FILTERS[k] == v }.inspect.gsub(PROC_HEX_NUMBER, '').gsub(PROJECT_DIR, '.').gsub(' (lambda)','')
@myronmarston RSpec member

Nice! I think you might want to do this for the inclusion_filter, too (and there's a corresponding spec for it).

@dchelimsky RSpec member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
end
settings[:exclusion_filter] = filter
View
9 spec/rspec/core/configuration_spec.rb
@@ -572,13 +572,18 @@ def metadata_hash(*args)
config.exclusion_filter.description.should == { :unless => :custom_filter }.inspect
end
- it 'does not include the unnecessary hex number for lambdas' do
- # check the assumption of this example
+ it 'cleans up the description' do
+ # check the assumptions of this example
+ project_dir = File.expand_path('.')
+ lambda { }.inspect.should include(project_dir)
lambda { }.inspect.should include('0x')
+ lambda { }.inspect.should include(' (lambda)') if RUBY_VERSION > '1.9'
config.exclusion_filter[:foo] = lambda { }
config.filter_run_excluding :bar => lambda { }
config.exclusion_filter.description.should_not include('0x')
+ config.exclusion_filter.description.should_not include(project_dir)
+ config.exclusion_filter.description.should_not include(' (lambda)')
end
end

0 comments on commit 52eca40

Please sign in to comment.
Something went wrong with that request. Please try again.