Skip to content

Commit

Permalink
[Fixed] Bundler ignored groups failure
Browse files Browse the repository at this point in the history
  • Loading branch information
Vikram Yadav committed Dec 3, 2019
1 parent 64658a8 commit bf2c03e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/license_finder/package_managers/bundler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def self.package_management_command
end

def prepare_command
ignored_groups_argument = !ignored_groups.empty? ? "--without #{ignored_groups.join(' ')}" : ''
ignored_groups_argument = !ignored_groups.empty? ? "--without #{ignored_groups.to_a.join(' ')}" : ''

"bundle install #{ignored_groups_argument}".strip
end
Expand Down
8 changes: 4 additions & 4 deletions spec/lib/license_finder/package_managers/bundler_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ def build_gemspec(name, version, dependency = nil)

describe '.prepare_command' do
context 'with ignored groups' do
subject { Bundler.new(ignored_groups: %w[dev test], project_path: Pathname.new('.'), definition: definition) }
subject { Bundler.new(ignored_groups: Set.new(%w[dev test]), project_path: Pathname.new('.'), definition: definition) }
it 'returns the correct prepare method' do
expect(subject.prepare_command).to eq('bundle install --without dev test')
end
end

context 'without ignored groups' do
subject { Bundler.new(ignored_groups: %w[], project_path: Pathname.new('.'), definition: definition) }
subject { Bundler.new(ignored_groups: Set.new, project_path: Pathname.new('.'), definition: definition) }
it 'returns the correct prepare method' do
expect(subject.prepare_command).to eq('bundle install')
end
Expand All @@ -44,7 +44,7 @@ def build_gemspec(name, version, dependency = nil)

describe '.current_packages' do
subject do
Bundler.new(ignored_groups: %w[dev test], project_path: Pathname.new('.'), definition: definition).current_packages
Bundler.new(ignored_groups: Set.new(%w[dev test]), project_path: Pathname.new('.'), definition: definition).current_packages
end

it 'should have 2 dependencies' do
Expand All @@ -71,7 +71,7 @@ def build_gemspec(name, version, dependency = nil)
let(:custom_gemfile) { fixture_path('custom_gemfile') }

subject do
Bundler.new(project_path: custom_gemfile, ignored_groups: %w[dev test])
Bundler.new(project_path: custom_gemfile, ignored_groups: Set.new(%w[dev test]))
end

it 'defaults to Gemfile/Gemfile.lock' do
Expand Down

0 comments on commit bf2c03e

Please sign in to comment.