summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/integration/ruby/bundler_spec.rb41
-rw-r--r--spec/support/matchers.rb2
2 files changed, 41 insertions, 2 deletions
diff --git a/spec/integration/ruby/bundler_spec.rb b/spec/integration/ruby/bundler_spec.rb
index 2cb8f7d..d9b9c85 100644
--- a/spec/integration/ruby/bundler_spec.rb
+++ b/spec/integration/ruby/bundler_spec.rb
@@ -13,7 +13,6 @@ gem 'saml-kit'
end
report = runner.scan
- expect(report).not_to be_empty
expect(report).to match_schema(version: '2.0')
expect(report[:licenses]).not_to be_empty
expect(report[:dependencies].map { |x| x[:name] }).to include("saml-kit")
@@ -87,4 +86,44 @@ BUNDLED WITH
expect(report[:dependencies].map { |x| x[:name] }).to include("saml-kit")
end
end
+
+ context "when a project depends on bundler `~> 2.0`" do
+ it 'produces a valid report' do
+ runner.add_file('Gemfile') do
+ <<~RAW
+source 'https://rubygems.org'
+
+gem 'net-hippie'
+ RAW
+ end
+ runner.add_file('Gemfile.lock') do
+ <<~RAW
+GEM
+ remote: https://rubygems.org/
+ specs:
+ net-hippie (0.3.2)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ net-hippie
+
+BUNDLED WITH
+ 2.1.4
+ RAW
+ end
+
+ report = runner.scan
+ expect(report).to match_schema(version: '2.0')
+ expect(report[:licenses]).not_to be_empty
+ expect(find_in(report, 'net-hippie')).to eql({
+ name: 'net-hippie',
+ description: "net/http for hippies. ☮️",
+ url: "https://github.com/mokhan/net-hippie/",
+ paths: ['.'],
+ licenses: ['MIT']
+ })
+ end
+ end
end
diff --git a/spec/support/matchers.rb b/spec/support/matchers.rb
index 12bbdf7..595cd17 100644
--- a/spec/support/matchers.rb
+++ b/spec/support/matchers.rb
@@ -3,7 +3,7 @@ RSpec::Matchers.define :match_schema do |version: '2.0'|
License::Management.root.join("spec/fixtures/schema/v#{version}.json").to_s
end
match do |actual|
- !actual.nil? && JSON::Validator.fully_validate(schema_for(version), actual).empty?
+ !actual.nil? && (@errors = JSON::Validator.fully_validate(schema_for(version), actual)).empty?
end
failure_message do |response|