picky 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- metadata +2 -4
- data/spec/lib/generator_spec.rb +0 -141
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 1.1.
|
8
|
+
- 1
|
9
|
+
version: 1.1.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Florian Hanke
|
@@ -168,7 +168,6 @@ files:
|
|
168
168
|
- spec/lib/extensions/module_spec.rb
|
169
169
|
- spec/lib/extensions/object_spec.rb
|
170
170
|
- spec/lib/extensions/symbol_spec.rb
|
171
|
-
- spec/lib/generator_spec.rb
|
172
171
|
- spec/lib/helpers/cache_spec.rb
|
173
172
|
- spec/lib/helpers/gc_spec.rb
|
174
173
|
- spec/lib/helpers/measuring_spec.rb
|
@@ -274,7 +273,6 @@ test_files:
|
|
274
273
|
- spec/lib/extensions/module_spec.rb
|
275
274
|
- spec/lib/extensions/object_spec.rb
|
276
275
|
- spec/lib/extensions/symbol_spec.rb
|
277
|
-
- spec/lib/generator_spec.rb
|
278
276
|
- spec/lib/helpers/cache_spec.rb
|
279
277
|
- spec/lib/helpers/gc_spec.rb
|
280
278
|
- spec/lib/helpers/measuring_spec.rb
|
data/spec/lib/generator_spec.rb
DELETED
@@ -1,141 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
describe Picky::Generator do
|
5
|
-
|
6
|
-
describe "main class" do
|
7
|
-
before(:each) do
|
8
|
-
@generator = Picky::Generator.new
|
9
|
-
end
|
10
|
-
|
11
|
-
describe "generator_for_class" do
|
12
|
-
it "should return me a generator for the given class" do
|
13
|
-
@generator.generator_for_class(Picky::Generator::Project, :some_identifier, :some_args).should be_kind_of(Picky::Generator::Project)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
describe "generator_for" do
|
18
|
-
it "should not raise if a generator is available" do
|
19
|
-
lambda { @generator.generator_for('project', 'some_project') }.should_not raise_error
|
20
|
-
end
|
21
|
-
it "should raise if a generator is not available" do
|
22
|
-
lambda { @generator.generator_for('blarf', 'gnorf') }.should raise_error(Picky::NoGeneratorError)
|
23
|
-
end
|
24
|
-
it "should return a generator if it is available" do
|
25
|
-
@generator.generator_for('project', 'some_project').should be_kind_of(Picky::Generator::Project)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
describe "generate" do
|
30
|
-
it "should raise a NoGeneratorError if called with the wrong params" do
|
31
|
-
lambda { @generator.generate(['blarf', 'gnorf']) }.should raise_error(Picky::NoGeneratorError)
|
32
|
-
end
|
33
|
-
it "should not raise on the right params" do
|
34
|
-
@generator.stub! :generator_for_class => stub(:generator, :generate => nil)
|
35
|
-
|
36
|
-
lambda { @generator.generate(['project', 'some_project']) }.should_not raise_error
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
describe Picky::Generator::Project do
|
42
|
-
|
43
|
-
before(:each) do
|
44
|
-
@generator = Picky::Generator::Project.new :identifier, 'some_name', []
|
45
|
-
@generator.stub! :exclaim
|
46
|
-
end
|
47
|
-
|
48
|
-
context "after initialize" do
|
49
|
-
it "should have a prototype project basedir" do
|
50
|
-
lambda {
|
51
|
-
@generator.project_prototype_basedir
|
52
|
-
}.should_not raise_error
|
53
|
-
end
|
54
|
-
it "should have a name" do
|
55
|
-
@generator.name.should == 'some_name'
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
describe "project_prototype_basedir" do
|
60
|
-
it "should be the right basedir" do
|
61
|
-
@generator.project_prototype_basedir.should == File.expand_path('../../../project_prototype', __FILE__)
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
describe "generate" do
|
66
|
-
it "should do things in order" do
|
67
|
-
@generator.should_receive(:create_target_directory).once.ordered
|
68
|
-
@generator.should_receive(:copy_all_files).once.ordered
|
69
|
-
|
70
|
-
@generator.generate
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
describe "create_target_directory" do
|
75
|
-
context "file exists" do
|
76
|
-
before(:each) do
|
77
|
-
File.stub! :exists? => true
|
78
|
-
end
|
79
|
-
it "should just tell the user that" do
|
80
|
-
@generator.stub! :target_directory => :some_target_directory
|
81
|
-
|
82
|
-
@generator.should_receive(:exists).once.with :some_target_directory
|
83
|
-
|
84
|
-
@generator.create_target_directory
|
85
|
-
end
|
86
|
-
it "should not make the directory" do
|
87
|
-
FileUtils.should_receive(:mkdir).never
|
88
|
-
|
89
|
-
@generator.create_target_directory
|
90
|
-
end
|
91
|
-
end
|
92
|
-
context "file does not exist" do
|
93
|
-
before(:each) do
|
94
|
-
File.stub! :exists? => false
|
95
|
-
FileUtils.stub! :mkdir
|
96
|
-
end
|
97
|
-
it "should make the directory" do
|
98
|
-
@generator.stub! :target_directory => :some_target_directory
|
99
|
-
|
100
|
-
FileUtils.should_receive(:mkdir).once.with :some_target_directory
|
101
|
-
|
102
|
-
@generator.create_target_directory
|
103
|
-
end
|
104
|
-
it "should tell the user" do
|
105
|
-
@generator.stub! :target_directory => :some_target_directory
|
106
|
-
|
107
|
-
@generator.should_receive(:created).once.with :some_target_directory
|
108
|
-
|
109
|
-
@generator.create_target_directory
|
110
|
-
end
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
describe "target_filename_for" do
|
115
|
-
it "should return the right filename" do
|
116
|
-
@generator.stub! :target_directory => 'some_target_directory'
|
117
|
-
|
118
|
-
test_filename = File.expand_path 'some/file/name', @generator.project_prototype_basedir
|
119
|
-
|
120
|
-
@generator.target_filename_for(test_filename).should == 'some_target_directory/some/file/name'
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
|
-
describe "generate" do
|
125
|
-
it "should copy recursively" do
|
126
|
-
@generator.should_receive(:create_target_directory).once.with
|
127
|
-
@generator.should_receive(:copy_all_files).once.with
|
128
|
-
|
129
|
-
@generator.generate
|
130
|
-
end
|
131
|
-
end
|
132
|
-
|
133
|
-
describe "target_directory" do
|
134
|
-
it "should return the right dir name" do
|
135
|
-
@generator.target_directory.should == File.expand_path('../../../some_name', __FILE__)
|
136
|
-
end
|
137
|
-
end
|
138
|
-
|
139
|
-
end
|
140
|
-
|
141
|
-
end
|