waitlist 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6533afd54c85162594112e75d3c9e98753bc88a7
|
4
|
+
data.tar.gz: 33320c6c3bcb723646e3c71e17e75498d5bf2dfe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e93b766869d15614ce15e8fe94ec4b8036d6e2327f01481d8cec81e8b6c75c0b5f6813f2bebbccd6ed9e07cc9da211a8081be371126a89ec72e24a933ba2d28
|
7
|
+
data.tar.gz: 0a0a45b476d1074e28c6f4d174a7b2c9a7f39e8d503a63a5c60204d96aaca091d96dc881ea74a2e9e93bf029df5f337d242988cb02ebc97ad157679135cc04e7
|
@@ -9,7 +9,7 @@ module Waitlist
|
|
9
9
|
|
10
10
|
def create
|
11
11
|
@subscriber = Subscriber.new(subscriber_params)
|
12
|
-
flash[:notice] = 'Thanks for signing up!' if @subscriber.save
|
12
|
+
flash[:notice] = 'Thanks for signing up!' if @subscriber.save && request.format == 'html'
|
13
13
|
return_to = params[:return_to] || main_app.root_path
|
14
14
|
respond_with @subscriber, location: return_to
|
15
15
|
end
|
data/lib/waitlist/version.rb
CHANGED
@@ -13,36 +13,46 @@ RSpec.describe Waitlist::SubscribersController do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
describe '#create' do
|
16
|
-
context '
|
17
|
-
|
18
|
-
|
16
|
+
context 'in response to an html request' do
|
17
|
+
context 'with valid address' do
|
18
|
+
before do
|
19
|
+
post :create, subscriber: { email: 'valid.address@thegarage.us' }
|
20
|
+
end
|
21
|
+
it { should redirect_to '/' }
|
22
|
+
specify { expect(subject.request.flash[:notice]).to eq "Thanks for signing up!" }
|
19
23
|
end
|
20
24
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
25
|
+
context 'with valid address and params[:return_to]' do
|
26
|
+
let(:redirect_url) { 'http://google.com' }
|
27
|
+
before do
|
28
|
+
post :create, subscriber: { email: 'valid.address@thegarage.us' }, return_to: redirect_url
|
29
|
+
end
|
30
|
+
it { should redirect_to redirect_url }
|
27
31
|
end
|
28
|
-
|
29
|
-
|
32
|
+
context 'with an invalid address' do
|
33
|
+
before do
|
34
|
+
post :create, subscriber: { email: "this isn't an email address" }
|
35
|
+
end
|
30
36
|
|
31
|
-
|
32
|
-
before do
|
33
|
-
post :create, format: :json, subscriber: { email: "this isn't an email address" }
|
37
|
+
it { should render_template :new }
|
34
38
|
end
|
35
|
-
|
36
|
-
it { should respond_with 422 }
|
37
|
-
|
38
39
|
end
|
39
40
|
|
40
|
-
context '
|
41
|
-
|
42
|
-
|
41
|
+
context 'in reponse to an ajax (json) request' do
|
42
|
+
context 'with valid address' do
|
43
|
+
before do
|
44
|
+
post :create, format: :json, subscriber: { email: "valid.address@thegarage.us" }
|
45
|
+
end
|
46
|
+
specify { expect(subject.request.flash).to be_empty }
|
43
47
|
end
|
44
48
|
|
45
|
-
|
49
|
+
context 'with invalid address' do
|
50
|
+
before do
|
51
|
+
post :create, format: :json, subscriber: { email: "this isn't an email address" }
|
52
|
+
end
|
53
|
+
|
54
|
+
it { should respond_with 422 }
|
55
|
+
end
|
46
56
|
end
|
47
57
|
end
|
48
58
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: waitlist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- The Garage
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|