scmd 3.0.1 → 3.0.5
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.
- checksums.yaml +7 -7
- data/Gemfile +14 -6
- data/{LICENSE.txt → LICENSE} +0 -0
- data/README.md +1 -1
- data/bench/results.txt +32 -32
- data/bench/runner.rb +16 -13
- data/lib/scmd/command.rb +59 -43
- data/lib/scmd/command_spy.rb +22 -24
- data/lib/scmd/stored_commands.rb +10 -14
- data/lib/scmd/version.rb +3 -1
- data/lib/scmd.rb +17 -16
- data/scmd.gemspec +13 -6
- data/script/bench.rb +6 -7
- data/test/helper.rb +13 -2
- data/test/support/factory.rb +3 -2
- data/test/system/command_tests.rb +22 -27
- data/test/unit/command_spy_tests.rb +30 -16
- data/test/unit/command_tests.rb +8 -9
- data/test/unit/scmd_tests.rb +17 -22
- data/test/unit/stored_commands_tests.rb +7 -9
- metadata +62 -49
- data/.gitignore +0 -19
- data/Rakefile +0 -1
data/scmd.gemspec
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
5
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
6
|
require "scmd/version"
|
5
7
|
|
@@ -8,16 +10,21 @@ Gem::Specification.new do |gem|
|
|
8
10
|
gem.version = Scmd::VERSION
|
9
11
|
gem.authors = ["Kelly Redding", "Collin Redding"]
|
10
12
|
gem.email = ["kelly@kellyredding.com", "collin.redding@me.com"]
|
11
|
-
gem.
|
12
|
-
gem.
|
13
|
+
gem.summary = "Build and run system commands."
|
14
|
+
gem.description = "Build and run system commands."
|
13
15
|
gem.homepage = "http://github.com/redding/scmd"
|
14
|
-
gem.license =
|
16
|
+
gem.license = "MIT"
|
17
|
+
|
18
|
+
gem.files = `git ls-files | grep "^[^.]"`.split($INPUT_RECORD_SEPARATOR)
|
15
19
|
|
16
|
-
gem.files = `git ls-files`.split($/)
|
17
20
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
18
21
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
19
22
|
gem.require_paths = ["lib"]
|
20
23
|
|
21
|
-
gem.
|
24
|
+
gem.required_ruby_version = ">= 2.5"
|
25
|
+
|
26
|
+
gem.add_development_dependency("much-style-guide", ["~> 0.6.0"])
|
27
|
+
gem.add_development_dependency("assert", ["~> 2.19.2"])
|
28
|
+
|
22
29
|
gem.add_dependency("posix-spawn", ["~> 0.3.11"])
|
23
30
|
end
|
data/script/bench.rb
CHANGED
@@ -1,11 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# $ bundle exec ruby script/bench.rb
|
2
4
|
|
3
|
-
|
5
|
+
require_relative "../bench/runner"
|
4
6
|
|
5
7
|
class ScmdBenchLogger
|
6
|
-
|
7
8
|
def initialize(file_path)
|
8
|
-
@file = File.open(file_path,
|
9
|
+
@file = File.open(file_path, "w")
|
9
10
|
@ios = [@file, $stdout]
|
10
11
|
yield self
|
11
12
|
@file.close
|
@@ -17,10 +18,9 @@ class ScmdBenchLogger
|
|
17
18
|
end
|
18
19
|
end
|
19
20
|
|
20
|
-
def
|
21
|
+
def respond_to_missing?(*args)
|
21
22
|
@ios.first.respond_to?(args.first.to_s) ? true : super
|
22
23
|
end
|
23
|
-
|
24
24
|
end
|
25
25
|
|
26
26
|
def run_cmd(logger, *args)
|
@@ -33,7 +33,7 @@ def run_cmd(logger, *args)
|
|
33
33
|
GC.start
|
34
34
|
end
|
35
35
|
|
36
|
-
ScmdBenchLogger.new(
|
36
|
+
ScmdBenchLogger.new("bench/results.txt") do |logger|
|
37
37
|
run_cmd(logger, Scmd.new("echo hi"), 1)
|
38
38
|
run_cmd(logger, Scmd.new("echo hi"), 10)
|
39
39
|
run_cmd(logger, Scmd.new("echo hi"), 100)
|
@@ -44,4 +44,3 @@ ScmdBenchLogger.new('bench/results.txt') do |logger|
|
|
44
44
|
run_cmd(logger, Scmd.new("cat test/support/bigger-than-64k.txt"), 100)
|
45
45
|
run_cmd(logger, Scmd.new("cat test/support/bigger-than-64k.txt"), 1000)
|
46
46
|
end
|
47
|
-
|
data/test/helper.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# this file is automatically required when you run `assert`
|
2
4
|
# put any test helpers here
|
3
5
|
|
@@ -6,6 +8,15 @@ ROOT_PATH = File.expand_path("../..", __FILE__)
|
|
6
8
|
$LOAD_PATH.unshift(ROOT_PATH)
|
7
9
|
|
8
10
|
# require pry for debugging (`binding.pry`)
|
9
|
-
require
|
11
|
+
require "pry"
|
12
|
+
|
13
|
+
require "test/support/factory"
|
14
|
+
|
15
|
+
# 1.8.7 backfills
|
10
16
|
|
11
|
-
|
17
|
+
# Array#sample
|
18
|
+
if !(a = []).respond_to?(:sample) && a.respond_to?(:choice)
|
19
|
+
class Array
|
20
|
+
alias_method :sample, :choice
|
21
|
+
end
|
22
|
+
end
|
data/test/support/factory.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "assert"
|
2
|
-
require
|
4
|
+
require "scmd/command"
|
3
5
|
|
4
6
|
class Scmd::Command
|
5
|
-
|
6
7
|
class SystemTests < Assert::Context
|
7
8
|
desc "Scmd::Command"
|
8
9
|
setup do
|
@@ -17,27 +18,28 @@ class Scmd::Command
|
|
17
18
|
assert_equal 0, @success_cmd.exitstatus
|
18
19
|
assert @success_cmd.success?
|
19
20
|
assert_equal "hi\n", @success_cmd.stdout
|
20
|
-
assert_equal
|
21
|
+
assert_equal "", @success_cmd.stderr
|
21
22
|
|
22
23
|
@failure_cmd.run
|
23
24
|
|
24
25
|
assert_not_nil @failure_cmd.pid
|
25
26
|
assert_not_equal 0, @failure_cmd.exitstatus
|
26
27
|
assert_not @failure_cmd.success?
|
27
|
-
assert_equal
|
28
|
-
assert_not_equal
|
28
|
+
assert_equal "", @failure_cmd.stdout
|
29
|
+
assert_not_equal "", @failure_cmd.stderr
|
29
30
|
end
|
30
31
|
|
31
32
|
should "raise an exception with proper backtrace on `run!`" do
|
32
|
-
err =
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
33
|
+
err =
|
34
|
+
begin
|
35
|
+
@failure_cmd.run!
|
36
|
+
rescue => ex
|
37
|
+
ex
|
38
|
+
end
|
37
39
|
|
38
40
|
assert_kind_of Scmd::RunError, err
|
39
|
-
assert_includes
|
40
|
-
assert_includes
|
41
|
+
assert_includes "No such file or directory", err.message
|
42
|
+
assert_includes "test/system/command_tests.rb:", err.backtrace.first
|
41
43
|
end
|
42
44
|
|
43
45
|
should "return itself on `run`, `run!`" do
|
@@ -57,7 +59,6 @@ class Scmd::Command
|
|
57
59
|
cmd.wait
|
58
60
|
assert_not cmd.running?
|
59
61
|
end
|
60
|
-
|
61
62
|
end
|
62
63
|
|
63
64
|
class InputTests < SystemTests
|
@@ -65,7 +66,7 @@ class Scmd::Command
|
|
65
66
|
setup do
|
66
67
|
@cmd = Scmd::Command.new("sh")
|
67
68
|
end
|
68
|
-
subject
|
69
|
+
subject{ @cmd }
|
69
70
|
|
70
71
|
should "run the command given a single line of input" do
|
71
72
|
subject.run "echo hi"
|
@@ -81,7 +82,6 @@ class Scmd::Command
|
|
81
82
|
assert_equal "hi\n", @cmd.stdout
|
82
83
|
assert_equal "err\n", @cmd.stderr
|
83
84
|
end
|
84
|
-
|
85
85
|
end
|
86
86
|
|
87
87
|
class LongRunningTests < SystemTests
|
@@ -124,21 +124,20 @@ class Scmd::Command
|
|
124
124
|
|
125
125
|
should "be killable with a non-default signal" do
|
126
126
|
@long_cmd.start
|
127
|
-
@long_cmd.kill(
|
127
|
+
@long_cmd.kill("INT")
|
128
128
|
|
129
129
|
assert_not @long_cmd.running?
|
130
130
|
end
|
131
|
-
|
132
131
|
end
|
133
132
|
|
134
133
|
class BufferDeadlockTests < SystemTests
|
135
134
|
desc "when capturing data from an output buffer"
|
136
135
|
setup do
|
137
|
-
@small_path = File.join(ROOT_PATH,
|
136
|
+
@small_path = File.join(ROOT_PATH, "test/support/smaller-than-64k.txt")
|
138
137
|
@small_data = File.read(@small_path)
|
139
138
|
@small_cmd = Scmd::Command.new("cat #{@small_path}")
|
140
139
|
|
141
|
-
@big_path = File.join(ROOT_PATH,
|
140
|
+
@big_path = File.join(ROOT_PATH, "test/support/bigger-than-64k.txt")
|
142
141
|
@big_data = File.read(@big_path)
|
143
142
|
@big_cmd = Scmd::Command.new("cat #{@big_path}")
|
144
143
|
end
|
@@ -152,15 +151,14 @@ class Scmd::Command
|
|
152
151
|
assert_nothing_raised{ @big_cmd.wait(1) }
|
153
152
|
assert_equal @big_data, @big_cmd.stdout
|
154
153
|
end
|
155
|
-
|
156
154
|
end
|
157
155
|
|
158
156
|
class WithEnvVarTests < SystemTests
|
159
157
|
desc "with environment variables"
|
160
158
|
setup do
|
161
159
|
@cmd = Scmd::Command.new("echo $SCMD_TEST_VAR", {
|
162
|
-
:
|
163
|
-
})
|
160
|
+
env: { "SCMD_TEST_VAR" => "test" },
|
161
|
+
},)
|
164
162
|
end
|
165
163
|
|
166
164
|
should "use them when running the command" do
|
@@ -168,7 +166,6 @@ class Scmd::Command
|
|
168
166
|
assert @cmd.success?
|
169
167
|
assert_equal "test\n", @cmd.stdout
|
170
168
|
end
|
171
|
-
|
172
169
|
end
|
173
170
|
|
174
171
|
class WithOptionsTests < SystemTests
|
@@ -177,8 +174,8 @@ class Scmd::Command
|
|
177
174
|
@path = "/"
|
178
175
|
# `chdir` is the only one that reliably worked
|
179
176
|
@cmd = Scmd::Command.new("pwd", {
|
180
|
-
:
|
181
|
-
})
|
177
|
+
options: { chdir: @path },
|
178
|
+
},)
|
182
179
|
end
|
183
180
|
|
184
181
|
should "use them when running the command" do
|
@@ -188,7 +185,5 @@ class Scmd::Command
|
|
188
185
|
assert_not_equal "#{Dir.pwd}\n", @cmd.stdout
|
189
186
|
assert_equal "#{@path}\n", @cmd.stdout
|
190
187
|
end
|
191
|
-
|
192
188
|
end
|
193
|
-
|
194
189
|
end
|
@@ -1,20 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "assert"
|
2
|
-
require
|
4
|
+
require "scmd/command_spy"
|
3
5
|
|
4
6
|
class Scmd::CommandSpy
|
5
|
-
|
6
7
|
class UnitTests < Assert::Context
|
7
8
|
desc "Scmd::CommandSpy"
|
8
9
|
setup do
|
9
10
|
@spy_class = Scmd::CommandSpy
|
10
11
|
end
|
11
|
-
|
12
12
|
end
|
13
13
|
|
14
14
|
class InitTests < UnitTests
|
15
15
|
setup do
|
16
|
-
@orig_scmd_test_mode = ENV[
|
17
|
-
ENV[
|
16
|
+
@orig_scmd_test_mode = ENV["SCMD_TEST_MODE"]
|
17
|
+
ENV["SCMD_TEST_MODE"] = "1"
|
18
18
|
Scmd.reset
|
19
19
|
|
20
20
|
@cmd_str = Factory.string
|
@@ -22,7 +22,7 @@ class Scmd::CommandSpy
|
|
22
22
|
end
|
23
23
|
teardown do
|
24
24
|
Scmd.reset
|
25
|
-
ENV[
|
25
|
+
ENV["SCMD_TEST_MODE"] = @orig_scmd_test_mode
|
26
26
|
end
|
27
27
|
subject{ @spy }
|
28
28
|
|
@@ -54,17 +54,17 @@ class Scmd::CommandSpy
|
|
54
54
|
|
55
55
|
assert_equal 1, subject.pid
|
56
56
|
assert_equal 0, subject.exitstatus
|
57
|
-
assert_equal
|
58
|
-
assert_equal
|
57
|
+
assert_equal "", subject.stdout
|
58
|
+
assert_equal "", subject.stderr
|
59
59
|
end
|
60
60
|
|
61
61
|
should "allow specifying env and options" do
|
62
62
|
opts = { Factory.string => Factory.string }
|
63
63
|
cmd = Scmd::Command.new(Factory.string, {
|
64
|
-
:
|
65
|
-
:
|
66
|
-
})
|
67
|
-
exp = {
|
64
|
+
env: { SCMD_TEST_VAR: 1 },
|
65
|
+
options: opts,
|
66
|
+
},)
|
67
|
+
exp = { "SCMD_TEST_VAR" => "1" }
|
68
68
|
assert_equal exp, cmd.env
|
69
69
|
assert_equal opts, cmd.options
|
70
70
|
end
|
@@ -161,6 +161,22 @@ class Scmd::CommandSpy
|
|
161
161
|
assert_equal 2, Scmd.calls.size
|
162
162
|
end
|
163
163
|
|
164
|
+
should "not track global run, run! or start calls if not in test mode" do
|
165
|
+
ENV.delete("SCMD_TEST_MODE")
|
166
|
+
|
167
|
+
input = Factory.string
|
168
|
+
# if `Scmd.calls` is called when not in test mode it will raise an error,
|
169
|
+
# so if no error is raised then it didn't try to add the call
|
170
|
+
assert_raises(NoMethodError){ Scmd.calls }
|
171
|
+
assert_nothing_raised do
|
172
|
+
subject.run(input)
|
173
|
+
subject.run!(input)
|
174
|
+
subject.start(input)
|
175
|
+
end
|
176
|
+
|
177
|
+
ENV["SCMD_TEST_MODE"] = "1"
|
178
|
+
end
|
179
|
+
|
164
180
|
should "track its wait calls" do
|
165
181
|
timeout = Factory.string
|
166
182
|
subject.wait(timeout)
|
@@ -216,13 +232,11 @@ class Scmd::CommandSpy
|
|
216
232
|
:pid,
|
217
233
|
:exitstatus,
|
218
234
|
:stdout,
|
219
|
-
:stderr
|
220
|
-
].
|
235
|
+
:stderr,
|
236
|
+
].sample
|
221
237
|
Assert.stub(spy2, a){ Factory.string }
|
222
238
|
|
223
239
|
assert_not_equal spy1, spy2
|
224
240
|
end
|
225
|
-
|
226
241
|
end
|
227
|
-
|
228
242
|
end
|
data/test/unit/command_tests.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "assert"
|
2
|
-
require
|
4
|
+
require "scmd/command"
|
3
5
|
|
4
6
|
class Scmd::Command
|
5
|
-
|
6
7
|
class UnitTests < Assert::Context
|
7
8
|
desc "Scmd::Command"
|
8
9
|
setup do
|
@@ -27,9 +28,9 @@ class Scmd::Command
|
|
27
28
|
|
28
29
|
should "stringify its env hash" do
|
29
30
|
cmd = Scmd::Command.new("echo $SCMD_TEST_VAR", {
|
30
|
-
:
|
31
|
-
})
|
32
|
-
exp = {
|
31
|
+
env: { SCMD_TEST_VAR: 1 },
|
32
|
+
},)
|
33
|
+
exp = { "SCMD_TEST_VAR" => "1" }
|
33
34
|
assert_equal exp, cmd.env
|
34
35
|
end
|
35
36
|
|
@@ -40,8 +41,8 @@ class Scmd::Command
|
|
40
41
|
should "default its result values" do
|
41
42
|
assert_nil subject.pid
|
42
43
|
assert_nil subject.exitstatus
|
43
|
-
assert_equal
|
44
|
-
assert_equal
|
44
|
+
assert_equal "", subject.stdout
|
45
|
+
assert_equal "", subject.stderr
|
45
46
|
end
|
46
47
|
|
47
48
|
should "default its state" do
|
@@ -72,7 +73,5 @@ class Scmd::Command
|
|
72
73
|
subject.kill
|
73
74
|
assert_nil subject.pid
|
74
75
|
end
|
75
|
-
|
76
76
|
end
|
77
|
-
|
78
77
|
end
|
data/test/unit/scmd_tests.rb
CHANGED
@@ -1,25 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "assert"
|
2
|
-
require
|
4
|
+
require "scmd"
|
3
5
|
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
6
|
+
require "scmd/command"
|
7
|
+
require "scmd/command_spy"
|
8
|
+
require "scmd/stored_commands"
|
7
9
|
|
8
10
|
module Scmd
|
9
|
-
|
10
11
|
class UnitTests < Assert::Context
|
11
12
|
desc "Scmd"
|
12
13
|
subject{ Scmd }
|
13
14
|
|
14
15
|
should have_imeths :new, :commands, :calls, :reset, :add_command
|
15
|
-
|
16
16
|
end
|
17
17
|
|
18
18
|
class NonTestModeTests < UnitTests
|
19
19
|
desc "when NOT in test mode"
|
20
20
|
|
21
21
|
should "build a `Command` with the `new` method" do
|
22
|
-
assert_instance_of Scmd::Command, subject.new(
|
22
|
+
assert_instance_of Scmd::Command, subject.new("echo hi")
|
23
23
|
end
|
24
24
|
|
25
25
|
should "raise no method error on the test mode API methods" do
|
@@ -32,23 +32,23 @@ module Scmd
|
|
32
32
|
subject.add_command(Factory.string)
|
33
33
|
end
|
34
34
|
end
|
35
|
-
|
36
35
|
end
|
37
36
|
|
38
37
|
class TestModeTests < UnitTests
|
39
38
|
desc "when in test mode"
|
40
39
|
setup do
|
41
|
-
@orig_scmd_test_mode = ENV[
|
42
|
-
ENV[
|
40
|
+
@orig_scmd_test_mode = ENV["SCMD_TEST_MODE"]
|
41
|
+
ENV["SCMD_TEST_MODE"] = "1"
|
43
42
|
Scmd.reset
|
44
43
|
end
|
45
44
|
teardown do
|
46
45
|
Scmd.reset
|
47
|
-
ENV[
|
46
|
+
ENV["SCMD_TEST_MODE"] = @orig_scmd_test_mode
|
48
47
|
end
|
49
48
|
|
50
|
-
should "get a command spy from the commands collection with the new`
|
51
|
-
|
49
|
+
should "get a command spy from the commands collection with the `new` "\
|
50
|
+
"method" do
|
51
|
+
assert_equal Scmd::CommandSpy.new("echo hi"), subject.new("echo hi")
|
52
52
|
end
|
53
53
|
|
54
54
|
should "know its test mode API attrs" do
|
@@ -76,7 +76,6 @@ module Scmd
|
|
76
76
|
subject.add_command(cmd_str){ |cmd| cmd.stdout = output }
|
77
77
|
assert_equal output, subject.new(cmd_str).stdout
|
78
78
|
end
|
79
|
-
|
80
79
|
end
|
81
80
|
|
82
81
|
class CallTests < UnitTests
|
@@ -97,26 +96,24 @@ module Scmd
|
|
97
96
|
assert_equal @input, subject.input
|
98
97
|
assert_equal @cmd, subject.cmd
|
99
98
|
end
|
100
|
-
|
101
99
|
end
|
102
100
|
|
103
101
|
class TimeoutErrorTests < UnitTests
|
104
102
|
desc "TimeoutError"
|
105
103
|
setup do
|
106
|
-
@error = Scmd::TimeoutError.new(
|
104
|
+
@error = Scmd::TimeoutError.new("test")
|
107
105
|
end
|
108
106
|
subject{ @error }
|
109
107
|
|
110
108
|
should "be a RuntimeError" do
|
111
109
|
assert_kind_of ::RuntimeError, subject
|
112
110
|
end
|
113
|
-
|
114
111
|
end
|
115
112
|
|
116
113
|
class RunErrorTests < UnitTests
|
117
114
|
desc "RunError"
|
118
115
|
setup do
|
119
|
-
@error = Scmd::RunError.new(
|
116
|
+
@error = Scmd::RunError.new("test")
|
120
117
|
end
|
121
118
|
subject{ @error }
|
122
119
|
|
@@ -125,16 +122,14 @@ module Scmd
|
|
125
122
|
end
|
126
123
|
|
127
124
|
should "set its backtrace to the caller by default" do
|
128
|
-
assert_match
|
125
|
+
assert_match(/scmd_tests.rb:.*$/, subject.backtrace.first)
|
129
126
|
end
|
130
127
|
|
131
128
|
should "allow passing a custom backtrace" do
|
132
129
|
called_from = caller
|
133
|
-
error = Scmd::RunError.new(
|
130
|
+
error = Scmd::RunError.new("test", called_from)
|
134
131
|
|
135
132
|
assert_equal called_from, error.backtrace
|
136
133
|
end
|
137
|
-
|
138
134
|
end
|
139
|
-
|
140
135
|
end
|
@@ -1,10 +1,11 @@
|
|
1
|
-
|
2
|
-
require 'scmd/stored_commands'
|
1
|
+
# frozen_string_literal: true
|
3
2
|
|
4
|
-
require
|
3
|
+
require "assert"
|
4
|
+
require "scmd/stored_commands"
|
5
5
|
|
6
|
-
|
6
|
+
require "scmd/command_spy"
|
7
7
|
|
8
|
+
class Scmd::StoredCommands
|
8
9
|
class UnitTests < Assert::Context
|
9
10
|
desc "Scmd::StoredCommands"
|
10
11
|
setup do
|
@@ -98,7 +99,6 @@ class Scmd::StoredCommands
|
|
98
99
|
cmds1.add(@cmd_str)
|
99
100
|
assert_not_equal cmds1, cmds2
|
100
101
|
end
|
101
|
-
|
102
102
|
end
|
103
103
|
|
104
104
|
class StubTests < UnitTests
|
@@ -125,7 +125,7 @@ class Scmd::StoredCommands
|
|
125
125
|
|
126
126
|
should "allow setting commands for specific opts" do
|
127
127
|
cmd = subject.call(@opts)
|
128
|
-
assert_equal
|
128
|
+
assert_equal "", cmd.stdout
|
129
129
|
|
130
130
|
subject.with({}){ |cmd| cmd.stdout = @output }
|
131
131
|
cmd = subject.call({})
|
@@ -137,10 +137,8 @@ class Scmd::StoredCommands
|
|
137
137
|
stub2 = Stub.new(@cmd_str)
|
138
138
|
assert_equal stub1, stub2
|
139
139
|
|
140
|
-
Assert.stub(stub1, [:cmd_str, :hash].
|
140
|
+
Assert.stub(stub1, [:cmd_str, :hash].sample){ Factory.string }
|
141
141
|
assert_not_equal stub1, stub2
|
142
142
|
end
|
143
|
-
|
144
143
|
end
|
145
|
-
|
146
144
|
end
|