File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,17 @@ def self.exit_on_failure?
1313 true
1414 end
1515
16+ def self . start ( given_args = ARGV , config = { } )
17+ command = given_args . first
18+ does_not_require_config = %w[ version -V --version init ] . include? ( command )
19+ pod_initialized = Dir . exist? ( ENV [ "HOME" ] + "/.config/pod" )
20+ if does_not_require_config || pod_initialized
21+ super
22+ else
23+ puts "Missing config files. Run `pod init` first."
24+ end
25+ end
26+
1627 desc "version" , "Displays the pod version"
1728 map %w[ -V --version ] => :version
1829 def version
Original file line number Diff line number Diff line change 33require_relative "../support/test_helpers"
44
55RSpec . describe Pod ::CLI do
6- describe "input interpretation" do
6+ describe "input interpretation" , :init_pod do
77 context "when the input is invalid" do
88 it "tells the user that the command was not found" do
99 result = TestHelpers ::CLI . run_cmd ( "pod invalid" )
1313 end
1414 end
1515
16+ describe "init ensuring" do
17+ it "returns an error message when user tries to run pod without initialization" do
18+ expected_output = <<~OUTPUT
19+ Missing config files. Run `pod init` first.
20+ OUTPUT
21+
22+ result = TestHelpers ::CLI . run_cmd ( "pod podcasts" )
23+
24+ expect ( result ) . to eq ( expected_output . chomp )
25+ end
26+ end
27+
1628 describe "version command" do
1729 it "returns the pod version" do
1830 original_result = TestHelpers ::CLI . run_cmd ( "pod version" )
You can’t perform that action at this time.
0 commit comments