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.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -1
  3. data/lib/stuka/commands/command.rb +0 -8
  4. data/lib/stuka/commands/public_commands/new_command.rb +0 -1
  5. data/lib/stuka/commands/public_commands/process_command.rb +2 -2
  6. data/lib/stuka/commands/public_commands/setup_command.rb +3 -4
  7. data/lib/stuka/{stuka_cli.rb → commands/stuka_cli.rb} +4 -4
  8. data/lib/stuka/commands/subcommands/create/{create_process.rb → create_process_file.rb} +3 -3
  9. data/lib/stuka/commands/subcommands/setup/setup_directories.rb +6 -6
  10. data/lib/stuka/external/action_finder.rb +25 -0
  11. data/lib/stuka/external/business_action.rb +18 -0
  12. data/lib/stuka/external/business_process.rb +85 -0
  13. data/lib/stuka/external/dispatcher.rb +27 -0
  14. data/lib/stuka/external/process_states/finished_state.rb +13 -0
  15. data/lib/stuka/external/process_states/inactive_state.rb +16 -0
  16. data/lib/stuka/external/process_states/started_state.rb +21 -0
  17. data/lib/stuka/external/process_states/starting_state.rb +16 -0
  18. data/lib/stuka/external/unknown_action.rb +9 -0
  19. data/lib/stuka/internal/domain/action.rb +32 -0
  20. data/lib/stuka/internal/domain/domain.rb +29 -0
  21. data/lib/stuka/internal/domain/process.rb +32 -0
  22. data/lib/stuka/internal/domain_builders/action_domain_builder.rb +19 -0
  23. data/lib/stuka/internal/domain_builders/domain_builder.rb +32 -0
  24. data/lib/stuka/internal/domain_builders/process_domain_builder.rb +17 -0
  25. data/lib/stuka/internal/process_cleaner.rb +0 -2
  26. data/lib/stuka/internal/source_builders/action_builder.rb +32 -0
  27. data/lib/stuka/internal/source_builders/process_builder.rb +38 -0
  28. data/lib/stuka/internal/source_builders/source_builder.rb +14 -0
  29. data/lib/stuka/internal/validator.rb +22 -7
  30. data/lib/stuka/paths/stuka_paths.rb +18 -0
  31. data/lib/stuka/templates/source/process.tt +18 -3
  32. data/lib/stuka/version.rb +2 -2
  33. data/lib/stuka.rb +0 -1
  34. data/spec/{commands → aceptance/commands}/new_command_spec.rb +1 -1
  35. data/spec/aceptance/commands/process_command_spec.rb +22 -0
  36. data/spec/{commands → aceptance/commands}/setup_command_spec.rb +1 -1
  37. data/spec/aceptance/external/action_aceptance_spec.rb +24 -0
  38. data/spec/aceptance/external/feed_cat_process_aceptance_spec.rb +46 -0
  39. data/spec/aceptance/external/processes/cat/check_food.rb +14 -0
  40. data/spec/aceptance/external/processes/cat/fill_up_plate.rb +14 -0
  41. data/spec/aceptance/external/processes/cat/go_to_store.rb +14 -0
  42. data/spec/aceptance/external/processes/feed_cat_process.rb +28 -0
  43. data/spec/spec_helper.rb +10 -2
  44. data/spec/unit/external/example_source/create_world.rb +28 -0
  45. data/spec/unit/external/example_source/kill_monster.rb +38 -0
  46. data/spec/unit/external/example_source/world/gather_materials.rb +13 -0
  47. data/spec/unit/external/example_source/world/scrap_world.rb +13 -0
  48. data/spec/unit/external/example_source/world/seperate_light_from_darkness.rb +13 -0
  49. data/spec/unit/external/finder_spec.rb +37 -0
  50. data/spec/unit/external/process_interface.rb +9 -0
  51. data/spec/unit/external/process_to_action.rb +61 -0
  52. data/spec/unit/external/process_to_dispatcher_spec.rb +35 -0
  53. data/spec/unit/external/process_to_finder_spec.rb +138 -0
  54. data/spec/{build/process_builder_spec.rb → unit/internal/action_builder_spec.rb} +6 -7
  55. data/spec/unit/internal/action_domain_builder_spec.rb +44 -0
  56. data/spec/unit/internal/action_spec.rb +14 -0
  57. data/spec/unit/internal/process_builder_spec.rb +44 -0
  58. data/spec/{build → unit/internal}/process_cleaner_spec.rb +2 -3
  59. data/spec/unit/internal/process_domain_builder_spec.rb +51 -0
  60. data/spec/unit/internal/process_spec.rb +14 -0
  61. data/spec/unit/internal/process_validator_spec.rb +42 -0
  62. data/spec/{build → unit/internal}/processes_dsl_test/correct_test_process.rb +12 -5
  63. data/stuka.gemspec +1 -1
  64. metadata +82 -41
  65. data/lib/stuka/commands/public_commands/step_command.rb +0 -25
  66. data/lib/stuka/commands/subcommands/create/create_action.rb +0 -16
  67. data/lib/stuka/internal/action.rb +0 -33
  68. data/lib/stuka/internal/action_builder.rb +0 -31
  69. data/lib/stuka/internal/action_incubator.rb +0 -37
  70. data/lib/stuka/internal/process.rb +0 -38
  71. data/lib/stuka/internal/process_builder.rb +0 -30
  72. data/lib/stuka/internal/process_incubator.rb +0 -37
  73. data/lib/stuka/stuka_paths.rb +0 -21
  74. data/lib/stuka/templates/definitions/step.tt +0 -8
  75. data/spec/build/action_builder_spec.rb +0 -23
  76. data/spec/build/action_incubator_spec.rb +0 -24
  77. data/spec/build/dsl_spec.rb +0 -44
  78. data/spec/build/process_incubator_spec.rb +0 -27
  79. data/spec/build/process_validator_spec.rb +0 -40
  80. data/spec/commands/process_command_spec.rb +0 -19
  81. data/spec/commands/step_command_spec.rb +0 -19
  82. /data/spec/{build/processes_dsl_test/incorrect → unit/internal/processes_dsl_test_incorrect}/incorrect_test_process.rb +0 -0
@@ -1,35 +1,50 @@
1
- require_relative 'process'
1
+ require 'stuka/internal/domain/process'
2
2
 
3
3
  module Stuka
4
4
 
5
5
  class Validator
6
6
 
7
- def self.process_valid?(process)
7
+ attr_reader :message
8
+
9
+ def process_valid?(process)
8
10
 
9
11
  Stuka::Process::ATTRS.each do |arg|
10
12
  result = process.public_send(arg.to_sym)
11
- return false if result.nil?
13
+ if result.nil?
14
+ @message = "#{process} does not all required attributes"
15
+ return false
16
+ end
12
17
  end
13
18
 
14
19
  Stuka::Process::REQUIRED_ATTRS.each do |arg|
15
20
  result = process.public_send(arg.to_sym)
16
- return false if result.nil? || result.empty?
21
+ if result.nil? || result.empty?
22
+ @mesasge = "#{process} has empty values of required attributes"
23
+ return false
24
+ end
17
25
  end
18
26
 
19
27
  true
20
28
  end
21
29
 
22
- def self.process_set_valid?(processes)
30
+ def process_set_valid?(processes)
23
31
 
24
- return false if processes.include? nil
32
+ if processes.include? nil
33
+ @message = "processes include nil"
34
+ return false
35
+ end
25
36
 
26
37
  names = processes.map(&:name)
27
38
 
28
- return false if names.include?(nil) || names.include?("")
39
+ if names.include?(nil) || names.include?("")
40
+ @message = "some processes have no name or empty name"
41
+ return false
42
+ end
29
43
 
30
44
  if names.uniq.length == names.length
31
45
  return true
32
46
  else
47
+ @message = "multiple processes with same name defined"
33
48
  return false
34
49
  end
35
50
  end
@@ -0,0 +1,18 @@
1
+ module Stuka
2
+
3
+ module StukaPaths
4
+
5
+ PROCESSES_DEFINITION_PATH = "#{Dir.pwd}/process_definition"
6
+
7
+ PROCESSES_SOURCE_PATH = "#{Dir.pwd}/processes"
8
+
9
+ TEST_PROCESSES_DEFINITION_PATH = "#{File.expand_path(File.dirname(__FILE__))}/../../../spec/unit/internal/processes_dsl_test"
10
+ TEST_PROCESSES_INCORRECT_DEFINITION_PATH = "#{File.expand_path(File.dirname(__FILE__))}/../../../spec/unit/internal/processes_dsl_test_incorrect"
11
+
12
+ TEST_PROCESSES_SOURCE_PATH = "#{File.expand_path(File.dirname(__FILE__))}/../../../spec/unit/internal/processes_source_test"
13
+
14
+ TEMPLATES_PATH = "#{File.expand_path(File.dirname(__FILE__))}/../templates"
15
+
16
+ end
17
+
18
+ end
@@ -1,8 +1,23 @@
1
- class <%= @name.capitalize %>Process
1
+ require 'stuka/external/business_process'
2
2
 
3
- def initialize <%= @arguments.join(', ') %>
4
- <% for arg in @arguments %>@<%= arg %> = <%= arg %>
3
+ class <%= @name.capitalize %> < Stuka::BusinessProcess
4
+
5
+ TRANSITION_MAP = {
6
+ <% @transitions.keys.each do |action| %>
7
+ "<%= action %>" => {
8
+ <% @transitions[action].keys.each do |action_transition| %>
9
+ <%= action_transition %>: "<%= @transitions[action][action_transition] %>",
10
+ <% end %>
11
+ },
5
12
  <% end %>
13
+ }
14
+
15
+ def transition_map
16
+ TRANSITION_MAP
17
+ end
18
+
19
+ def start_action
20
+ "<%= @start_action %>"
6
21
  end
7
22
 
8
23
  end
data/lib/stuka/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Stuka
2
- VERSION = "0.0.10"
3
- end
2
+ VERSION = "0.0.11"
3
+ end
data/lib/stuka.rb CHANGED
@@ -1,2 +1 @@
1
1
  require_relative "stuka/version"
2
- require_relative "stuka/stuka_cli"
@@ -1,5 +1,5 @@
1
1
  require "spec_helper"
2
- require_relative "../../lib/stuka/stuka_cli"
2
+ require "stuka/commands/stuka_cli"
3
3
  require 'fileutils'
4
4
 
5
5
  describe "new command" do
@@ -0,0 +1,22 @@
1
+ require "spec_helper"
2
+ require "stuka/commands/stuka_cli"
3
+ require 'fileutils'
4
+
5
+ describe "process file 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 file 'test_process.rb' created|).to_stdout
16
+
17
+ definition_files = Dir["#{Stuka::StukaPaths::PROCESSES_DEFINITION_PATH}/**/*.rb"]
18
+ expect { definition_files.to include("#{Stuka::StukaPaths::PROCESSES_DEFINITION_PATH}/test_process.rb}") }
19
+ end
20
+ end
21
+
22
+ end
@@ -1,5 +1,5 @@
1
1
  require "spec_helper"
2
- require_relative "../../lib/stuka/stuka_cli"
2
+ require "stuka/commands/stuka_cli"
3
3
  require 'fileutils'
4
4
 
5
5
  describe "setup command" do
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+ require "stuka/external/business_action"
3
+ require_relative 'processes/cat/check_food'
4
+
5
+ describe "CheckFood" do
6
+
7
+ let(:process) { double(transition: nil, can_transition_to?: true) }
8
+ let(:outstream) { StringIO.new }
9
+ let(:action) { Cat::CheckFood.new(process) }
10
+
11
+ after :each do
12
+ outstream.close
13
+ end
14
+
15
+ it "calls the process if it succeeds" do
16
+
17
+ expect(process).to receive :transition
18
+ action.run({name: "George", outstream: outstream})
19
+ expect(outstream.string).to include "There is enaugh food"
20
+
21
+ end
22
+
23
+
24
+ end
@@ -0,0 +1,46 @@
1
+ require 'spec_helper'
2
+ require 'stuka/external/business_process'
3
+ require_relative 'processes/feed_cat_process'
4
+
5
+ describe "Feed cat process" do
6
+
7
+ before :each do
8
+ Stuka::StukaPaths::PROCESSES_SOURCE_PATH.replace "#{File.dirname(__FILE__)}/processes"
9
+ end
10
+
11
+ let(:process) do
12
+
13
+ FeedCatProcess.new({}) do |on|
14
+
15
+ on.success { |params|
16
+ params[:outstream].puts "yay success"
17
+ }
18
+
19
+ on.failure { |params|
20
+ params[:outstream].puts "nay failure"
21
+ }
22
+
23
+ end
24
+
25
+ end
26
+
27
+ let(:outstream) { StringIO.new }
28
+
29
+ after :each do
30
+ outstream.close
31
+ end
32
+
33
+ it "process starts executing actions when it ran" do
34
+
35
+ expect(process.current_state).to eq(Stuka::BusinessProcess::PROCESS_STATES[:inactive])
36
+
37
+ process.run({name: "George", outstream: outstream})
38
+
39
+ expect(process.current_state).to eq(Stuka::BusinessProcess::PROCESS_STATES[:finished])
40
+
41
+ expect(outstream.string).to include "There is enaugh food\nGeorge's food plate filled up\nyay success\n"
42
+
43
+ end
44
+
45
+
46
+ end
@@ -0,0 +1,14 @@
1
+ require "stuka/external/business_action"
2
+
3
+ module Cat
4
+
5
+ class CheckFood < Stuka::BusinessAction
6
+
7
+ def run(params)
8
+ params[:outstream].puts "There is enaugh food"
9
+ has_food(params)
10
+ end
11
+
12
+ end
13
+
14
+ end
@@ -0,0 +1,14 @@
1
+ require "stuka/external/business_action"
2
+
3
+ module Cat
4
+
5
+ class FillUpPlate < Stuka::BusinessAction
6
+
7
+ def run(params)
8
+ params[:outstream].puts "#{params[:name]}'s food plate filled up"
9
+ success(params)
10
+ end
11
+
12
+ end
13
+
14
+ end
@@ -0,0 +1,14 @@
1
+ require "stuka/external/business_action"
2
+
3
+ module Cat
4
+
5
+ class GoToStore < Stuka::BusinessAction
6
+
7
+ def run(params)
8
+ params[:outstream].puts "went to store"
9
+ success(params)
10
+ end
11
+
12
+ end
13
+
14
+ end
@@ -0,0 +1,28 @@
1
+ require "stuka/external/business_process"
2
+
3
+ class FeedCatProcess < Stuka::BusinessProcess
4
+
5
+ TRANSITION_MAP = {
6
+ "cat::check_food" => {
7
+ has_food: "cat::fill_up_plate",
8
+ no_food: "cat::go_to_store"
9
+ },
10
+ "cat::fill_up_plate" => {
11
+ success: "process::success",
12
+ failure: "process::failure"
13
+ },
14
+ "cat::go_to_store" => {
15
+ success: "cat::fill_up_plate",
16
+ failure: "process::failure"
17
+ }
18
+ }
19
+
20
+ def transition_map
21
+ TRANSITION_MAP
22
+ end
23
+
24
+ def start_action
25
+ "cat::check_food"
26
+ end
27
+
28
+ end
data/spec/spec_helper.rb CHANGED
@@ -19,10 +19,18 @@ RSpec.configure do |config|
19
19
  # with RSpec, but feel free to customize to your heart's content.
20
20
 
21
21
  config.before(:each) do
22
- require_relative "../lib/stuka/stuka_paths"
22
+ require "stuka/paths/stuka_paths"
23
23
  Stuka::StukaPaths::PROCESSES_DEFINITION_PATH.replace Stuka::StukaPaths::TEST_PROCESSES_DEFINITION_PATH
24
24
  Stuka::StukaPaths::PROCESSES_SOURCE_PATH.replace Stuka::StukaPaths::TEST_PROCESSES_SOURCE_PATH
25
- Stuka::StukaPaths::ACTIONS_SOURCE_PATH.replace Stuka::StukaPaths::TEST_ACTIONS_SOURCE_PATH
25
+ end
26
+
27
+ original_stdout = $stdout
28
+ config.before(:all) do
29
+ # Redirect stderr and stdout
30
+ $stdout = File.new(File.join(File.dirname(__FILE__), 'stdout.txt'), 'w')
31
+ end
32
+ config.after(:all) do
33
+ $stdout = original_stdout
26
34
  end
27
35
 
28
36
  =begin
@@ -0,0 +1,28 @@
1
+ require "stuka/external/business_process"
2
+
3
+ class CreateWorld < Stuka::BusinessProcess
4
+
5
+ TRANSITION_MAP = {
6
+ "world::gather_materials" => {
7
+ success: "world::seperate_light_from_darkness",
8
+ failure: "world::scrap_world"
9
+ },
10
+ "world::seperate_light_from_darkness" => {
11
+ success: "process::success",
12
+ failure: "world::scrap_world"
13
+ },
14
+ "world::scrap_world" => {
15
+ success: "process::failure",
16
+ failure: "process::failure"
17
+ }
18
+ }
19
+
20
+ def transition_map
21
+ TRANSITION_MAP
22
+ end
23
+
24
+ def start_action
25
+ "world::gather_materials"
26
+ end
27
+
28
+ end
@@ -0,0 +1,38 @@
1
+ require "stuka/external/business_process"
2
+
3
+ class KillMonster < Stuka::BusinessProcess
4
+
5
+ TRANSITION_MAP = {
6
+ "monster::train_hard" => {
7
+ good_with_sword: "monster::get_a_sharp_sword",
8
+ sharp_shooter: "monster::get_a_new_gun",
9
+ failure: "monster::train_fast_running"
10
+ },
11
+ "monster::get_a_sharp_sword" => {
12
+ success: "process::success",
13
+ failure: "process::failure"
14
+ },
15
+ "monster::get_a_new_gun" => {
16
+ success: "gun::get_bullets",
17
+ failure: "process::failure"
18
+ },
19
+ "gun::get_bullets" => {
20
+ success: "process::success",
21
+ failure: "process::failure"
22
+ },
23
+ "monster::train_fast_running" => {
24
+ success: "process::success",
25
+ failure: "process::failure"
26
+ }
27
+
28
+ }
29
+
30
+ def transition_map
31
+ TRANSITION_MAP
32
+ end
33
+
34
+ def start_action
35
+ "monster::train_hard"
36
+ end
37
+
38
+ end
@@ -0,0 +1,13 @@
1
+ require "stuka/external/business_action"
2
+
3
+ module World
4
+
5
+ class GatherMaterials < Stuka::BusinessAction
6
+
7
+ def run(params = {})
8
+ success(params)
9
+ end
10
+
11
+ end
12
+
13
+ end
@@ -0,0 +1,13 @@
1
+ require "stuka/external/business_action"
2
+
3
+ module World
4
+
5
+ class ScrapWorld < Stuka::BusinessAction
6
+
7
+ def run(params = {})
8
+ success(params)
9
+ end
10
+
11
+ end
12
+
13
+ end
@@ -0,0 +1,13 @@
1
+ require "stuka/external/business_action"
2
+
3
+ module World
4
+
5
+ class SeperateLightFromDarkness < Stuka::BusinessAction
6
+
7
+ def run(params = {})
8
+ failure(params)
9
+ end
10
+
11
+ end
12
+
13
+ end
@@ -0,0 +1,37 @@
1
+ require "spec_helper"
2
+ require "unit/external/example_source/create_world"
3
+ require "unit/external/process_interface"
4
+ require "stuka/external/action_finder"
5
+
6
+ require "unit/external/example_source/world/gather_materials"
7
+ require "unit/external/example_source/world/scrap_world"
8
+ require "unit/external/example_source/world/seperate_light_from_darkness"
9
+
10
+ describe Stuka::ActionFinder do
11
+
12
+ let(:finder) { Stuka::ActionFinder.new }
13
+ let(:process) { double() }
14
+
15
+ before :each do
16
+ Stuka::StukaPaths::PROCESSES_SOURCE_PATH.replace "#{File.dirname(__FILE__)}/example_source"
17
+ end
18
+
19
+ it "finds actions" do
20
+ gather_materials = finder.find_action("world::gather_materials", process)
21
+ expect(gather_materials.class).to be(World::GatherMaterials)
22
+ expect(gather_materials.process).to be(process)
23
+
24
+ scrap_world = finder.find_action("world::scrap_world", process)
25
+ expect(scrap_world.class).to be(World::ScrapWorld)
26
+ expect(scrap_world.process).to be(process)
27
+
28
+ seperate_light_from_darkness = finder.find_action("world::seperate_light_from_darkness", process)
29
+ expect(seperate_light_from_darkness.class).to be(World::SeperateLightFromDarkness)
30
+ expect(seperate_light_from_darkness.process).to be(process)
31
+ end
32
+
33
+ it "throws an UnknownAction error if it can't find the action class" do
34
+ expect { finder.find_action("some::unknown_action", process) }.to raise_error(Stuka::UnknownAction)
35
+ end
36
+
37
+ end
@@ -0,0 +1,9 @@
1
+ shared_examples "a process" do
2
+
3
+ let(:runnable) { described_class.new }
4
+
5
+ it "responds to run" do
6
+ expect(runnable).to respond_to(:run)
7
+ end
8
+
9
+ end
@@ -0,0 +1,61 @@
1
+ require "spec_helper"
2
+ require "unit/external/example_source/create_world"
3
+ require "unit/external/process_interface"
4
+ require "stuka/external/business_process"
5
+
6
+ require "unit/external/example_source/world/gather_materials"
7
+ require "unit/external/example_source/world/scrap_world"
8
+ require "unit/external/example_source/world/seperate_light_from_darkness"
9
+
10
+ describe CreateWorld do
11
+
12
+ it_behaves_like "a process"
13
+
14
+ let(:stream) { double(puts: nil) }
15
+ let(:param2) { double(param_method: nil) }
16
+
17
+ let(:gather_materials) { double(process: process) }
18
+ let(:seperate_light_from_darkness) { double(process: process) }
19
+ let(:scrap_world) { double(process: process) }
20
+
21
+
22
+ let(:process) do
23
+
24
+ CreateWorld.new() do |on|
25
+
26
+ on.success {
27
+ puts "yay success"
28
+ }
29
+ on.failure {
30
+ puts "nay failure"
31
+ }
32
+
33
+ end
34
+
35
+ end
36
+
37
+ before :each do
38
+
39
+ allow(gather_materials).to receive(:run) { process.transition({stream: stream, param2: param2}, :success) }
40
+ allow(seperate_light_from_darkness).to receive(:run) { process.transition({stream: stream}, :failure) }
41
+ allow(scrap_world).to receive(:run) { process.transition({stream: stream}, :success) }
42
+
43
+ end
44
+
45
+ it "starts the process with BusinessProcess#run" do
46
+
47
+ expect(World::GatherMaterials).to receive(:new).and_return(gather_materials)
48
+ expect(World::SeperateLightFromDarkness).to receive(:new).and_return(seperate_light_from_darkness)
49
+ expect(World::ScrapWorld).to receive(:new).and_return(scrap_world)
50
+
51
+ expect(gather_materials).to receive(:run).with({stream: stream, param2: param2})
52
+ expect(seperate_light_from_darkness).to receive(:run).with({stream: stream, param2: param2})
53
+ expect(scrap_world).to receive(:run).with({stream: stream})
54
+
55
+ process.run({stream: stream, param2: param2})
56
+
57
+ expect(process.current_state).to eq Stuka::BusinessProcess::PROCESS_STATES[:finished]
58
+
59
+ end
60
+
61
+ end
@@ -0,0 +1,35 @@
1
+ require "spec_helper"
2
+ require_relative "example_source/create_world"
3
+ require "stuka/external/business_process"
4
+
5
+ describe "ExampleProcess" do
6
+
7
+ let(:dispatcher) { double(success: "", failure: "", can_end_with?: true) }
8
+ let(:process) do
9
+
10
+ CreateWorld.new(dispatcher: dispatcher) do |on|
11
+
12
+ on.success {
13
+ puts "yay success"
14
+ }
15
+ on.failure {
16
+ puts "nay failure"
17
+ }
18
+
19
+ end
20
+
21
+ end
22
+
23
+ before :each do
24
+ Stuka::StukaPaths::PROCESSES_SOURCE_PATH.replace "#{File.dirname(__FILE__)}/example_source"
25
+ end
26
+
27
+ it "notifies the dispatcher of any other end event" do
28
+ expect(dispatcher).to receive(:can_end_with?).with(:failure)
29
+ expect(dispatcher).to receive(:call).with(:failure, {})
30
+ process.run({})
31
+
32
+ expect(process.current_state).to eq(Stuka::BusinessProcess::PROCESS_STATES[:finished])
33
+ end
34
+
35
+ end