|
28 | 28 | end |
29 | 29 |
|
30 | 30 | describe ".remove_state" do |
31 | | - subject(:remove_state) { -> { machine.remove_state(:x) } } |
| 31 | + subject(:remove_state) { machine.remove_state(:x) } |
32 | 32 |
|
33 | 33 | before do |
34 | 34 | machine.class_eval do |
|
39 | 39 | end |
40 | 40 |
|
41 | 41 | it "removes the state" do |
42 | | - expect(remove_state). |
| 42 | + expect { remove_state }. |
43 | 43 | to change(machine, :states). |
44 | 44 | from(match_array(%w[x y z])). |
45 | 45 | to(%w[y z]) |
|
49 | 49 | before { machine.transition from: :x, to: :y } |
50 | 50 |
|
51 | 51 | it "removes the transition" do |
52 | | - expect(remove_state). |
| 52 | + expect { remove_state }. |
53 | 53 | to change(machine, :successors). |
54 | 54 | from({ "x" => ["y"] }). |
55 | 55 | to({}) |
|
59 | 59 | before { machine.transition from: :x, to: :z } |
60 | 60 |
|
61 | 61 | it "removes all transitions" do |
62 | | - expect(remove_state). |
| 62 | + expect { remove_state }. |
63 | 63 | to change(machine, :successors). |
64 | 64 | from({ "x" => %w[y z] }). |
65 | 65 | to({}) |
|
71 | 71 | before { machine.transition from: :y, to: :x } |
72 | 72 |
|
73 | 73 | it "removes the transition" do |
74 | | - expect(remove_state). |
| 74 | + expect { remove_state }. |
75 | 75 | to change(machine, :successors). |
76 | 76 | from({ "y" => ["x"] }). |
77 | 77 | to({}) |
|
81 | 81 | before { machine.transition from: :z, to: :x } |
82 | 82 |
|
83 | 83 | it "removes all transitions" do |
84 | | - expect(remove_state). |
| 84 | + expect { remove_state }. |
85 | 85 | to change(machine, :successors). |
86 | 86 | from({ "y" => ["x"], "z" => ["x"] }). |
87 | 87 | to({}) |
|
104 | 104 | end |
105 | 105 |
|
106 | 106 | it "removes the guard" do |
107 | | - expect(remove_state). |
| 107 | + expect { remove_state }. |
108 | 108 | to change(machine, :callbacks). |
109 | 109 | from(a_hash_including(guards: match_array(guards))). |
110 | 110 | to(a_hash_including(guards: [])) |
|
125 | 125 | end |
126 | 126 |
|
127 | 127 | it "removes the guard" do |
128 | | - expect(remove_state). |
| 128 | + expect { remove_state }. |
129 | 129 | to change(machine, :callbacks). |
130 | 130 | from(a_hash_including(guards: match_array(guards))). |
131 | 131 | to(a_hash_including(guards: [])) |
|
0 commit comments