Skip to content

Commit 7797216

Browse files
committed
Update Encouragement Controller spec. Update gems.
1 parent 7982b37 commit 7797216

File tree

4 files changed

+176
-86
lines changed

4 files changed

+176
-86
lines changed

Gemfile.lock

Lines changed: 49 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
GEM
22
remote: https://rubygems.org/
33
specs:
4-
actioncable (5.1.1)
5-
actionpack (= 5.1.1)
4+
actioncable (5.1.2)
5+
actionpack (= 5.1.2)
66
nio4r (~> 2.0)
77
websocket-driver (~> 0.6.1)
8-
actionmailer (5.1.1)
9-
actionpack (= 5.1.1)
10-
actionview (= 5.1.1)
11-
activejob (= 5.1.1)
8+
actionmailer (5.1.2)
9+
actionpack (= 5.1.2)
10+
actionview (= 5.1.2)
11+
activejob (= 5.1.2)
1212
mail (~> 2.5, >= 2.5.4)
1313
rails-dom-testing (~> 2.0)
14-
actionpack (5.1.1)
15-
actionview (= 5.1.1)
16-
activesupport (= 5.1.1)
14+
actionpack (5.1.2)
15+
actionview (= 5.1.2)
16+
activesupport (= 5.1.2)
1717
rack (~> 2.0)
1818
rack-test (~> 0.6.3)
1919
rails-dom-testing (~> 2.0)
2020
rails-html-sanitizer (~> 1.0, >= 1.0.2)
21-
actionview (5.1.1)
22-
activesupport (= 5.1.1)
21+
actionview (5.1.2)
22+
activesupport (= 5.1.2)
2323
builder (~> 3.1)
2424
erubi (~> 1.4)
2525
rails-dom-testing (~> 2.0)
@@ -29,24 +29,24 @@ GEM
2929
activemodel (>= 4.1, < 6)
3030
case_transform (>= 0.2)
3131
jsonapi-renderer (>= 0.1.1.beta1, < 0.2)
32-
activejob (5.1.1)
33-
activesupport (= 5.1.1)
32+
activejob (5.1.2)
33+
activesupport (= 5.1.2)
3434
globalid (>= 0.3.6)
35-
activemodel (5.1.1)
36-
activesupport (= 5.1.1)
37-
activerecord (5.1.1)
38-
activemodel (= 5.1.1)
39-
activesupport (= 5.1.1)
35+
activemodel (5.1.2)
36+
activesupport (= 5.1.2)
37+
activerecord (5.1.2)
38+
activemodel (= 5.1.2)
39+
activesupport (= 5.1.2)
4040
arel (~> 8.0)
41-
activesupport (5.1.1)
41+
activesupport (5.1.2)
4242
concurrent-ruby (~> 1.0, >= 1.0.2)
4343
i18n (~> 0.7)
4444
minitest (~> 5.1)
4545
tzinfo (~> 1.1)
4646
addressable (2.5.1)
4747
public_suffix (~> 2.0, >= 2.0.2)
4848
arel (8.0.0)
49-
autoprefixer-rails (7.1.1)
49+
autoprefixer-rails (7.1.2.3)
5050
execjs
5151
bcrypt (3.1.11)
5252
bindex (0.5.0)
@@ -56,7 +56,7 @@ GEM
5656
buftok (0.2.0)
5757
builder (3.2.3)
5858
byebug (9.0.6)
59-
capybara (2.14.2)
59+
capybara (2.14.4)
6060
addressable
6161
mime-types (>= 1.16)
6262
nokogiri (>= 1.3.3)
@@ -69,7 +69,7 @@ GEM
6969
mime-types (>= 1.16)
7070
case_transform (0.2)
7171
activesupport
72-
childprocess (0.7.0)
72+
childprocess (0.7.1)
7373
ffi (~> 1.0, >= 1.0.11)
7474
coffee-rails (4.2.2)
7575
coffee-script (>= 2.2.0)
@@ -109,7 +109,7 @@ GEM
109109
domain_name (0.5.20170404)
110110
unf (>= 0.0.5, < 1.0.0)
111111
equalizer (0.0.11)
112-
erubi (1.6.0)
112+
erubi (1.6.1)
113113
execjs (2.7.0)
114114
factory_girl (4.8.0)
115115
activesupport (>= 3.0.0)
@@ -132,15 +132,15 @@ GEM
132132
domain_name (~> 0.5)
133133
http-form_data (1.0.3)
134134
http_parser.rb (0.6.0)
135-
i18n (0.8.4)
135+
i18n (0.8.6)
136136
jbuilder (2.7.0)
137137
activesupport (>= 4.2.0)
138138
multi_json (>= 1.2)
139139
jquery-rails (4.3.1)
140140
rails-dom-testing (>= 1, < 3)
141141
railties (>= 4.2.0)
142142
thor (>= 0.14, < 2.0)
143-
jsonapi-renderer (0.1.2)
143+
jsonapi-renderer (0.1.3)
144144
listen (3.1.5)
145145
rb-fsevent (~> 0.9, >= 0.9.4)
146146
rb-inotify (~> 0.9, >= 0.9.7)
@@ -156,7 +156,7 @@ GEM
156156
mime-types-data (~> 3.2015)
157157
mime-types-data (3.2016.0521)
158158
mini_portile2 (2.2.0)
159-
minitest (5.10.2)
159+
minitest (5.10.3)
160160
multi_json (1.12.1)
161161
multi_test (0.1.2)
162162
multipart-post (2.0.0)
@@ -170,17 +170,17 @@ GEM
170170
rack (2.0.3)
171171
rack-test (0.6.3)
172172
rack (>= 1.0)
173-
rails (5.1.1)
174-
actioncable (= 5.1.1)
175-
actionmailer (= 5.1.1)
176-
actionpack (= 5.1.1)
177-
actionview (= 5.1.1)
178-
activejob (= 5.1.1)
179-
activemodel (= 5.1.1)
180-
activerecord (= 5.1.1)
181-
activesupport (= 5.1.1)
173+
rails (5.1.2)
174+
actioncable (= 5.1.2)
175+
actionmailer (= 5.1.2)
176+
actionpack (= 5.1.2)
177+
actionview (= 5.1.2)
178+
activejob (= 5.1.2)
179+
activemodel (= 5.1.2)
180+
activerecord (= 5.1.2)
181+
activesupport (= 5.1.2)
182182
bundler (>= 1.3.0, < 2.0)
183-
railties (= 5.1.1)
183+
railties (= 5.1.2)
184184
sprockets-rails (>= 2.0.0)
185185
rails-controller-testing (1.0.2)
186186
actionpack (~> 5.x, >= 5.0.1)
@@ -191,16 +191,16 @@ GEM
191191
nokogiri (>= 1.6)
192192
rails-html-sanitizer (1.0.3)
193193
loofah (~> 2.0)
194-
railties (5.1.1)
195-
actionpack (= 5.1.1)
196-
activesupport (= 5.1.1)
194+
railties (5.1.2)
195+
actionpack (= 5.1.2)
196+
activesupport (= 5.1.2)
197197
method_source
198198
rake (>= 0.8.7)
199199
thor (>= 0.18.1, < 2.0)
200200
rake (12.0.0)
201-
rb-fsevent (0.9.8)
202-
rb-inotify (0.9.8)
203-
ffi (>= 0.5.0)
201+
rb-fsevent (0.10.2)
202+
rb-inotify (0.9.10)
203+
ffi (>= 0.5.0, < 2)
204204
redcarpet (3.4.0)
205205
responders (2.4.0)
206206
actionpack (>= 4.2.0, < 5.3)
@@ -225,18 +225,21 @@ GEM
225225
ruby_dep (1.5.0)
226226
rubyzip (1.2.1)
227227
safe_yaml (1.0.4)
228-
sass (3.4.24)
228+
sass (3.5.1)
229+
sass-listen (~> 4.0.0)
230+
sass-listen (4.0.0)
231+
rb-fsevent (~> 0.9, >= 0.9.4)
232+
rb-inotify (~> 0.9, >= 0.9.7)
229233
sass-rails (5.0.6)
230234
railties (>= 4.0.0, < 6)
231235
sass (~> 3.1)
232236
sprockets (>= 2.8, < 4.0)
233237
sprockets-rails (>= 2.0, < 4.0)
234238
tilt (>= 1.1, < 3)
235-
selenium-webdriver (3.4.0)
239+
selenium-webdriver (3.4.4)
236240
childprocess (~> 0.5)
237241
rubyzip (~> 1.0)
238-
websocket (~> 1.0)
239-
shoulda-matchers (3.1.1)
242+
shoulda-matchers (3.1.2)
240243
activesupport (>= 4.0.0)
241244
simple_form (3.5.0)
242245
actionpack (> 4, < 5.2)
@@ -290,7 +293,6 @@ GEM
290293
addressable (>= 2.3.6)
291294
crack (>= 0.3.2)
292295
hashdiff
293-
websocket (1.2.4)
294296
websocket-driver (0.6.5)
295297
websocket-extensions (>= 0.1.0)
296298
websocket-extensions (0.1.2)

app/controllers/encouragements_controller.rb

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,27 @@ class EncouragementsController < ApplicationController
66

77
def new
88
@encouragement = Encouragement.new
9-
end
9+
end
10+
11+
def create
12+
@encouragement = Encouragement.new(encouragement_params.merge(
13+
user: current_user,
14+
achievement: @achievement
15+
))
16+
17+
if @encouragement.save
18+
redirect_to achievement_path(@achievement), notice: 'Thank you for encouragement.'
19+
else
20+
render :new
21+
end
22+
23+
end
24+
25+
private
26+
27+
def encouragement_params
28+
params.require(:encouragement).permit(:message)
29+
end
1030

1131
def authenticate_user
1232
@achievement = Achievement.find(params[:achievement_id])
@@ -27,4 +47,5 @@ def only_one_encouragement
2747
redirect_to achievement_path(@achievement), alert: "You already encouraged it. You can't be so generous."
2848
end
2949
end
50+
3051
end

0 commit comments

Comments
 (0)