SimControl 0.1.3 → 0.1.4
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.
data/Gemfile.lock
CHANGED
data/lib/SimControl/scenario.rb
CHANGED
@@ -6,19 +6,19 @@ module SimControl
|
|
6
6
|
args.pop
|
7
7
|
end
|
8
8
|
@commands = args
|
9
|
-
@options = options
|
9
|
+
@options = options || {}
|
10
10
|
end
|
11
11
|
|
12
|
-
def options
|
13
|
-
@options.map { |k, v| "--#{ k } #{ v }" }.join " "
|
12
|
+
def options(other_options = {})
|
13
|
+
other_options.merge(@options).map { |k, v| "--#{ k } #{ v }" }.join " "
|
14
14
|
end
|
15
15
|
|
16
16
|
def commands
|
17
17
|
@commands.join(" ").strip
|
18
18
|
end
|
19
19
|
|
20
|
-
def args
|
21
|
-
[commands, options].join
|
20
|
+
def args(other_options = {})
|
21
|
+
[commands, options(other_options)].join(" ").strip
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
data/lib/SimControl/version.rb
CHANGED
@@ -3,29 +3,11 @@ require "spec_helper"
|
|
3
3
|
describe SimControl::BaseEnvironment do
|
4
4
|
describe "#simulate" do
|
5
5
|
it "calls #execute for each seed" do
|
6
|
+
scenario = double("scenario")
|
7
|
+
scenario.should_receive(:args).with(seed: 1)
|
8
|
+
scenario.should_receive(:args).with(seed: 2)
|
6
9
|
subject.should_receive(:execute).twice
|
7
|
-
subject.simulate(
|
8
|
-
end
|
9
|
-
|
10
|
-
it "injects the seed in the arguments hash" do
|
11
|
-
subject.should_receive(:execute) do |args|
|
12
|
-
expect(args[:seed]).to eq(1)
|
13
|
-
end
|
14
|
-
|
15
|
-
subject.should_receive(:execute) do |args|
|
16
|
-
expect(args[:seed]).to eq(2)
|
17
|
-
end
|
18
|
-
|
19
|
-
subject.simulate({}, [1, 2])
|
20
|
-
end
|
21
|
-
|
22
|
-
it "keeps the arguments hash" do
|
23
|
-
subject.should_receive(:execute) do |args|
|
24
|
-
expect(args[:foo]).to eq("bar")
|
25
|
-
end
|
26
|
-
|
27
|
-
subject.simulate({foo: "bar"}, [1])
|
28
|
-
|
10
|
+
subject.simulate(scenario, [1, 2])
|
29
11
|
end
|
30
12
|
end
|
31
13
|
end
|
data/spec/scenario_spec.rb
CHANGED
@@ -15,4 +15,9 @@ describe SimControl::Scenario do
|
|
15
15
|
scenario = SimControl::Scenario.new "foo", "bar", baz: "1", qux: 2
|
16
16
|
expect(scenario.args).to eq("foo bar --baz 1 --qux 2")
|
17
17
|
end
|
18
|
+
|
19
|
+
it "merges options passed to args in the options" do
|
20
|
+
scenario = SimControl::Scenario.new
|
21
|
+
expect(scenario.args(seed: 1)).to eq("--seed 1")
|
22
|
+
end
|
18
23
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: SimControl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -189,12 +189,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
189
189
|
- - ! '>='
|
190
190
|
- !ruby/object:Gem::Version
|
191
191
|
version: '0'
|
192
|
+
segments:
|
193
|
+
- 0
|
194
|
+
hash: 1705226376190038330
|
192
195
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
193
196
|
none: false
|
194
197
|
requirements:
|
195
198
|
- - ! '>='
|
196
199
|
- !ruby/object:Gem::Version
|
197
200
|
version: '0'
|
201
|
+
segments:
|
202
|
+
- 0
|
203
|
+
hash: 1705226376190038330
|
198
204
|
requirements: []
|
199
205
|
rubyforge_project:
|
200
206
|
rubygems_version: 1.8.23
|