File tree Expand file tree Collapse file tree 4 files changed +42
-8
lines changed
test/lib/skunk/cli/commands Expand file tree Collapse file tree 4 files changed +42
-8
lines changed Original file line number Diff line number Diff line change 11# frozen_string_literal: true
22
33require "test_helper"
4+ require "minitest/stub_const"
45
56require "skunk/rubycritic/analysed_module"
67require "skunk/cli/commands/compare"
Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+
3+ require "test_helper"
4+ require "minitest/stub_const"
5+
6+ require "skunk/cli/commands/default"
7+
8+ describe Skunk ::Cli ::Command ::Default do
9+ describe "#sharing?" do
10+ let ( :subject ) { Skunk ::Cli ::Command ::Default . new ( { } ) }
11+
12+ it "returns true" do
13+ env = ENV . to_hash . merge ( "SHARE" => "true" )
14+ Object . stub_const ( :ENV , env ) do
15+ _ ( subject . sharing? ) . must_equal true
16+ end
17+ end
18+
19+ it "returns false" do
20+ _ ( subject . sharing? ) . must_equal false
21+ end
22+ end
23+ end
Original file line number Diff line number Diff line change 1616 -h, --help Show this message
1717 HELP
1818 end
19+ let ( :options ) { [ "--help" ] }
20+ let ( :opts ) { Skunk ::Cli ::Options . new ( options ) . parse }
21+ let ( :subject ) { Skunk ::Cli ::Command ::Help . new ( opts . to_h ) }
1922
2023 it "outputs the right help message" do
21- options = [ "--help" ]
22- opts = Skunk ::Cli ::Options . new ( options ) . parse
23- subject = Skunk ::Cli ::Command ::Help . new ( opts . to_h )
24-
2524 assert_output ( msg ) do
2625 subject . execute
2726 end
2827 end
28+
29+ describe "#sharing?" do
30+ it "returns false" do
31+ _ ( subject . sharing? ) . must_equal false
32+ end
33+ end
2934 end
3035end
Original file line number Diff line number Diff line change 88describe Skunk ::Cli ::Command ::Version do
99 describe "#execute" do
1010 let ( :msg ) { Skunk ::VERSION }
11+ let ( :options ) { [ "--version" ] }
12+ let ( :opts ) { Skunk ::Cli ::Options . new ( options ) . parse }
13+ let ( :subject ) { Skunk ::Cli ::Command ::Version . new ( opts . to_h ) }
1114
1215 it "outputs the right version message" do
13- options = [ "--version" ]
14- opts = Skunk ::Cli ::Options . new ( options ) . parse
15- subject = Skunk ::Cli ::Command ::Version . new ( opts . to_h )
16-
1716 assert_output ( msg ) do
1817 subject . execute
1918 end
2019 end
20+
21+ describe "#sharing?" do
22+ it "returns false" do
23+ _ ( subject . sharing? ) . must_equal false
24+ end
25+ end
2126 end
2227end
You can’t perform that action at this time.
0 commit comments