cascadence 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.markdown +105 -5
- data/VERSION +1 -1
- data/cascadence.gemspec +1 -1
- data/lib/cascadence/commander.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 097b2dcaacefb8ed9c0fefa622e501174aa357a6
|
4
|
+
data.tar.gz: d641fdc2c1e2ef83684352001a7c03605a32110f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f63f292372764f6854342b1d435749a4e690be338c4b47776cf5e6341c0ce54ed12a1c2804fa85fd2f8cfacec3327a9430be45b7a361676ab3a4fd81dfdd60f3
|
7
|
+
data.tar.gz: 64f3ba4d94614a78ea33f0a61cbcc9e0b839205860bfe73cc57585cf50381223d68f7a806cc2eca33efd7e3b440c3743a81fb7d61ed0c4f24beb039395d8fa87
|
data/README.markdown
CHANGED
@@ -1,13 +1,113 @@
|
|
1
|
-
|
1
|
+
cascadence
|
2
|
+
=
|
2
3
|
|
3
4
|
Helper for organizing flow-based specs for such things as writing integration tests with rspec-capybara
|
4
5
|
|
6
|
+
Example Usage
|
7
|
+
=
|
8
|
+
Suppose you have the files:
|
9
|
+
|
10
|
+
```
|
11
|
+
flows
|
12
|
+
|- spam
|
13
|
+
| |- spam_flow.rb
|
14
|
+
| |- hard_spam_flow.rb
|
15
|
+
|- spam.rb
|
16
|
+
|- flow_helper.rb
|
17
|
+
```
|
18
|
+
|
19
|
+
1. spam_flow.rb
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
module Spam
|
23
|
+
class SpamFlow < Cascadence::Flow
|
24
|
+
|
25
|
+
cascading_order :step1, :step2, :step3
|
26
|
+
|
27
|
+
def initialize(zero_state)
|
28
|
+
self.state = zero_state
|
29
|
+
end
|
30
|
+
|
31
|
+
def step1
|
32
|
+
self.state += 1
|
33
|
+
end
|
34
|
+
|
35
|
+
def step2
|
36
|
+
_modifiy_state_in_some_way
|
37
|
+
end
|
38
|
+
|
39
|
+
def step3
|
40
|
+
# more state modification
|
41
|
+
end
|
42
|
+
|
43
|
+
private
|
44
|
+
|
45
|
+
def _modify_state_in_some_way
|
46
|
+
# do stuff with self.state
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
```
|
51
|
+
|
52
|
+
1.5. hard_spam_flow.rb
|
53
|
+
|
54
|
+
```ruby
|
55
|
+
module Spam
|
56
|
+
class HardSpamFlow < SpamFlow
|
57
|
+
fork_after :step1
|
58
|
+
merge_before :step2
|
59
|
+
cascading_order :step1point25, :step1point5
|
60
|
+
|
61
|
+
def step1point25
|
62
|
+
# modify state
|
63
|
+
end
|
64
|
+
|
65
|
+
def step1point5
|
66
|
+
# modify state
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
```
|
71
|
+
|
72
|
+
2. flow_helper.rb
|
73
|
+
|
74
|
+
```ruby
|
75
|
+
require 'cascadence'
|
76
|
+
require 'spam'
|
77
|
+
require 'capybara'
|
78
|
+
|
79
|
+
Cascadence.config do |config|
|
80
|
+
config.parallel = true # or false
|
81
|
+
config.max_thread_count = 4
|
82
|
+
config.zero_state_generator = lambda { Capybara::Session.new :selenium }
|
83
|
+
end
|
84
|
+
```
|
85
|
+
|
86
|
+
3. spam.rb
|
87
|
+
|
88
|
+
```ruby
|
89
|
+
require 'spam/spam_flow.rb'
|
90
|
+
require 'spam/hard_spam_flow.rb'
|
91
|
+
```
|
92
|
+
|
93
|
+
How to run
|
94
|
+
=
|
95
|
+
|
96
|
+
```sh
|
97
|
+
$ cascadence flows/ # runs all flows
|
98
|
+
$ cascadence flows/spam # runs all flows in the spam folder
|
99
|
+
$ cascadence flows/spam/spam_flow.rb # runs the spam_flow.rb flow
|
100
|
+
```
|
101
|
+
|
5
102
|
Notes
|
6
103
|
=
|
7
104
|
You (I guess that would be me) need to fix how cascadence order is read, right now, the dependence on
|
8
105
|
recursion is extremely resource heavy and definitely a bad idea (if not a target for memory leaks)
|
9
|
-
|
10
|
-
|
106
|
+
|
107
|
+
Update: version 0.2.1 out and still not fixed. You (that would be me) are a major faggot.
|
108
|
+
|
109
|
+
Contributing to cascadence
|
110
|
+
==
|
11
111
|
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
12
112
|
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
13
113
|
* Fork the project.
|
@@ -16,8 +116,8 @@ recursion is extremely resource heavy and definitely a bad idea (if not a target
|
|
16
116
|
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
17
117
|
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
18
118
|
|
19
|
-
|
20
|
-
|
119
|
+
Copyright
|
120
|
+
==
|
21
121
|
Copyright (c) 2013 Thomas Chen. See LICENSE.txt for
|
22
122
|
further details.
|
23
123
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.2
|
data/cascadence.gemspec
CHANGED
data/lib/cascadence/commander.rb
CHANGED
@@ -60,7 +60,7 @@ module Cascadence
|
|
60
60
|
|
61
61
|
def _get_zero_state_generator_from_flow(flow)
|
62
62
|
return flow.zero_state_generator if flow.respond_to? :zero_state_generator
|
63
|
-
return Cascadence.config.zero_state_generator if flow == Object
|
63
|
+
return Cascadence.config.zero_state_generator if flow == Object || !flow.respond_to?(:parent)
|
64
64
|
_get_zero_state_generator_from_flow(flow.parent)
|
65
65
|
end
|
66
66
|
|