stuka 0.0.10 → 0.0.11
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 +4 -4
- data/.gitignore +2 -1
- data/lib/stuka/commands/command.rb +0 -8
- data/lib/stuka/commands/public_commands/new_command.rb +0 -1
- data/lib/stuka/commands/public_commands/process_command.rb +2 -2
- data/lib/stuka/commands/public_commands/setup_command.rb +3 -4
- data/lib/stuka/{stuka_cli.rb → commands/stuka_cli.rb} +4 -4
- data/lib/stuka/commands/subcommands/create/{create_process.rb → create_process_file.rb} +3 -3
- data/lib/stuka/commands/subcommands/setup/setup_directories.rb +6 -6
- data/lib/stuka/external/action_finder.rb +25 -0
- data/lib/stuka/external/business_action.rb +18 -0
- data/lib/stuka/external/business_process.rb +85 -0
- data/lib/stuka/external/dispatcher.rb +27 -0
- data/lib/stuka/external/process_states/finished_state.rb +13 -0
- data/lib/stuka/external/process_states/inactive_state.rb +16 -0
- data/lib/stuka/external/process_states/started_state.rb +21 -0
- data/lib/stuka/external/process_states/starting_state.rb +16 -0
- data/lib/stuka/external/unknown_action.rb +9 -0
- data/lib/stuka/internal/domain/action.rb +32 -0
- data/lib/stuka/internal/domain/domain.rb +29 -0
- data/lib/stuka/internal/domain/process.rb +32 -0
- data/lib/stuka/internal/domain_builders/action_domain_builder.rb +19 -0
- data/lib/stuka/internal/domain_builders/domain_builder.rb +32 -0
- data/lib/stuka/internal/domain_builders/process_domain_builder.rb +17 -0
- data/lib/stuka/internal/process_cleaner.rb +0 -2
- data/lib/stuka/internal/source_builders/action_builder.rb +32 -0
- data/lib/stuka/internal/source_builders/process_builder.rb +38 -0
- data/lib/stuka/internal/source_builders/source_builder.rb +14 -0
- data/lib/stuka/internal/validator.rb +22 -7
- data/lib/stuka/paths/stuka_paths.rb +18 -0
- data/lib/stuka/templates/source/process.tt +18 -3
- data/lib/stuka/version.rb +2 -2
- data/lib/stuka.rb +0 -1
- data/spec/{commands → aceptance/commands}/new_command_spec.rb +1 -1
- data/spec/aceptance/commands/process_command_spec.rb +22 -0
- data/spec/{commands → aceptance/commands}/setup_command_spec.rb +1 -1
- data/spec/aceptance/external/action_aceptance_spec.rb +24 -0
- data/spec/aceptance/external/feed_cat_process_aceptance_spec.rb +46 -0
- data/spec/aceptance/external/processes/cat/check_food.rb +14 -0
- data/spec/aceptance/external/processes/cat/fill_up_plate.rb +14 -0
- data/spec/aceptance/external/processes/cat/go_to_store.rb +14 -0
- data/spec/aceptance/external/processes/feed_cat_process.rb +28 -0
- data/spec/spec_helper.rb +10 -2
- data/spec/unit/external/example_source/create_world.rb +28 -0
- data/spec/unit/external/example_source/kill_monster.rb +38 -0
- data/spec/unit/external/example_source/world/gather_materials.rb +13 -0
- data/spec/unit/external/example_source/world/scrap_world.rb +13 -0
- data/spec/unit/external/example_source/world/seperate_light_from_darkness.rb +13 -0
- data/spec/unit/external/finder_spec.rb +37 -0
- data/spec/unit/external/process_interface.rb +9 -0
- data/spec/unit/external/process_to_action.rb +61 -0
- data/spec/unit/external/process_to_dispatcher_spec.rb +35 -0
- data/spec/unit/external/process_to_finder_spec.rb +138 -0
- data/spec/{build/process_builder_spec.rb → unit/internal/action_builder_spec.rb} +6 -7
- data/spec/unit/internal/action_domain_builder_spec.rb +44 -0
- data/spec/unit/internal/action_spec.rb +14 -0
- data/spec/unit/internal/process_builder_spec.rb +44 -0
- data/spec/{build → unit/internal}/process_cleaner_spec.rb +2 -3
- data/spec/unit/internal/process_domain_builder_spec.rb +51 -0
- data/spec/unit/internal/process_spec.rb +14 -0
- data/spec/unit/internal/process_validator_spec.rb +42 -0
- data/spec/{build → unit/internal}/processes_dsl_test/correct_test_process.rb +12 -5
- data/stuka.gemspec +1 -1
- metadata +82 -41
- data/lib/stuka/commands/public_commands/step_command.rb +0 -25
- data/lib/stuka/commands/subcommands/create/create_action.rb +0 -16
- data/lib/stuka/internal/action.rb +0 -33
- data/lib/stuka/internal/action_builder.rb +0 -31
- data/lib/stuka/internal/action_incubator.rb +0 -37
- data/lib/stuka/internal/process.rb +0 -38
- data/lib/stuka/internal/process_builder.rb +0 -30
- data/lib/stuka/internal/process_incubator.rb +0 -37
- data/lib/stuka/stuka_paths.rb +0 -21
- data/lib/stuka/templates/definitions/step.tt +0 -8
- data/spec/build/action_builder_spec.rb +0 -23
- data/spec/build/action_incubator_spec.rb +0 -24
- data/spec/build/dsl_spec.rb +0 -44
- data/spec/build/process_incubator_spec.rb +0 -27
- data/spec/build/process_validator_spec.rb +0 -40
- data/spec/commands/process_command_spec.rb +0 -19
- data/spec/commands/step_command_spec.rb +0 -19
- /data/spec/{build/processes_dsl_test/incorrect → unit/internal/processes_dsl_test_incorrect}/incorrect_test_process.rb +0 -0
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
module Stuka
|
|
2
|
-
|
|
3
|
-
class Action
|
|
4
|
-
|
|
5
|
-
# must not be nil
|
|
6
|
-
ATTRS = ["name", "description", "namespace"]
|
|
7
|
-
|
|
8
|
-
# must not be empty
|
|
9
|
-
REQUIRED_ATTRS = ["name", "description", "namespace"]
|
|
10
|
-
|
|
11
|
-
def initialize(name, description = nil, namespace = nil)
|
|
12
|
-
@name = name
|
|
13
|
-
@description = description if description
|
|
14
|
-
@namespace = namespace if namespace
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
ATTRS.each do |arg_name|
|
|
18
|
-
define_method arg_name.to_sym do |arg = nil|
|
|
19
|
-
if arg
|
|
20
|
-
instance_variable_set("@#{arg_name}".to_sym, arg)
|
|
21
|
-
else
|
|
22
|
-
instance_variable_get("@#{arg_name}")
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
def get_binding
|
|
28
|
-
binding()
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
end
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
require_relative 'action'
|
|
2
|
-
require_relative 'action_incubator'
|
|
3
|
-
require_relative '../stuka_paths'
|
|
4
|
-
require 'fileutils'
|
|
5
|
-
require 'erb'
|
|
6
|
-
|
|
7
|
-
module Stuka
|
|
8
|
-
|
|
9
|
-
class ActionBuilder
|
|
10
|
-
|
|
11
|
-
def self.build
|
|
12
|
-
|
|
13
|
-
action_incubator = ActionIncubator.new
|
|
14
|
-
action_incubator.incubate
|
|
15
|
-
|
|
16
|
-
template_file = "#{File.expand_path(File.dirname(__FILE__))}/../templates/source/action.tt"
|
|
17
|
-
renderer = ERB.new(File.read(template_file))
|
|
18
|
-
|
|
19
|
-
FileUtils.mkdir_p Stuka::StukaPaths::ACTIONS_SOURCE_PATH
|
|
20
|
-
|
|
21
|
-
action_incubator.actions.each do |acc|
|
|
22
|
-
out_file = File.new("#{Stuka::StukaPaths::ACTIONS_SOURCE_PATH}/#{acc.name}_action.rb", "w")
|
|
23
|
-
out_file.puts(renderer.result(acc.get_binding))
|
|
24
|
-
out_file.close
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
end
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
require_relative 'action'
|
|
2
|
-
require_relative '../stuka_paths'
|
|
3
|
-
|
|
4
|
-
module Stuka
|
|
5
|
-
|
|
6
|
-
class ActionIncubator
|
|
7
|
-
|
|
8
|
-
attr_accessor :actions
|
|
9
|
-
|
|
10
|
-
def initialize
|
|
11
|
-
@actions = []
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def action(name, &block)
|
|
15
|
-
act = Action.new(name)
|
|
16
|
-
act.instance_eval(&block)
|
|
17
|
-
@actions << act
|
|
18
|
-
act
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def incubate
|
|
22
|
-
action_files.each do |path|
|
|
23
|
-
instance_eval(File.read(path), path, __LINE__)
|
|
24
|
-
end
|
|
25
|
-
self
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def action_files
|
|
29
|
-
Dir["#{Stuka::StukaPaths::PROCESSES_DEFINITION_PATH}/*.rb"]
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
# just ignore process calls, so we can mix process and actions in same files
|
|
33
|
-
def process(*args); end
|
|
34
|
-
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
end
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
module Stuka
|
|
2
|
-
|
|
3
|
-
class Process
|
|
4
|
-
|
|
5
|
-
# must not be nil
|
|
6
|
-
ATTRS = ["name", "description", "arguments"]
|
|
7
|
-
|
|
8
|
-
# must not be empty
|
|
9
|
-
REQUIRED_ATTRS = ["name", "description"]
|
|
10
|
-
|
|
11
|
-
def initialize(name, description = nil, arguments = nil)
|
|
12
|
-
@arguments = []
|
|
13
|
-
@name = name
|
|
14
|
-
@description = description if description
|
|
15
|
-
@arguments = arguments if arguments
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
ATTRS.each do |arg_name|
|
|
19
|
-
define_method arg_name.to_sym do |arg = nil|
|
|
20
|
-
if arg
|
|
21
|
-
instance_variable_set("@#{arg_name}".to_sym, arg)
|
|
22
|
-
else
|
|
23
|
-
instance_variable_get("@#{arg_name}")
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def get_binding
|
|
29
|
-
binding()
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def action_transition(action_name, transition_hash)
|
|
33
|
-
"#{action_name} this will be important later"
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
end
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
require_relative 'process'
|
|
2
|
-
require_relative 'process_incubator'
|
|
3
|
-
require_relative '../stuka_paths'
|
|
4
|
-
require 'fileutils'
|
|
5
|
-
require 'erb'
|
|
6
|
-
|
|
7
|
-
module Stuka
|
|
8
|
-
|
|
9
|
-
class ProcessBuilder
|
|
10
|
-
|
|
11
|
-
def self.build
|
|
12
|
-
process_incubator = ProcessIncubator.new
|
|
13
|
-
process_incubator.incubate
|
|
14
|
-
|
|
15
|
-
template_file = "#{File.expand_path(File.dirname(__FILE__))}/../templates/source/process.tt"
|
|
16
|
-
renderer = ERB.new(File.read(template_file))
|
|
17
|
-
|
|
18
|
-
FileUtils.mkdir_p Stuka::StukaPaths::PROCESSES_SOURCE_PATH
|
|
19
|
-
|
|
20
|
-
process_incubator.processes.each do |proc|
|
|
21
|
-
out_file = File.new("#{Stuka::StukaPaths::PROCESSES_SOURCE_PATH}/#{proc.name}_process.rb", "w")
|
|
22
|
-
out_file.puts(renderer.result(proc.get_binding))
|
|
23
|
-
out_file.close
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
end
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
require_relative 'process'
|
|
2
|
-
require_relative '../stuka_paths'
|
|
3
|
-
|
|
4
|
-
module Stuka
|
|
5
|
-
|
|
6
|
-
class ProcessIncubator
|
|
7
|
-
|
|
8
|
-
attr_accessor :processes
|
|
9
|
-
|
|
10
|
-
def initialize
|
|
11
|
-
@processes = []
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def process(name, &block)
|
|
15
|
-
proc = Process.new(name)
|
|
16
|
-
proc.instance_eval(&block)
|
|
17
|
-
@processes << proc
|
|
18
|
-
proc
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def incubate
|
|
22
|
-
process_files.each do |path|
|
|
23
|
-
instance_eval(File.read(path), path, __LINE__)
|
|
24
|
-
end
|
|
25
|
-
self
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def process_files
|
|
29
|
-
Dir["#{Stuka::StukaPaths::PROCESSES_DEFINITION_PATH}/*.rb"]
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
# ignore action calls so action and process calls can be mixed in same files
|
|
33
|
-
def action(*arg); end
|
|
34
|
-
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
end
|
data/lib/stuka/stuka_paths.rb
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
module Stuka
|
|
2
|
-
|
|
3
|
-
module StukaPaths
|
|
4
|
-
|
|
5
|
-
PROCESSES_DEFINITION_PATH = "#{Dir.pwd}/process_definition/processes"
|
|
6
|
-
PROCESSES_SOURCE_PATH = "#{Dir.pwd}/processes"
|
|
7
|
-
|
|
8
|
-
ACTIONS_DEFINITION_PATH = "#{Dir.pwd}/process_definition/actions"
|
|
9
|
-
ACTIONS_SOURCE_PATH = "#{Dir.pwd}/actions"
|
|
10
|
-
|
|
11
|
-
TEST_PROCESSES_DEFINITION_PATH = "#{File.expand_path(File.dirname(__FILE__))}/../../spec/build/processes_dsl_test"
|
|
12
|
-
TEST_PROCESSES_INCORRECT_DEFINITION_PATH = "#{File.expand_path(File.dirname(__FILE__))}/../../spec/build/processes_dsl_test/incorrect"
|
|
13
|
-
TEST_PROCESSES_SOURCE_PATH = "#{File.expand_path(File.dirname(__FILE__))}/../../spec/build/processes_source_test"
|
|
14
|
-
|
|
15
|
-
TEST_ACTIONS_DEFINITION_PATH = "#{File.expand_path(File.dirname(__FILE__))}/../../spec/build/actions_dsl_test"
|
|
16
|
-
TEST_ACTIONS_INCORRECT_DEFINITION_PATH = "#{File.expand_path(File.dirname(__FILE__))}/../../spec/build/action_dsl_test/incorrect"
|
|
17
|
-
TEST_ACTIONS_SOURCE_PATH = "#{File.expand_path(File.dirname(__FILE__))}/../../spec/build/actions_source_test"
|
|
18
|
-
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
end
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
require "spec_helper"
|
|
2
|
-
require_relative "../../lib/stuka/internal/action_builder"
|
|
3
|
-
require_relative "../../lib/stuka/stuka_paths"
|
|
4
|
-
|
|
5
|
-
describe "ActionBuilder" do
|
|
6
|
-
|
|
7
|
-
around(:each) do |example|
|
|
8
|
-
FileUtils.rm_rf("#{Stuka::StukaPaths::TEST_ACTIONS_SOURCE_PATH}/.", secure: true)
|
|
9
|
-
example.run
|
|
10
|
-
FileUtils.rm_rf("#{Stuka::StukaPaths::TEST_ACTIONS_SOURCE_PATH}/.", secure: true)
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
it "builds ruby source with ProcessBuilder::build" do
|
|
14
|
-
Stuka::ActionBuilder.build
|
|
15
|
-
|
|
16
|
-
source_files = Dir["#{Stuka::StukaPaths::ACTIONS_SOURCE_PATH}/*.rb"]
|
|
17
|
-
source_files = source_files.map{ |path| File.basename(path) }
|
|
18
|
-
expect(source_files.count).to eq(2)
|
|
19
|
-
expect(source_files.include? "acc1_action.rb").to be(true)
|
|
20
|
-
expect(source_files.include? "acc2_action.rb").to be(true)
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
end
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
require "spec_helper"
|
|
2
|
-
require_relative "../../lib/stuka/internal/action_incubator"
|
|
3
|
-
require_relative "../../lib/stuka/stuka_paths"
|
|
4
|
-
|
|
5
|
-
describe Stuka::ActionIncubator do
|
|
6
|
-
|
|
7
|
-
it "ActionIncubator#action, it creates an action and stores it in @actions attribute, this are the methods called in the dsl." do
|
|
8
|
-
act_incubator = Stuka::ActionIncubator.new
|
|
9
|
-
|
|
10
|
-
act_incubator.action("new_action1") do
|
|
11
|
-
description "desc1"
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
act_incubator.action("new_action2") do
|
|
15
|
-
description "desc2"
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
expect(act_incubator.actions.count).to eq(2)
|
|
19
|
-
act1 = act_incubator.actions.first
|
|
20
|
-
expect(act1.name).to eq("new_action1")
|
|
21
|
-
expect(act1.description).to eq("desc1")
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
end
|
data/spec/build/dsl_spec.rb
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
require "spec_helper"
|
|
2
|
-
require_relative "../../lib/stuka/internal/process_incubator"
|
|
3
|
-
require_relative "../../lib/stuka/internal/action_incubator"
|
|
4
|
-
require_relative "../../lib/stuka/stuka_paths"
|
|
5
|
-
|
|
6
|
-
describe "processes dsl test" do
|
|
7
|
-
|
|
8
|
-
context "when dsl syntax is correct" do
|
|
9
|
-
it "ProcessIncubator#incubate evaluates correct test files" do
|
|
10
|
-
proc_incubator = Stuka::ProcessIncubator.new
|
|
11
|
-
proc_incubator.incubate
|
|
12
|
-
expect(proc_incubator.processes.count).to eq(2)
|
|
13
|
-
expect(proc_incubator.processes.map(&:name).include? "test1").to be true
|
|
14
|
-
expect(proc_incubator.processes.map(&:name).include? "test2").to be true
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
it "ActionIncubator#incubate evaluates correct test dsl files" do
|
|
18
|
-
act_incubator = Stuka::ActionIncubator.new
|
|
19
|
-
act_incubator.incubate
|
|
20
|
-
expect(act_incubator.actions.count).to eq(2)
|
|
21
|
-
expect(act_incubator.actions.map(&:name).include? "acc1").to be true
|
|
22
|
-
expect(act_incubator.actions.map(&:name).include? "acc2").to be true
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
context "when dsl syntax is incorrect" do
|
|
27
|
-
|
|
28
|
-
before(:each) do
|
|
29
|
-
Stuka::StukaPaths::PROCESSES_DEFINITION_PATH.replace Stuka::StukaPaths::TEST_PROCESSES_INCORRECT_DEFINITION_PATH
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
it "ProcessIncubator#incubate evaluates bad test files" do
|
|
33
|
-
proc_incubator = Stuka::ProcessIncubator.new
|
|
34
|
-
expect{proc_incubator.incubate}.to raise_error
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
it "ActionIncubator#incubate evaluates bad test files" do
|
|
38
|
-
act_incubator = Stuka::ActionIncubator.new
|
|
39
|
-
expect{act_incubator.incubate}.to raise_error
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
end
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
require "spec_helper"
|
|
2
|
-
require_relative "../../lib/stuka/internal/process_incubator"
|
|
3
|
-
require_relative "../../lib/stuka/stuka_paths"
|
|
4
|
-
|
|
5
|
-
describe Stuka::ProcessIncubator do
|
|
6
|
-
|
|
7
|
-
it "ProcessIncubator#process, it creates a process and stores it in @processes attribute, this are the methods called in the dsl." do
|
|
8
|
-
proc_incubator = Stuka::ProcessIncubator.new
|
|
9
|
-
|
|
10
|
-
proc_incubator.process("new_process1") do
|
|
11
|
-
description "desc1"
|
|
12
|
-
arguments ["arg1", "arg2"]
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
proc_incubator.process("new_process2") do
|
|
16
|
-
description "desc2"
|
|
17
|
-
arguments ["arg1", "arg2"]
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
expect(proc_incubator.processes.count).to eq(2)
|
|
21
|
-
proc1 = proc_incubator.processes.first
|
|
22
|
-
expect(proc1.name).to eq("new_process1")
|
|
23
|
-
expect(proc1.description).to eq("desc1")
|
|
24
|
-
expect(proc1.arguments).to eq(["arg1", "arg2"])
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
end
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
require "spec_helper"
|
|
2
|
-
require_relative "../../lib/stuka/internal/validator"
|
|
3
|
-
require_relative "../../lib/stuka/internal/process"
|
|
4
|
-
|
|
5
|
-
describe "Validator" do
|
|
6
|
-
|
|
7
|
-
let(:valid_process) { Stuka::Process.new("pr1", "pr2_desc", ["arg1", "arg2"]) }
|
|
8
|
-
let(:valid_process2) { Stuka::Process.new("pr2", "pr2_desc", []) }
|
|
9
|
-
|
|
10
|
-
let(:invalid_process) { Stuka::Process.new("pr3", nil, ["arg1", "arg2"]) }
|
|
11
|
-
let(:invalid_process2) { Stuka::Process.new("", "description", ["arg1", "arg2"]) }
|
|
12
|
-
|
|
13
|
-
context "when testing single process" do
|
|
14
|
-
|
|
15
|
-
it "Validator::process_valid?" do
|
|
16
|
-
expect(Stuka::Validator.process_valid? valid_process).to eq(true)
|
|
17
|
-
expect(Stuka::Validator.process_valid? valid_process2).to eq(true)
|
|
18
|
-
expect(Stuka::Validator.process_valid? invalid_process).to eq(false)
|
|
19
|
-
expect(Stuka::Validator.process_valid? invalid_process2).to eq(false)
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
context "when testing process sets" do
|
|
25
|
-
|
|
26
|
-
let(:valid_process_set) { [valid_process, valid_process2] }
|
|
27
|
-
let(:invalid_process_set) { [valid_process, valid_process, valid_process2] }
|
|
28
|
-
let(:invalid_process_set2) { [valid_process, valid_process, nil] }
|
|
29
|
-
let(:invalid_process_set3) { [valid_process, valid_process2, invalid_process2] }
|
|
30
|
-
|
|
31
|
-
it "Validator::process_set_valid? checks if all processes have different names" do
|
|
32
|
-
expect(Stuka::Validator.process_set_valid? valid_process_set).to eq(true)
|
|
33
|
-
expect(Stuka::Validator.process_set_valid? invalid_process_set).to eq(false)
|
|
34
|
-
expect(Stuka::Validator.process_set_valid? invalid_process_set2).to eq(false)
|
|
35
|
-
expect(Stuka::Validator.process_set_valid? invalid_process_set3).to eq(false)
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
end
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
require "spec_helper"
|
|
2
|
-
require_relative "../../lib/stuka/stuka_cli"
|
|
3
|
-
require 'fileutils'
|
|
4
|
-
|
|
5
|
-
describe "process command" do
|
|
6
|
-
|
|
7
|
-
around(:each) do |example|
|
|
8
|
-
Stuka::StukaCli.start ["new", "test_pro"]
|
|
9
|
-
example.run
|
|
10
|
-
FileUtils.rm_rf 'test_pro'
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
it "sets up the project" do
|
|
14
|
-
Dir.chdir "test_pro" do
|
|
15
|
-
expect { Stuka::StukaCli.start ["process", "test_process"] }.to output(%r|Process test_process created|).to_stdout
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
end
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
require "spec_helper"
|
|
2
|
-
require_relative "../../lib/stuka/stuka_cli"
|
|
3
|
-
require 'fileutils'
|
|
4
|
-
|
|
5
|
-
describe "step command" do
|
|
6
|
-
|
|
7
|
-
around(:each) do |example|
|
|
8
|
-
Stuka::StukaCli.start ["new", "test_pro"]
|
|
9
|
-
example.run
|
|
10
|
-
FileUtils.rm_rf 'test_pro'
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
it "sets up the project" do
|
|
14
|
-
Dir.chdir "test_pro" do
|
|
15
|
-
expect { Stuka::StukaCli.start ["step", "test_namespace", "test_action"] }.to output(%r|Action test_namespace::test_action created|).to_stdout
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
end
|