Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract correct test directory from test file pattern that has multiple patterns #43

Merged
merged 2 commits into from
Jun 16, 2017
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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

* TODO

### 0.43.0

* Extract correct test directory from test file pattern that has multiple patterns.

https://github.com/KnapsackPro/knapsack_pro-ruby/pull/43

https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v0.42.0...v0.43.0

### 0.42.0

* Clear RSpec examples without shared examples in similar way as in RSpec 3.6.0
Expand Down
2 changes: 1 addition & 1 deletion lib/knapsack_pro/base_allocator_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def allocator
end

def test_dir
test_file_pattern.split('/').first
test_file_pattern.split('/').first.gsub(/({)/, '')
end

private
Expand Down
14 changes: 12 additions & 2 deletions spec/knapsack_pro/base_allocator_builder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,19 @@
subject { allocator_builder.test_dir }

before do
expect(KnapsackPro::TestFilePattern).to receive(:call).with(adapter_class).and_return('spec/**{,/*/**}/*_spec.rb')
expect(KnapsackPro::TestFilePattern).to receive(:call).with(adapter_class).and_return(test_file_pattern)
end

it { should eq 'spec' }
context 'when single pattern' do
let(:test_file_pattern) { 'spec/**{,/*/**}/*_spec.rb' }

it { should eq 'spec' }
end

context 'when multiple patterns' do
let(:test_file_pattern) { '{spec/controllers/**/*.rb,spec/decorators/**/*.rb}' }

it { should eq 'spec' }
end
end
end