waitlist 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 35cfedc9e1889b2aab2989b9341c56397ac720e8
4
- data.tar.gz: be60c9da7cf9e5b3100eff50ca07584ccc066172
3
+ metadata.gz: 6533afd54c85162594112e75d3c9e98753bc88a7
4
+ data.tar.gz: 33320c6c3bcb723646e3c71e17e75498d5bf2dfe
5
5
  SHA512:
6
- metadata.gz: 98ee639f050ac83071d0b322bc837c59fb7255611ee26b6659eaea29de8c9bfbe9d56f24ea8778155011ba206917b1820bf895dd388eb74bdf623067609d9f63
7
- data.tar.gz: 762ead494757ab9276188df6e7c214c18d387af89050708d72fbb29b68e883c2384aaca07564b2b7b145fd79e578455f211519f939bd685cc1507342a32155cc
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
@@ -1,3 +1,3 @@
1
1
  module Waitlist
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
@@ -13,36 +13,46 @@ RSpec.describe Waitlist::SubscribersController do
13
13
  end
14
14
 
15
15
  describe '#create' do
16
- context 'with valid address' do
17
- before do
18
- post :create, subscriber: { email: 'valid.address@thegarage.us' }
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
- it { should redirect_to '/' }
22
- end
23
- context 'with valid request and params[:return_to]' do
24
- let(:redirect_url) { 'http://google.com' }
25
- before do
26
- post :create, subscriber: { email: 'valid.address@thegarage.us' }, return_to: redirect_url
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
- it { should redirect_to redirect_url }
29
- end
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
- context 'as a json ajax request with invalid paramaters' do
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 'with invalid address' do
41
- before do
42
- post :create, subscriber: { email: "this isn't an email address" }
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
- it { should render_template :new }
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.0
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-07 00:00:00.000000000 Z
11
+ date: 2014-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails