diff options
| author | mo khan <mo.khan@gmail.com> | 2020-07-06 11:03:35 -0600 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2020-07-10 08:53:37 -0600 |
| commit | 36cdb0040abda394264455a1fdf3d6782af95ceb (patch) | |
| tree | 54093c956c0f4dcf4c2ad352847017aee9a88edc /spec/unit | |
| parent | c7385965b4166fb6ab2db3387c67cd54aef1b8df (diff) | |
Isolate license_management ruby from project
* Target ruby version 2.7.1
* Add spec to fetch gems from a custom source
* Add proxy to rubygems.org config
* Specify default env vars to support offline environment
* Cleanup custom certificates after spec
* Inline docker-test script
* Do not install license_finder with each installed ruby
* Increase gem log verbosity and include backtrace
* Extract test fixtures for the different ruby scenarios
* Find *.gemspec files in gems dir
* Use RUBYLIB to hijack src path
* Run scan from project path dir
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 |
