bones 2.1.1 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,157 +0,0 @@
1
-
2
- require File.expand_path(
3
- File.join(File.dirname(__FILE__), %w[.. spec_helper]))
4
-
5
- describe Bones::Main do
6
-
7
- before :each do
8
- @main = Bones::Main.new
9
- @skeleton_dir = File.join(@main.mrbones_dir, 'data')
10
- @skeleton_dir = Bones.path('data') unless test(?e, @skeleton_dir)
11
- end
12
-
13
- it 'has some defaults when initialized' do
14
- @main.options.should == {
15
- :skeleton_dir => @skeleton_dir,
16
- :with_tasks => false,
17
- :verbose => false,
18
- :name => nil,
19
- :output_dir => nil,
20
- :action => nil
21
- }
22
- end
23
-
24
- it 'provides access to the output_dir' do
25
- @main.output_dir.should be_nil
26
- @main.options[:output_dir] = 'foo'
27
- @main.output_dir.should == 'foo'
28
- end
29
-
30
- it 'provides access to the skeleton_dir' do
31
- @main.skeleton_dir.should == @skeleton_dir
32
- @main.options[:skeleton_dir] = 'bar'
33
- @main.skeleton_dir.should == 'bar'
34
- end
35
-
36
- it 'provides access to the project name' do
37
- @main.name.should be_nil
38
- @main.options[:name] = 'baz'
39
- @main.name.should == 'baz'
40
- end
41
-
42
- it 'provides access to the project classname' do
43
- @main.options[:name] = 'foo-bar'
44
- @main.classname.should == 'FooBar'
45
- end
46
-
47
- it 'determines if a project should be updated' do
48
- @main.options[:output_dir] = Bones.path
49
- @main.update?.should == false
50
-
51
- @main.options[:with_tasks] = true
52
- @main.update?.should == true
53
-
54
- @main.options[:output_dir] = Bones.path(%w[foo bar baz buz tmp])
55
- @main.update?.should == false
56
- end
57
-
58
- # ------------------------------------------------------------------------
59
- describe 'when parsing command line options' do
60
-
61
- before :each do
62
- @main.stub!(:mrbones_dir).and_return(Bones.path(%w[spec data]))
63
- end
64
-
65
- it 'parses the project name' do
66
- @main.parse %w[foo-bar]
67
- @main.name.should == 'foo-bar'
68
- @main.output_dir.should == 'foo-bar'
69
- end
70
-
71
- it 'parses the verbose flag' do
72
- @main.parse %w[-v foo-bar]
73
- @main.name.should == 'foo-bar'
74
- @main.verbose?.should == true
75
-
76
- @main = Bones::Main.new
77
- @main.parse %w[--verbose foo-bar]
78
- @main.name.should == 'foo-bar'
79
- @main.verbose?.should == true
80
- end
81
-
82
- it 'parses the directory flag' do
83
- @main.parse %w[-d blah foo-bar]
84
- @main.name.should == 'foo-bar'
85
- @main.output_dir.should == 'blah'
86
-
87
- @main = Bones::Main.new
88
- @main.parse %w[--directory blah foo-bar]
89
- @main.name.should == 'foo-bar'
90
- @main.output_dir.should == 'blah'
91
- end
92
-
93
- it 'parses the directory flag' do
94
- @main.parse %w[-d blah foo-bar]
95
- @main.name.should == 'foo-bar'
96
- @main.output_dir.should == 'blah'
97
-
98
- @main = Bones::Main.new
99
- @main.parse %w[--directory blah foo-bar]
100
- @main.name.should == 'foo-bar'
101
- @main.output_dir.should == 'blah'
102
- end
103
-
104
- it 'parses the skeleton to use flag' do
105
- @main.stub!(:mrbones_dir).and_return(Bones.path(%w[spec data]))
106
- @main.parse %w[-s data foo-bar]
107
- @main.name.should == 'foo-bar'
108
- @main.skeleton_dir.should == Bones.path(%w[spec data data])
109
-
110
- @main = Bones::Main.new
111
- @main.stub!(:mrbones_dir).and_return(Bones.path(%w[spec data]))
112
- @main.parse %w[--skeleton foo foo-bar]
113
- @main.name.should == 'foo-bar'
114
- @main.skeleton_dir.should == Bones.path(%w[spec data foo])
115
- end
116
-
117
- it 'parses the with-tasks flag' do
118
- @main.parse %w[--with-tasks foo-bar]
119
- @main.name.should == 'foo-bar'
120
- @main.with_tasks?.should == true
121
- end
122
-
123
- it 'parses the freeze flag' do
124
- @main.parse %w[--freeze]
125
- @main.name.should be_nil
126
- @main.options[:action].should == :freeze
127
-
128
- @main = Bones::Main.new
129
- @main.parse %w[--freeze foo-bar]
130
- @main.name.should == 'foo-bar'
131
- @main.options[:action].should == :freeze
132
- end
133
-
134
- it 'parses the unfreeze flag' do
135
- @main.parse %w[--unfreeze]
136
- @main.name.should be_nil
137
- @main.options[:action].should == :unfreeze
138
- end
139
-
140
- it 'parses the info flag' do
141
- @main.parse %w[--info]
142
- @main.name.should be_nil
143
- @main.options[:action].should == :info
144
-
145
- @main = Bones::Main.new
146
- @main.parse %w[-i]
147
- @main.name.should be_nil
148
- @main.options[:action].should == :info
149
- end
150
- end
151
-
152
- # ------------------------------------------------------------------------
153
- #describe 'when archiving tasks'
154
-
155
- end # describe Bones::Main
156
-
157
- # EOF
File without changes
File without changes