cascadence 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
File without changes
@@ -1,184 +1,26 @@
1
1
  require "spec_helper"
2
2
 
3
-
4
3
  describe Cascadence::Commander do
5
4
  let(:lolcat) { Cascadence::Commander.new }
6
5
  context "public api" do
7
6
  describe "#flow" do
8
7
  let(:result) { lolcat.flow File.join(RSpec::FixturePath, "amazon", "madeira_flow.rb") }
9
8
  it "should run the flow stated" do
10
- result.should eq ["zerostate123"]
11
- end
12
- end
13
- end
14
- context "private" do
15
- describe "#_get_zero_state_generator_from_flow" do
16
- module GetZero
17
- def self.zero_state_generator
18
- lambda { "get_zero" }
19
- end
20
- class Fagbar < Cascadence::Flow
21
- class HeyzapFlow < ::Cascadence::Flow
22
- class CrossFlow
23
- class WeHaveToGoDeeper
24
- def self.zero_state_generator
25
- lambda { "we_have_to_go_deeper" }
26
- end
27
- end
28
- end
29
- end
30
- end
31
- end
32
- it "should properly give me parents where applicable" do
33
- GetZero::Fagbar::HeyzapFlow::CrossFlow::WeHaveToGoDeeper.parent.should eq GetZero::Fagbar::HeyzapFlow::CrossFlow
34
- end
35
- it "should give me nil for the outer level" do
36
- GetZero.parent.should == Object
37
- end
38
- let(:result) { lolcat.send "_get_zero_state_generator_from_flow", @flow }
39
- context "warpspeed" do
40
- before :each do
41
- @flow = GetZero::Fagbar::HeyzapFlow::CrossFlow
42
- end
43
- it "should get me the first zero_state_generator" do
44
- result.call.should eq "get_zero"
45
- end
46
- end
47
- context "inception" do
48
- before :each do
49
- @flow = GetZero::Fagbar::HeyzapFlow::CrossFlow::WeHaveToGoDeeper
50
- end
51
- it "should get the closest zero state generator" do
52
- result.call.should eq "we_have_to_go_deeper"
53
- end
54
- end
55
- end
56
- describe "#_absolutize_filepath" do
57
- let(:path) { lolcat.send "_absolutize_filepath", @input }
58
- let(:result) { path.should eq @expected }
59
- context "standard usage" do
60
- before :each do
61
- @input = "dog"
62
- @expected = File.join Dir.pwd, @input
63
- end
64
- it( "should give me an absolute path to the file regardless of existence") { result }
65
- end
66
- context "~" do
67
- before :each do
68
- @input = "~/dogfucker"
69
- @expected = File.join File.expand_path("~"), "dogfucker"
70
- end
71
- it( "should expand the tilde to the absolute path") { result }
72
- end
73
- context "absolute path" do
74
- before :each do
75
- @input = "/home/shinka/something"
76
- @expected = @input
77
- end
78
- it("should not touch the input if it is already absolute") { result }
79
- end
80
- end
81
- describe "#_reasonably_matched?" do
82
- let(:match) { lambda { |s1, s2| lolcat.send "_reasonably_matched?", s1, s2 } }
83
- context "true" do
84
- before :each do
85
- @expectations = {
86
- "Dog::Cat::Bat" => "/dog/cat/bat",
87
- "AssFuck::Shot" => "/ass_fuck/shot",
88
- "Dicker::BatMan::Robin" => "apples/oranges/dicker/bat_man/robin",
89
- "Snot" => "/asdf/asdf/asdf/ff/snot"
90
- }
91
- end
92
- it "should be a reasonable match" do
93
- @expectations.each { |key, val| match.call(key,val).should be_true }
94
- end
95
- end
96
- context "false" do
97
- before :each do
98
- @expectations = {
99
- "Dog::Cat::Bat" => "/fdasf/dog/cat/rat",
100
- "" => "/anything/really" ,
101
- "Dicker::AssMan" => "/fd/dicker/ass_man/something"
102
- }
103
- end
104
- it "should not be reasonable matches" do
105
- @expectations.each { |key,val| match.call(key,val).should_not be_true }
106
- end
9
+ result.should_not be_empty
107
10
  end
108
11
  end
109
- describe "#_get_flow_from_file" do
110
- let(:flow) { lolcat.send "_get_flow_from_file", @file }
111
- let(:expected) { Amazon::MadeiraFlow }
112
- before :each do
113
- @file = File.join RSpec::FixturePath, "amazon", "madeira_flow.rb"
114
- require @file
115
- end
116
- context "standard usage" do
117
- it "should find the flow class in question" do
118
- flow.should eq expected
119
- end
120
- end
121
- describe "#_get_task_from_file" do
122
- let(:task) { lolcat.send("_get_task_from_file", @file) }
123
-
124
- it "should be a lambda" do
125
- task.should respond_to :call
126
- end
127
-
128
- it "should run and give me the correct result" do
129
- task.call.state.should eq "zerostate123"
130
- end
12
+ describe "#version" do
13
+ let(:expected) { File.read File.expand_path("../../../VERSION", __FILE__) }
14
+ let(:actual) { lolcat.version }
15
+ it "should get the version as specified in the VERSION file" do
16
+ actual.should eq expected
131
17
  end
132
18
  end
133
- describe "#_find_flow_helper_from_filepath" do
134
- let(:path) { lolcat.send "_find_flow_helper_from_filepath", @starting }
135
- context "null case" do
136
- before :each do
137
- @starting = File.expand_path __FILE__
138
- end
139
- it "should throw an symbol as it cannot find the flow helper" do
140
- expect { path }.to throw_symbol :NoFlowHelperFound
141
- end
142
- end
143
- context "dumb case" do
144
- before :each do
145
- @starting = File.join RSpec::FixturePath, "flow_helper.rb"
146
- @expected = @starting
147
- end
148
- it "should find it right away" do
149
- path.should eq @expected
150
- end
151
- end
152
- context "standard usage" do
153
- before :each do
154
- @starting = File.join RSpec::FixturePath, "nile", "white_nile"
155
- @expected = File.join RSpec::FixturePath, "flow_helper.rb"
156
- end
157
-
158
- it "should find the expected flow helper in the fixture folder" do
159
- path.should eq @expected
160
- end
161
- end
162
- end
163
- describe "#_get_files_from_filepath" do
164
- context "standard usage" do
165
- let(:files) { lolcat.send( "_get_files_from_filepath", File.join(RSpec::FixturePath) ) }
166
- before :each do
167
- @expected = Dir[File.join(RSpec::FixturePath, "*_flow.rb")].map { |f| f }
168
- @expected += Dir[File.join(RSpec::FixturePath,"**", "*_flow.rb")].map { |f| f }
169
- @expected += Dir[File.join(RSpec::FixturePath,"**", "**", "*_flow.rb")].map { |f| f }
170
- @expected.uniq!
171
- end
172
-
173
- it "should fetch all the files that are flow rubies" do
174
- files.sort.should eq @expected.sort
175
- end
176
- end
177
- context "null usage" do
178
- it "should out an empty array if the path doesn't exist" do
179
- lolcat.send("_get_files_from_filepath", "nigstack").should be_empty
180
- end
19
+ describe "#generate" do
20
+ it "should have tests" do
21
+ pending "write tests here!"
181
22
  end
182
23
  end
183
24
  end
25
+
184
26
  end
data/spec/spec_helper.rb CHANGED
@@ -4,5 +4,6 @@ require File.join File.expand_path("..", File.dirname(__FILE__)), "lib", "cascad
4
4
  SimpleCov.start
5
5
 
6
6
  module RSpec
7
- FixturePath = File.expand_path("../../fixtures", __FILE__)
7
+ RootPath = File.expand_path "../../", __FILE__
8
+ FixturePath = File.join RootPath, "fixtures"
8
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cascadence
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Chen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-03-21 00:00:00.000000000 Z
11
+ date: 2013-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -172,14 +172,23 @@ files:
172
172
  - lib/cascadence.rb
173
173
  - lib/cascadence/class_methods.rb
174
174
  - lib/cascadence/commander.rb
175
+ - lib/cascadence/commander/flow.rb
176
+ - lib/cascadence/commander/generate.rb
177
+ - lib/cascadence/commander/version.rb
175
178
  - lib/cascadence/config.rb
176
179
  - lib/cascadence/flow.rb
177
180
  - lib/cascadence/helper.rb
178
181
  - lib/cascadence/runner.rb
179
182
  - lib/cascadence/stateful.rb
180
183
  - lib/cascadence/task.rb
184
+ - lib/cascadence/templates/%project_name%.rb.tt
185
+ - lib/cascadence/templates/%project_name%/base_flow.rb.tt
186
+ - lib/cascadence/templates/flow_helper.rb.tt
181
187
  - spec/cascadence/advanced_fork_merge_spec.rb
182
188
  - spec/cascadence/class_methods_spec.rb
189
+ - spec/cascadence/commander/flow_spec.rb
190
+ - spec/cascadence/commander/generate_spec.rb
191
+ - spec/cascadence/commander/version_spec.rb
183
192
  - spec/cascadence/commander_spec.rb
184
193
  - spec/cascadence/flow_spec.rb
185
194
  - spec/cascadence/fork_merge_spec.rb