diff options
author | Eric Mueller <nevinera@gmail.com> | 2023-11-15 20:11:12 -0800 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2023-11-23 18:03:17 +0000 |
commit | c424d15cb95f0f5a0db711974f7c76928c9633b1 (patch) | |
tree | f2e61a7e6f70219c0d7828df3dc2be43fda237aa /spec/bundler/bundler | |
parent | a54c98a29f2086d46c95bc15e77dade7dcd18bba (diff) |
[rubygems/rubygems] Add --json bundle-outdated flag to produce json-parseable output
https://github.com/rubygems/rubygems/commit/65efa44bc0
Diffstat (limited to 'spec/bundler/bundler')
-rw-r--r-- | spec/bundler/bundler/cli_spec.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/bundler/bundler/cli_spec.rb b/spec/bundler/bundler/cli_spec.rb index b752cd7e70..7acdc496e7 100644 --- a/spec/bundler/bundler/cli_spec.rb +++ b/spec/bundler/bundler/cli_spec.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true require "bundler/cli" +require "json" RSpec.describe "bundle executable" do it "returns non-zero exit status when passed unrecognized options" do @@ -154,6 +155,26 @@ RSpec.describe "bundle executable" do end end + context "with --json" do + let(:flags) { "--json" } + + it "prints json output data when there are outdated gems" do + run_command + out_data = JSON.parse(out) + expect(out_data.keys).to contain_exactly("outdated_count", "outdated_gems") + expect(out_data["outdated_count"]).to eq(1) + expect(out_data["outdated_gems"].length).to eq(1) + + gem_data = out_data["outdated_gems"].first + expect(gem_data).to include({ + "current_spec" => hash_including("name" => "rack", "version" => "0.9.1"), + "active_spec" => hash_including("name" => "rack", "version" => "1.0.0"), + "dependency" => "rack (= 0.9.1)", + "groups" => ["default"], + }) + end + end + context "with --parseable" do let(:flags) { "--parseable" } |