clamp 1.3.3 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,58 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "spec_helper"
4
-
5
- describe Clamp::Command do
6
-
7
- extend CommandFactory
8
- include OutputCapture
9
-
10
- context "with allow_options_after_parameters enabled" do
11
-
12
- before do
13
- Clamp.allow_options_after_parameters = true
14
- end
15
-
16
- after do
17
- Clamp.allow_options_after_parameters = false
18
- end
19
-
20
- given_command("cmd") do
21
-
22
- option ["-v", "--verbose"], :flag, "Be noisy"
23
-
24
- subcommand "say", "Say something" do
25
-
26
- option "--loud", :flag, "say it loud"
27
-
28
- parameter "WORDS ...", "the thing to say", attribute_name: :words
29
-
30
- def execute
31
- message = words.join(" ")
32
- message = message.upcase if loud?
33
- message *= 3 if verbose?
34
- $stdout.puts message
35
- end
36
-
37
- end
38
-
39
- end
40
-
41
- it "still works" do
42
- command.run(%w[say foo])
43
- expect(stdout).to eq "foo\n"
44
- end
45
-
46
- it "honours options after positional arguments" do
47
- command.run(%w[say blah --verbose])
48
- expect(stdout).to eq "blahblahblah\n"
49
- end
50
-
51
- it "honours options declared on subcommands" do
52
- command.run(%w[say --loud blah])
53
- expect(stdout).to eq "BLAH\n"
54
- end
55
-
56
- end
57
-
58
- end