tzu 0.0.2.0 → 0.1.0.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,48 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Tzu::Organizer do
4
- let(:params) { [1, 2, 3] }
5
- let(:commands) { [spy(run!: :step1, command_name: :step1), spy(run!: :step2, command_name: :step2)] }
6
-
7
- let(:organized) do
8
- organized = Class.new do
9
- include Tzu::Organizer
10
-
11
- def initialize(commands)
12
- commands.each { |s| add_step(s) }
13
- end
14
- end
15
-
16
- organized
17
- end
18
-
19
- context 'when organizer is called' do
20
-
21
- it 'calls each step' do
22
- organized.run(params, commands)
23
- commands.each { |s| expect(s).to have_received(:run!).with(params) }
24
- end
25
-
26
- it 'collates result of steps' do
27
- result = organized.run(params, commands)
28
- expect(result.result.step1).to eq(:step1)
29
- expect(result.result.step2).to eq(:step2)
30
- end
31
- end
32
-
33
- context 'when organizer defines parse' do
34
- before do
35
- organized.class_eval do
36
- def parse(result)
37
- 12345
38
- end
39
- end
40
- end
41
-
42
- it 'it parses results from commands' do
43
- result = organized.run(params, commands)
44
- expect(result).to have_attributes(success: true, result: 12345)
45
- end
46
- end
47
-
48
- end