forge-cli 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +6 -14
- data/bin/cucumber +16 -0
- data/bin/erubis +16 -0
- data/bin/htmldiff +16 -0
- data/bin/ldiff +16 -0
- data/bin/rackup +16 -0
- data/bin/rake +16 -0
- data/bin/rdoc +16 -0
- data/bin/ri +16 -0
- data/bin/sprockets +16 -0
- data/bin/thor +16 -0
- data/bin/tilt +16 -0
- data/bin/tt +16 -0
- data/lib/forge-cli/modules/base/manifest.yml +18 -0
- data/lib/forge-cli/modules/base/routes.rb +1 -2
- data/lib/forge-cli/modules/events/routes.rb +6 -1
- data/lib/forge-cli/version.rb +1 -1
- data/lib/forge/Gemfile +2 -0
- data/lib/forge/app/controllers/events_controller.rb +11 -0
- data/lib/forge/app/controllers/pages_controller.rb +1 -1
- data/lib/forge/app/controllers/products_controller.rb +1 -1
- data/lib/forge/app/views/forge/dispatches/_form.html.haml +0 -13
- data/lib/forge/app/views/forge/events/_form.html.haml +14 -10
- data/lib/forge/app/views/forge/posts/_form.html.haml +2 -2
- data/lib/forge/app/views/forge/products/_form.html.haml +10 -4
- data/lib/forge/config/routes.rb +8 -3
- data/lib/forge/features/authentication.feature +8 -0
- data/lib/forge/features/step_definitions/web_steps.rb +24 -0
- data/lib/forge/features/support/env.rb +60 -0
- data/lib/forge/features/support/paths.rb +20 -0
- data/lib/forge/lib/assets/javascripts/forge/features/asset_uploads.js.erb +1 -1
- data/lib/forge/lib/generators/forge/scaffold/templates/controller_spec.rb +48 -48
- data/lib/forge/lib/generators/forge/scaffold_small/templates/controller_spec.rb +42 -42
- data/lib/forge/spec/controllers/forge/banners_controller_spec.rb +47 -47
- data/lib/forge/spec/controllers/forge/dispatches_controller_spec.rb +45 -45
- data/lib/forge/spec/controllers/forge/events_controller_spec.rb +45 -45
- data/lib/forge/spec/controllers/forge/galleries_controller_spec.rb +44 -44
- data/lib/forge/spec/controllers/forge/orders_controller_spec.rb +45 -45
- data/lib/forge/spec/controllers/forge/pages_controller_spec.rb +46 -46
- data/lib/forge/spec/controllers/forge/post_categories_controller_spec.rb +41 -41
- data/lib/forge/spec/controllers/forge/posts_controller_spec.rb +45 -45
- data/lib/forge/spec/controllers/forge/product_categories_controller_spec.rb +42 -42
- data/lib/forge/spec/controllers/forge/products_controller_spec.rb +47 -47
- data/lib/forge/spec/controllers/forge/sales_controller_spec.rb +45 -45
- data/lib/forge/spec/controllers/forge/subscriber_groups_controller_spec.rb +45 -45
- data/lib/forge/spec/controllers/forge/subscribers_controller_spec.rb +40 -40
- data/lib/forge/spec/controllers/forge/tax_rates_controller_spec.rb +41 -41
- data/lib/forge/spec/controllers/forge/users_controller_spec.rb +58 -58
- data/lib/forge/spec/controllers/forge/videos_controller_spec.rb +9 -9
- data/lib/forge/spec/models/reorderable_spec.rb +5 -5
- metadata +31 -21
- data/lib/forge/config/database.yml +0 -24
- data/lib/forge/config/deploy.rb +0 -53
- data/lib/forge/config/dispatch_daemon.yml +0 -23
- data/lib/forge/config/s3.yml +0 -19
- data/lib/forge/log/development.log +0 -2
- data/lib/forge/script/dispatch_daemon_fetcher +0 -28
@@ -4,9 +4,9 @@ describe Forge::PostCategoriesController do
|
|
4
4
|
describe "As an admin" do
|
5
5
|
fixtures :users, :roles
|
6
6
|
before do
|
7
|
-
controller.stub
|
7
|
+
controller.stub(:current_user).and_return(users(:admin))
|
8
8
|
end
|
9
|
-
|
9
|
+
|
10
10
|
# EDIT
|
11
11
|
describe "GET post_categories/:id/edit" do
|
12
12
|
before do
|
@@ -14,167 +14,167 @@ describe Forge::PostCategoriesController do
|
|
14
14
|
PostCategory.should_receive(:find).with("1").and_return(@post_category)
|
15
15
|
get :edit, :id => 1
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
it "should assign @post_category" do
|
19
19
|
assigns[:post_category].should == @post_category
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
it "should render the edit template" do
|
23
23
|
response.should render_template('edit')
|
24
24
|
end
|
25
25
|
end
|
26
|
-
|
26
|
+
|
27
27
|
|
28
28
|
# CREATE
|
29
29
|
describe "POST post_categories/" do
|
30
30
|
def do_create
|
31
31
|
post :create, :post_category => {}
|
32
32
|
end
|
33
|
-
|
34
|
-
describe "with valid attributes" do
|
33
|
+
|
34
|
+
describe "with valid attributes" do
|
35
35
|
before do
|
36
36
|
@post_category = mock_model(PostCategory, :save => true)
|
37
|
-
PostCategory.stub
|
37
|
+
PostCategory.stub(:new).and_return(@post_category)
|
38
38
|
end
|
39
|
-
|
39
|
+
|
40
40
|
it "should assign @post_category" do
|
41
41
|
do_create
|
42
42
|
assigns[:post_category].should == @post_category
|
43
43
|
end
|
44
|
-
|
44
|
+
|
45
45
|
it "should set the flash notice" do
|
46
46
|
do_create
|
47
47
|
flash[:notice].should_not be_nil
|
48
48
|
end
|
49
|
-
|
49
|
+
|
50
50
|
it "should redirect to the index" do
|
51
51
|
do_create
|
52
52
|
response.should redirect_to(forge_post_categories_path)
|
53
53
|
end
|
54
|
-
|
54
|
+
|
55
55
|
it "should be valid" do
|
56
56
|
@post_category.should_receive(:save).and_return(:true)
|
57
57
|
do_create
|
58
58
|
end
|
59
59
|
end
|
60
|
-
|
60
|
+
|
61
61
|
describe "with invalid attributes" do
|
62
62
|
before do
|
63
63
|
@post_category = mock_model(PostCategory, :save => false)
|
64
|
-
PostCategory.stub
|
64
|
+
PostCategory.stub(:new).and_return(@post_category)
|
65
65
|
end
|
66
|
-
|
66
|
+
|
67
67
|
it "should assign @post_category" do
|
68
68
|
do_create
|
69
69
|
assigns[:post_category].should == @post_category
|
70
70
|
end
|
71
|
-
|
71
|
+
|
72
72
|
it "should not set the flash notice" do
|
73
73
|
do_create
|
74
74
|
flash[:notice].should be_nil
|
75
75
|
end
|
76
|
-
|
76
|
+
|
77
77
|
it "should render the index template" do
|
78
78
|
do_create
|
79
79
|
response.should render_template('index')
|
80
80
|
end
|
81
|
-
|
81
|
+
|
82
82
|
it "should not save" do
|
83
83
|
@post_category.should_receive(:save).and_return(:false)
|
84
84
|
do_create
|
85
85
|
end
|
86
86
|
end
|
87
87
|
end
|
88
|
-
|
88
|
+
|
89
89
|
# UPDATE
|
90
90
|
describe "PUT post_categories/:id" do
|
91
91
|
def do_update
|
92
92
|
put :update, :id => "1", :post_category => {}
|
93
|
-
end
|
94
|
-
|
93
|
+
end
|
94
|
+
|
95
95
|
describe "with valid params" do
|
96
96
|
before(:each) do
|
97
97
|
@post_category = mock_model(PostCategory, :update_attributes => true)
|
98
|
-
PostCategory.stub
|
98
|
+
PostCategory.stub(:find).with("1").and_return(@post_category)
|
99
99
|
end
|
100
|
-
|
100
|
+
|
101
101
|
it "should find post_category and return object" do
|
102
102
|
do_update
|
103
103
|
assigns[:post_category].should == @post_category
|
104
104
|
end
|
105
|
-
|
105
|
+
|
106
106
|
it "should update the post_category object's attributes" do
|
107
107
|
@post_category.should_receive(:update_attributes)
|
108
108
|
do_update
|
109
109
|
end
|
110
|
-
|
110
|
+
|
111
111
|
it "should redirect to the post_category index page" do
|
112
112
|
do_update
|
113
113
|
response.should redirect_to(forge_post_categories_path)
|
114
114
|
end
|
115
115
|
end
|
116
|
-
|
116
|
+
|
117
117
|
describe "with invalid params" do
|
118
118
|
before(:each) do
|
119
119
|
@post_category = mock_model(PostCategory, :update_attributes => false)
|
120
|
-
PostCategory.stub
|
120
|
+
PostCategory.stub(:find).with("1").and_return(@post_category)
|
121
121
|
end
|
122
|
-
|
122
|
+
|
123
123
|
it "should find post_category and return object" do
|
124
124
|
do_update
|
125
125
|
assigns[:post_category].should == @post_category
|
126
126
|
end
|
127
|
-
|
127
|
+
|
128
128
|
it "should update the post_category object's attributes" do
|
129
129
|
@post_category.should_receive(:update_attributes)
|
130
130
|
do_update
|
131
131
|
end
|
132
|
-
|
132
|
+
|
133
133
|
it "should render the edit form" do
|
134
134
|
do_update
|
135
135
|
response.should render_template('edit')
|
136
136
|
end
|
137
|
-
|
137
|
+
|
138
138
|
it "should not have a flash notice" do
|
139
139
|
do_update
|
140
140
|
flash[:notice].should be_blank
|
141
141
|
end
|
142
142
|
end
|
143
|
-
|
143
|
+
|
144
144
|
end
|
145
|
-
|
145
|
+
|
146
146
|
# DESTROY
|
147
147
|
describe "DELETE /post_categories/:id" do
|
148
148
|
it "should delete" do
|
149
149
|
@post_category = mock_model(PostCategory)
|
150
|
-
PostCategory.stub
|
150
|
+
PostCategory.stub(:find).and_return(@post_category)
|
151
151
|
@post_category.should_receive(:destroy)
|
152
152
|
delete :destroy, :id => 1
|
153
153
|
end
|
154
154
|
end
|
155
155
|
end
|
156
|
-
|
157
|
-
|
156
|
+
|
157
|
+
|
158
158
|
describe "As someone who's not logged in" do
|
159
159
|
before do
|
160
|
-
controller.stub
|
160
|
+
controller.stub(:current_user).and_return(nil)
|
161
161
|
end
|
162
|
-
|
162
|
+
|
163
163
|
it "should not let you get the edit action" do
|
164
164
|
get :edit, :id => 1
|
165
165
|
response.should redirect_to('/login')
|
166
166
|
end
|
167
|
-
|
167
|
+
|
168
168
|
it "should not let you get the create action" do
|
169
169
|
post :create
|
170
170
|
response.should redirect_to('/login')
|
171
171
|
end
|
172
|
-
|
172
|
+
|
173
173
|
it "should not let you get the update action" do
|
174
174
|
put :update, :id => 1
|
175
175
|
response.should redirect_to('/login')
|
176
176
|
end
|
177
|
-
|
177
|
+
|
178
178
|
it "should not let you get the destroy action" do
|
179
179
|
delete :destroy, :id => 1
|
180
180
|
response.should redirect_to('/login')
|
@@ -4,24 +4,24 @@ describe Forge::PostsController do
|
|
4
4
|
describe "As an admin" do
|
5
5
|
fixtures :users, :roles
|
6
6
|
before do
|
7
|
-
controller.stub
|
7
|
+
controller.stub(:current_user).and_return(users(:admin))
|
8
8
|
end
|
9
|
-
|
9
|
+
|
10
10
|
# NEW
|
11
11
|
describe "GET posts/new" do
|
12
12
|
before do
|
13
13
|
get :new
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
it "should assign @post" do
|
17
17
|
assigns[:post].should_not be_nil
|
18
18
|
end
|
19
|
-
|
19
|
+
|
20
20
|
it "should render the new template" do
|
21
21
|
response.should render_template('new')
|
22
22
|
end
|
23
23
|
end
|
24
|
-
|
24
|
+
|
25
25
|
# EDIT
|
26
26
|
describe "GET posts/:id/edit" do
|
27
27
|
before do
|
@@ -29,172 +29,172 @@ describe Forge::PostsController do
|
|
29
29
|
Post.should_receive(:find).with("1").and_return(@post)
|
30
30
|
get :edit, :id => 1
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
33
|
it "should assign @post" do
|
34
34
|
assigns[:post].should == @post
|
35
35
|
end
|
36
|
-
|
36
|
+
|
37
37
|
it "should render the edit template" do
|
38
38
|
response.should render_template('edit')
|
39
39
|
end
|
40
40
|
end
|
41
|
-
|
41
|
+
|
42
42
|
|
43
43
|
# CREATE
|
44
44
|
describe "POST posts/" do
|
45
45
|
def do_create
|
46
46
|
post :create, :post => {}
|
47
47
|
end
|
48
|
-
|
49
|
-
describe "with valid attributes" do
|
48
|
+
|
49
|
+
describe "with valid attributes" do
|
50
50
|
before do
|
51
51
|
@post = mock_model(Post, :save => true)
|
52
|
-
Post.stub
|
52
|
+
Post.stub(:new).and_return(@post)
|
53
53
|
end
|
54
|
-
|
54
|
+
|
55
55
|
it "should assign @post" do
|
56
56
|
do_create
|
57
57
|
assigns[:post].should == @post
|
58
58
|
end
|
59
|
-
|
59
|
+
|
60
60
|
it "should set the flash notice" do
|
61
61
|
do_create
|
62
62
|
flash[:notice].should_not be_nil
|
63
63
|
end
|
64
|
-
|
64
|
+
|
65
65
|
it "should redirect to the index" do
|
66
66
|
do_create
|
67
67
|
response.should redirect_to(forge_posts_path)
|
68
68
|
end
|
69
|
-
|
69
|
+
|
70
70
|
it "should be valid" do
|
71
71
|
@post.should_receive(:save).and_return(:true)
|
72
72
|
do_create
|
73
73
|
end
|
74
74
|
end
|
75
|
-
|
75
|
+
|
76
76
|
describe "with invalid attributes" do
|
77
77
|
before do
|
78
78
|
@post = mock_model(Post, :save => false)
|
79
|
-
Post.stub
|
79
|
+
Post.stub(:new).and_return(@post)
|
80
80
|
end
|
81
|
-
|
81
|
+
|
82
82
|
it "should assign @post" do
|
83
83
|
do_create
|
84
84
|
assigns[:post].should == @post
|
85
85
|
end
|
86
|
-
|
86
|
+
|
87
87
|
it "should not set the flash notice" do
|
88
88
|
do_create
|
89
89
|
flash[:notice].should be_nil
|
90
90
|
end
|
91
|
-
|
91
|
+
|
92
92
|
it "should render the new template" do
|
93
93
|
do_create
|
94
94
|
response.should render_template('new')
|
95
95
|
end
|
96
|
-
|
96
|
+
|
97
97
|
it "should not save" do
|
98
98
|
@post.should_receive(:save).and_return(:false)
|
99
99
|
do_create
|
100
100
|
end
|
101
101
|
end
|
102
102
|
end
|
103
|
-
|
103
|
+
|
104
104
|
# UPDATE
|
105
105
|
describe "PUT posts/:id" do
|
106
106
|
def do_update
|
107
107
|
put :update, :id => "1", :post => {}
|
108
|
-
end
|
109
|
-
|
108
|
+
end
|
109
|
+
|
110
110
|
describe "with valid params" do
|
111
111
|
before(:each) do
|
112
112
|
@post = mock_model(Post, :update_attributes => true)
|
113
|
-
Post.stub
|
113
|
+
Post.stub(:find).with("1").and_return(@post)
|
114
114
|
end
|
115
|
-
|
115
|
+
|
116
116
|
it "should find post and return object" do
|
117
117
|
do_update
|
118
118
|
assigns[:post].should == @post
|
119
119
|
end
|
120
|
-
|
120
|
+
|
121
121
|
it "should update the post object's attributes" do
|
122
122
|
@post.should_receive(:update_attributes)
|
123
123
|
do_update
|
124
124
|
end
|
125
|
-
|
125
|
+
|
126
126
|
it "should redirect to the post index page" do
|
127
127
|
do_update
|
128
128
|
response.should redirect_to(forge_posts_path)
|
129
129
|
end
|
130
130
|
end
|
131
|
-
|
131
|
+
|
132
132
|
describe "with invalid params" do
|
133
133
|
before(:each) do
|
134
134
|
@post = mock_model(Post, :update_attributes => false)
|
135
|
-
Post.stub
|
135
|
+
Post.stub(:find).with("1").and_return(@post)
|
136
136
|
end
|
137
|
-
|
137
|
+
|
138
138
|
it "should find post and return object" do
|
139
139
|
do_update
|
140
140
|
assigns[:post].should == @post
|
141
141
|
end
|
142
|
-
|
142
|
+
|
143
143
|
it "should update the post object's attributes" do
|
144
144
|
@post.should_receive(:update_attributes)
|
145
145
|
do_update
|
146
146
|
end
|
147
|
-
|
147
|
+
|
148
148
|
it "should render the edit form" do
|
149
149
|
do_update
|
150
150
|
response.should render_template('edit')
|
151
151
|
end
|
152
|
-
|
152
|
+
|
153
153
|
it "should not have a flash notice" do
|
154
154
|
do_update
|
155
155
|
flash[:notice].should be_blank
|
156
156
|
end
|
157
157
|
end
|
158
|
-
|
158
|
+
|
159
159
|
end
|
160
|
-
|
160
|
+
|
161
161
|
# DESTROY
|
162
162
|
describe "DELETE /posts/:id" do
|
163
163
|
it "should delete" do
|
164
164
|
@post = mock_model(Post)
|
165
|
-
Post.stub
|
165
|
+
Post.stub(:find).and_return(@post)
|
166
166
|
@post.should_receive(:destroy)
|
167
167
|
delete :destroy, :id => 1
|
168
168
|
end
|
169
169
|
end
|
170
170
|
end
|
171
|
-
|
172
|
-
|
171
|
+
|
172
|
+
|
173
173
|
describe "As someone who's not logged in" do
|
174
174
|
before do
|
175
|
-
controller.stub
|
175
|
+
controller.stub(:current_user).and_return(nil)
|
176
176
|
end
|
177
|
-
|
177
|
+
|
178
178
|
it "should not let you get the new action" do
|
179
179
|
get :new
|
180
180
|
response.should redirect_to('/login')
|
181
181
|
end
|
182
|
-
|
182
|
+
|
183
183
|
it "should not let you get the edit action" do
|
184
184
|
get :edit, :id => 1
|
185
185
|
response.should redirect_to('/login')
|
186
186
|
end
|
187
|
-
|
187
|
+
|
188
188
|
it "should not let you get the create action" do
|
189
189
|
post :create
|
190
190
|
response.should redirect_to('/login')
|
191
191
|
end
|
192
|
-
|
192
|
+
|
193
193
|
it "should not let you get the update action" do
|
194
194
|
put :update, :id => 1
|
195
195
|
response.should redirect_to('/login')
|
196
196
|
end
|
197
|
-
|
197
|
+
|
198
198
|
it "should not let you get the destroy action" do
|
199
199
|
delete :destroy, :id => 1
|
200
200
|
response.should redirect_to('/login')
|