diff options
| author | Can Eldem <celdem@gitlab.com> | 2020-07-10 16:41:15 +0000 |
|---|---|---|
| committer | Can Eldem <celdem@gitlab.com> | 2020-07-10 16:41:15 +0000 |
| commit | c17546f6cfccf07d27f7984321fe62a7788e8da1 (patch) | |
| tree | 54093c956c0f4dcf4c2ad352847017aee9a88edc /spec/unit | |
| parent | c7385965b4166fb6ab2db3387c67cd54aef1b8df (diff) | |
| parent | 36cdb0040abda394264455a1fdf3d6782af95ceb (diff) | |
Merge branch '217897-isolated-omnibus-lm' into 'master'v3.17.0
Isolate license_management ruby from project ruby
See merge request gitlab-org/security-products/license-management!181
Diffstat (limited to 'spec/unit')
| -rw-r--r-- | spec/unit/license_finder/bundler_spec.rb | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/spec/unit/license_finder/bundler_spec.rb b/spec/unit/license_finder/bundler_spec.rb new file mode 100644 index 0000000..5458892 --- /dev/null +++ b/spec/unit/license_finder/bundler_spec.rb @@ -0,0 +1,48 @@ +require 'spec_helper' + +RSpec.describe LicenseFinder::Bundler do + describe "#current_packages" do + subject do + project.chdir do + bundler.prepare + bundler.current_packages + end + end + + let(:bundler) { described_class.new(options) } + let(:options) { { ignored_groups: [], project_path: project.project_path } } + let(:project) { ProjectHelper.new } + + before do + project.mount(dir: project_fixture) + end + + after do + project.cleanup + end + + context "when scanning a v2.1 bundler project" do + let(:project_fixture) { fixture_file('ruby/bundler-v2.1') } + + specify { expect(subject.map(&:name)).to match_array(%w[bundler net-hippie]) } + end + + context "when scanning a v1.17 bundler project" do + let(:project_fixture) { fixture_file('ruby/bundler-v1.17') } + + specify { expect(subject.map(&:name).sort).to match_array(%w[activemodel activesupport builder bundler concurrent-ruby i18n mini_portile2 minitest net-hippie nokogiri saml-kit thread_safe tilt tzinfo xml-kit xmldsig zeitwerk]) } + end + + context "when scanning a project with a .ruby-version:2.4.9" do + let(:project_fixture) { fixture_file('ruby/bundler-ruby-2.4.9-no-lockfile') } + + specify { expect(subject.map(&:name)).to include("saml-kit") } + end + + context "when scanning a project with a Gemfile that specifies 2.4.9" do + let(:project_fixture) { fixture_file('ruby/bundler/ruby-2.4.9') } + + specify { expect(subject.map(&:name)).to include("saml-kit") } + end + end +end |
