customer_vault 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +3 -0
  4. data/Rakefile +22 -0
  5. data/app/assets/javascripts/customer_vault/application.js +13 -0
  6. data/app/assets/javascripts/customer_vault/corporations.js +2 -0
  7. data/app/assets/javascripts/customer_vault/people.js +2 -0
  8. data/app/assets/stylesheets/customer_vault/application.css +13 -0
  9. data/app/assets/stylesheets/customer_vault/corporations.css +4 -0
  10. data/app/assets/stylesheets/customer_vault/people.css +4 -0
  11. data/app/assets/stylesheets/scaffold.css +56 -0
  12. data/app/controllers/customer_vault/application_controller.rb +4 -0
  13. data/app/controllers/customer_vault/corporations_controller.rb +62 -0
  14. data/app/controllers/customer_vault/people_controller.rb +62 -0
  15. data/app/helpers/customer_vault/application_helper.rb +4 -0
  16. data/app/helpers/customer_vault/corporations_helper.rb +4 -0
  17. data/app/helpers/customer_vault/people_helper.rb +4 -0
  18. data/app/models/customer_vault/corporation.rb +5 -0
  19. data/app/models/customer_vault/person.rb +6 -0
  20. data/app/views/customer_vault/corporations/_form.html.slim +21 -0
  21. data/app/views/customer_vault/corporations/edit.html.slim +8 -0
  22. data/app/views/customer_vault/corporations/index.html.slim +27 -0
  23. data/app/views/customer_vault/corporations/new.html.slim +5 -0
  24. data/app/views/customer_vault/corporations/show.html.slim +18 -0
  25. data/app/views/customer_vault/people/_form.html.slim +39 -0
  26. data/app/views/customer_vault/people/edit.html.slim +8 -0
  27. data/app/views/customer_vault/people/index.html.slim +39 -0
  28. data/app/views/customer_vault/people/new.html.slim +5 -0
  29. data/app/views/customer_vault/people/show.html.slim +36 -0
  30. data/app/views/layouts/customer_vault/application.html.erb +14 -0
  31. data/config/routes.rb +6 -0
  32. data/db/migrate/20141006095617_create_customer_vault_people.rb +18 -0
  33. data/db/migrate/20141010095816_create_customer_vault_corporations.rb +12 -0
  34. data/lib/customer_vault.rb +4 -0
  35. data/lib/customer_vault/engine.rb +11 -0
  36. data/lib/customer_vault/version.rb +3 -0
  37. data/lib/tasks/customer_vault_tasks.rake +4 -0
  38. data/spec/controllers/customer_vault/corporations_controller_spec.rb +163 -0
  39. data/spec/controllers/customer_vault/people_controller_spec.rb +163 -0
  40. data/spec/dummy/README.rdoc +28 -0
  41. data/spec/dummy/Rakefile +6 -0
  42. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  43. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  44. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  45. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  46. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  47. data/spec/dummy/bin/bundle +3 -0
  48. data/spec/dummy/bin/rails +4 -0
  49. data/spec/dummy/bin/rake +4 -0
  50. data/spec/dummy/config.ru +4 -0
  51. data/spec/dummy/config/application.rb +23 -0
  52. data/spec/dummy/config/boot.rb +5 -0
  53. data/spec/dummy/config/database.yml +25 -0
  54. data/spec/dummy/config/environment.rb +5 -0
  55. data/spec/dummy/config/environments/development.rb +32 -0
  56. data/spec/dummy/config/environments/production.rb +80 -0
  57. data/spec/dummy/config/environments/test.rb +39 -0
  58. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  59. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  60. data/spec/dummy/config/initializers/inflections.rb +16 -0
  61. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  62. data/spec/dummy/config/initializers/secret_token.rb +12 -0
  63. data/spec/dummy/config/initializers/session_store.rb +3 -0
  64. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  65. data/spec/dummy/config/locales/en.yml +23 -0
  66. data/spec/dummy/config/routes.rb +4 -0
  67. data/spec/dummy/db/development.sqlite3 +0 -0
  68. data/spec/dummy/db/schema.rb +40 -0
  69. data/spec/dummy/db/test.sqlite3 +0 -0
  70. data/spec/dummy/log/development.log +652 -0
  71. data/spec/dummy/log/test.log +5110 -0
  72. data/spec/dummy/public/404.html +58 -0
  73. data/spec/dummy/public/422.html +58 -0
  74. data/spec/dummy/public/500.html +57 -0
  75. data/spec/dummy/public/favicon.ico +0 -0
  76. data/spec/dummy/tmp/cache/assets/development/sprockets/2b9d45522b3d1f3105e1c33e325dc6de +0 -0
  77. data/spec/dummy/tmp/cache/assets/development/sprockets/34d14962fde7e4fd6e2671844bcfaa78 +0 -0
  78. data/spec/dummy/tmp/cache/assets/development/sprockets/47170c4182a8457e8d53507ea76fa76b +0 -0
  79. data/spec/dummy/tmp/cache/assets/development/sprockets/78ef508640527d1bb135c1077223fb7c +0 -0
  80. data/spec/dummy/tmp/cache/assets/development/sprockets/a1b854a09ea96f64f07c9d3692d9cd9b +0 -0
  81. data/spec/dummy/tmp/cache/assets/development/sprockets/a5c73696137ab9dbdda376c8d7ffa3b9 +0 -0
  82. data/spec/dummy/tmp/cache/assets/development/sprockets/ad1a12f0fbac31c992fbc716a5e504bb +0 -0
  83. data/spec/dummy/tmp/cache/assets/development/sprockets/b10f86698e41bfdaafc9fb6bbf5bfbd9 +0 -0
  84. data/spec/dummy/tmp/cache/assets/development/sprockets/c9db74506cdab0aec9f855c956f47726 +0 -0
  85. data/spec/dummy/tmp/cache/assets/development/sprockets/db5f1ec4fd27d454a95b2824fff064d1 +0 -0
  86. data/spec/dummy/tmp/cache/assets/development/sprockets/e5782a71fc01b88e6ac0c1c963bf7e3e +0 -0
  87. data/spec/dummy/tmp/cache/assets/development/sprockets/f516186931f15a3e5c86af1b1632d256 +0 -0
  88. data/spec/factories/customer_vault_corporations.rb +10 -0
  89. data/spec/factories/customer_vault_people.rb +16 -0
  90. data/spec/helpers/customer_vault/corporations_helper_spec.rb +16 -0
  91. data/spec/helpers/customer_vault/people_helper_spec.rb +16 -0
  92. data/spec/models/customer_vault/corporation_spec.rb +7 -0
  93. data/spec/models/customer_vault/person_spec.rb +14 -0
  94. data/spec/rails_helper.rb +54 -0
  95. data/spec/routing/customer_vault/corporations_routing_spec.rb +37 -0
  96. data/spec/routing/customer_vault/people_routing_spec.rb +37 -0
  97. data/spec/spec_helper.rb +86 -0
  98. data/spec/views/customer_vault/corporations/edit.html.slim_spec.rb +29 -0
  99. data/spec/views/customer_vault/corporations/index.html.slim_spec.rb +29 -0
  100. data/spec/views/customer_vault/corporations/new.html.slim_spec.rb +28 -0
  101. data/spec/views/customer_vault/corporations/show.html.slim_spec.rb +21 -0
  102. data/spec/views/customer_vault/people/edit.html.slim_spec.rb +47 -0
  103. data/spec/views/customer_vault/people/index.html.slim_spec.rb +47 -0
  104. data/spec/views/customer_vault/people/new.html.slim_spec.rb +47 -0
  105. data/spec/views/customer_vault/people/show.html.slim_spec.rb +34 -0
  106. metadata +300 -0
@@ -0,0 +1,8 @@
1
+ h1 Editing person
2
+
3
+ == render 'form'
4
+
5
+ = link_to 'Show', [customer_vault, @person]
6
+ '|
7
+ = link_to 'Back', customer_vault.people_path
8
+
@@ -0,0 +1,39 @@
1
+ h1 Listing people
2
+
3
+ table
4
+ thead
5
+ tr
6
+ th First name
7
+ th Last name
8
+ th Email
9
+ th Title
10
+ th Twitter
11
+ th Www
12
+ th Context
13
+ th Phone
14
+ th Fax
15
+ th Mobile
16
+ th
17
+ th
18
+ th
19
+
20
+ tbody
21
+ - @people.each do |person|
22
+ tr
23
+ td = person.first_name
24
+ td = person.last_name
25
+ td = person.email
26
+ td = person.title
27
+ td = person.twitter
28
+ td = person.www
29
+ td = person.context
30
+ td = person.phone
31
+ td = person.fax
32
+ td = person.mobile
33
+ td = link_to 'Show', [customer_vault, person]
34
+ td = link_to 'Edit', customer_vault.edit_person_path(person)
35
+ td = link_to 'Destroy', [customer_vault, person], data: {:confirm => 'Are you sure?'}, :method => :delete
36
+
37
+ br
38
+
39
+ = link_to 'New Person', customer_vault.new_person_path
@@ -0,0 +1,5 @@
1
+ h1 New person
2
+
3
+ == render 'form'
4
+
5
+ = link_to 'Back', customer_vault.people_path
@@ -0,0 +1,36 @@
1
+ p#notice = notice
2
+
3
+ p
4
+ strong First name:
5
+ = @person.first_name
6
+ p
7
+ strong Last name:
8
+ = @person.last_name
9
+ p
10
+ strong Email:
11
+ = @person.email
12
+ p
13
+ strong Title:
14
+ = @person.title
15
+ p
16
+ strong Twitter:
17
+ = @person.twitter
18
+ p
19
+ strong Www:
20
+ = @person.www
21
+ p
22
+ strong Context:
23
+ = @person.context
24
+ p
25
+ strong Phone:
26
+ = @person.phone
27
+ p
28
+ strong Fax:
29
+ = @person.fax
30
+ p
31
+ strong Mobile:
32
+ = @person.mobile
33
+
34
+ = link_to 'Edit', customer_vault.edit_person_path(@person)
35
+ '|
36
+ = link_to 'Back', customer_vault.people_path
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>CustomerVault</title>
5
+ <%= stylesheet_link_tag "customer_vault/application", media: "all" %>
6
+ <%= javascript_include_tag "customer_vault/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
data/config/routes.rb ADDED
@@ -0,0 +1,6 @@
1
+ CustomerVault::Engine.routes.draw do
2
+ resources :corporations
3
+
4
+ resources :people
5
+
6
+ end
@@ -0,0 +1,18 @@
1
+ class CreateCustomerVaultPeople < ActiveRecord::Migration
2
+ def change
3
+ create_table :customer_vault_people do |t|
4
+ t.string :first_name
5
+ t.string :last_name
6
+ t.string :email
7
+ t.string :title
8
+ t.string :twitter
9
+ t.string :www
10
+ t.text :context
11
+ t.string :phone
12
+ t.string :fax
13
+ t.string :mobile
14
+
15
+ t.timestamps
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,12 @@
1
+ class CreateCustomerVaultCorporations < ActiveRecord::Migration
2
+ def change
3
+ create_table :customer_vault_corporations do |t|
4
+ t.string :name
5
+ t.string :email
6
+ t.string :phone
7
+ t.string :fax
8
+
9
+ t.timestamps
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,4 @@
1
+ require "customer_vault/engine"
2
+
3
+ module CustomerVault
4
+ end
@@ -0,0 +1,11 @@
1
+ module CustomerVault
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace CustomerVault
4
+
5
+ config.generators do |g|
6
+ g.test_framework :rspec
7
+ g.fixture_replacement :factory_girl, :dir => 'spec/factories'
8
+ g.template_engine :slim
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,3 @@
1
+ module CustomerVault
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :customer_vault do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,163 @@
1
+ require 'rails_helper'
2
+
3
+ # This spec was generated by rspec-rails when you ran the scaffold generator.
4
+ # It demonstrates how one might use RSpec to specify the controller code that
5
+ # was generated by Rails when you ran the scaffold generator.
6
+ #
7
+ # It assumes that the implementation code is generated by the rails scaffold
8
+ # generator. If you are using any extension libraries to generate different
9
+ # controller code, this generated spec may or may not pass.
10
+ #
11
+ # It only uses APIs available in rails and/or rspec-rails. There are a number
12
+ # of tools you can use to make these specs even more expressive, but we're
13
+ # sticking to rails and rspec-rails APIs to keep things simple and stable.
14
+ #
15
+ # Compared to earlier versions of this generator, there is very limited use of
16
+ # stubs and message expectations in this spec. Stubs are only used when there
17
+ # is no simpler way to get a handle on the object needed for the example.
18
+ # Message expectations are only used when there is no simpler way to specify
19
+ # that an instance is receiving a specific message.
20
+
21
+ module CustomerVault
22
+ RSpec.describe CorporationsController, :type => :controller do
23
+
24
+ routes { CustomerVault::Engine.routes }
25
+
26
+ # This should return the minimal set of attributes required to create a valid
27
+ # Corporation. As you add validations to Corporation, be sure to
28
+ # adjust the attributes here as well.
29
+ let(:valid_attributes) {
30
+ FactoryGirl.attributes_for(:customer_vault_corporation)
31
+ }
32
+
33
+ let(:invalid_attributes) {
34
+ {name: ''}
35
+ }
36
+
37
+ # This should return the minimal set of values that should be in the session
38
+ # in order to pass any filters (e.g. authentication) defined in
39
+ # CorporationsController. Be sure to keep this updated too.
40
+ let(:valid_session) { {} }
41
+
42
+ describe "GET index" do
43
+ it "assigns all corporations as @corporations" do
44
+ corporation = Corporation.create! valid_attributes
45
+ get :index, {}, valid_session
46
+ expect(assigns(:corporations)).to eq([corporation])
47
+ end
48
+ end
49
+
50
+ describe "GET show" do
51
+ it "assigns the requested corporation as @corporation" do
52
+ corporation = Corporation.create! valid_attributes
53
+ get :show, {:id => corporation.to_param}, valid_session
54
+ expect(assigns(:corporation)).to eq(corporation)
55
+ end
56
+ end
57
+
58
+ describe "GET new" do
59
+ it "assigns a new corporation as @corporation" do
60
+ get :new, {}, valid_session
61
+ expect(assigns(:corporation)).to be_a_new(Corporation)
62
+ end
63
+ end
64
+
65
+ describe "GET edit" do
66
+ it "assigns the requested corporation as @corporation" do
67
+ corporation = Corporation.create! valid_attributes
68
+ get :edit, {:id => corporation.to_param}, valid_session
69
+ expect(assigns(:corporation)).to eq(corporation)
70
+ end
71
+ end
72
+
73
+ describe "POST create" do
74
+ describe "with valid params" do
75
+ it "creates a new Corporation" do
76
+ expect {
77
+ post :create, {:corporation => valid_attributes}, valid_session
78
+ }.to change(Corporation, :count).by(1)
79
+ end
80
+
81
+ it "assigns a newly created corporation as @corporation" do
82
+ post :create, {:corporation => valid_attributes}, valid_session
83
+ expect(assigns(:corporation)).to be_a(Corporation)
84
+ expect(assigns(:corporation)).to be_persisted
85
+ end
86
+
87
+ it "redirects to the created corporation" do
88
+ post :create, {:corporation => valid_attributes}, valid_session
89
+ expect(response).to redirect_to(Corporation.last)
90
+ end
91
+ end
92
+
93
+ describe "with invalid params" do
94
+ it "assigns a newly created but unsaved corporation as @corporation" do
95
+ post :create, {:corporation => invalid_attributes}, valid_session
96
+ expect(assigns(:corporation)).to be_a_new(Corporation)
97
+ end
98
+
99
+ it "re-renders the 'new' template" do
100
+ post :create, {:corporation => invalid_attributes}, valid_session
101
+ expect(response).to render_template("new")
102
+ end
103
+ end
104
+ end
105
+
106
+ describe "PUT update" do
107
+ describe "with valid params" do
108
+ let(:new_attributes) {
109
+ {name: 'New name'}
110
+ }
111
+
112
+ it "updates the requested corporation" do
113
+ corporation = Corporation.create! valid_attributes
114
+ put :update, {:id => corporation.to_param, :corporation => new_attributes}, valid_session
115
+ corporation.reload
116
+ expect(corporation.name).to eq('New name')
117
+ end
118
+
119
+ it "assigns the requested corporation as @corporation" do
120
+ corporation = Corporation.create! valid_attributes
121
+ put :update, {:id => corporation.to_param, :corporation => valid_attributes}, valid_session
122
+ expect(assigns(:corporation)).to eq(corporation)
123
+ end
124
+
125
+ it "redirects to the corporation" do
126
+ corporation = Corporation.create! valid_attributes
127
+ put :update, {:id => corporation.to_param, :corporation => valid_attributes}, valid_session
128
+ expect(response).to redirect_to(corporation)
129
+ end
130
+ end
131
+
132
+ describe "with invalid params" do
133
+ it "assigns the corporation as @corporation" do
134
+ corporation = Corporation.create! valid_attributes
135
+ put :update, {:id => corporation.to_param, :corporation => invalid_attributes}, valid_session
136
+ expect(assigns(:corporation)).to eq(corporation)
137
+ end
138
+
139
+ it "re-renders the 'edit' template" do
140
+ corporation = Corporation.create! valid_attributes
141
+ put :update, {:id => corporation.to_param, :corporation => invalid_attributes}, valid_session
142
+ expect(response).to render_template("edit")
143
+ end
144
+ end
145
+ end
146
+
147
+ describe "DELETE destroy" do
148
+ it "destroys the requested corporation" do
149
+ corporation = Corporation.create! valid_attributes
150
+ expect {
151
+ delete :destroy, {:id => corporation.to_param}, valid_session
152
+ }.to change(Corporation, :count).by(-1)
153
+ end
154
+
155
+ it "redirects to the corporations list" do
156
+ corporation = Corporation.create! valid_attributes
157
+ delete :destroy, {:id => corporation.to_param}, valid_session
158
+ expect(response).to redirect_to(corporations_url)
159
+ end
160
+ end
161
+
162
+ end
163
+ end
@@ -0,0 +1,163 @@
1
+ require 'rails_helper'
2
+
3
+ # This spec was generated by rspec-rails when you ran the scaffold generator.
4
+ # It demonstrates how one might use RSpec to specify the controller code that
5
+ # was generated by Rails when you ran the scaffold generator.
6
+ #
7
+ # It assumes that the implementation code is generated by the rails scaffold
8
+ # generator. If you are using any extension libraries to generate different
9
+ # controller code, this generated spec may or may not pass.
10
+ #
11
+ # It only uses APIs available in rails and/or rspec-rails. There are a number
12
+ # of tools you can use to make these specs even more expressive, but we're
13
+ # sticking to rails and rspec-rails APIs to keep things simple and stable.
14
+ #
15
+ # Compared to earlier versions of this generator, there is very limited use of
16
+ # stubs and message expectations in this spec. Stubs are only used when there
17
+ # is no simpler way to get a handle on the object needed for the example.
18
+ # Message expectations are only used when there is no simpler way to specify
19
+ # that an instance is receiving a specific message.
20
+
21
+ module CustomerVault
22
+ RSpec.describe PeopleController, :type => :controller do
23
+
24
+ routes { CustomerVault::Engine.routes }
25
+
26
+ # This should return the minimal set of attributes required to create a valid
27
+ # Person. As you add validations to Person, be sure to
28
+ # adjust the attributes here as well.
29
+ let(:valid_attributes) {
30
+ FactoryGirl.attributes_for(:customer_vault_person)
31
+ }
32
+
33
+ let(:invalid_attributes) {
34
+ { last_name: "" }
35
+ }
36
+
37
+ # This should return the minimal set of values that should be in the session
38
+ # in order to pass any filters (e.g. authentication) defined in
39
+ # PeopleController. Be sure to keep this updated too.
40
+ let(:valid_session) { {} }
41
+
42
+ describe "GET index" do
43
+ it "assigns all people as @people" do
44
+ person = Person.create! valid_attributes
45
+ get :index, {}, valid_session
46
+ expect(assigns(:people)).to eq([person])
47
+ end
48
+ end
49
+
50
+ describe "GET show" do
51
+ it "assigns the requested person as @person" do
52
+ person = Person.create! valid_attributes
53
+ get :show, {:id => person.to_param, :use_route => :customer_vault}, valid_session
54
+ expect(assigns(:person)).to eq(person)
55
+ end
56
+ end
57
+
58
+ describe "GET new" do
59
+ it "assigns a new person as @person" do
60
+ get :new, {}, valid_session
61
+ expect(assigns(:person)).to be_a_new(Person)
62
+ end
63
+ end
64
+
65
+ describe "GET edit" do
66
+ it "assigns the requested person as @person" do
67
+ person = Person.create! valid_attributes
68
+ get :edit, {:id => person.to_param}, valid_session
69
+ expect(assigns(:person)).to eq(person)
70
+ end
71
+ end
72
+
73
+ describe "POST create" do
74
+ describe "with valid params" do
75
+ it "creates a new Person" do
76
+ expect {
77
+ post :create, {:person => valid_attributes}, valid_session
78
+ }.to change(Person, :count).by(1)
79
+ end
80
+
81
+ it "assigns a newly created person as @person" do
82
+ post :create, {:person => valid_attributes}, valid_session
83
+ expect(assigns(:person)).to be_a(Person)
84
+ expect(assigns(:person)).to be_persisted
85
+ end
86
+
87
+ it "redirects to the created person" do
88
+ post :create, {:person => valid_attributes}, valid_session
89
+ expect(response).to redirect_to(Person.last)
90
+ end
91
+ end
92
+
93
+ describe "with invalid params" do
94
+ it "assigns a newly created but unsaved person as @person" do
95
+ post :create, {:person => invalid_attributes}, valid_session
96
+ expect(assigns(:person)).to be_a_new(Person)
97
+ end
98
+
99
+ it "re-renders the 'new' template" do
100
+ post :create, {:person => invalid_attributes}, valid_session
101
+ expect(response).to render_template("new")
102
+ end
103
+ end
104
+ end
105
+
106
+ describe "PUT update" do
107
+ describe "with valid params" do
108
+ let(:new_attributes) {
109
+ {first_name: "Stroumph"}
110
+ }
111
+
112
+ it "updates the requested person" do
113
+ person = Person.create! valid_attributes
114
+ put :update, {:id => person.to_param, :person => new_attributes}, valid_session
115
+ person.reload
116
+ expect(person.first_name).to eq("Stroumph")
117
+ end
118
+
119
+ it "assigns the requested person as @person" do
120
+ person = Person.create! valid_attributes
121
+ put :update, {:id => person.to_param, :person => valid_attributes}, valid_session
122
+ expect(assigns(:person)).to eq(person)
123
+ end
124
+
125
+ it "redirects to the person" do
126
+ person = Person.create! valid_attributes
127
+ put :update, {:id => person.to_param, :person => valid_attributes}, valid_session
128
+ expect(response).to redirect_to(person)
129
+ end
130
+ end
131
+
132
+ describe "with invalid params" do
133
+ it "assigns the person as @person" do
134
+ person = Person.create! valid_attributes
135
+ put :update, {:id => person.to_param, :person => invalid_attributes}, valid_session
136
+ expect(assigns(:person)).to eq(person)
137
+ end
138
+
139
+ it "re-renders the 'edit' template" do
140
+ person = Person.create! valid_attributes
141
+ put :update, {:id => person.to_param, :person => invalid_attributes}, valid_session
142
+ expect(response).to render_template("edit")
143
+ end
144
+ end
145
+ end
146
+
147
+ describe "DELETE destroy" do
148
+ it "destroys the requested person" do
149
+ person = Person.create! valid_attributes
150
+ expect {
151
+ delete :destroy, {:id => person.to_param}, valid_session
152
+ }.to change(Person, :count).by(-1)
153
+ end
154
+
155
+ it "redirects to the people list" do
156
+ person = Person.create! valid_attributes
157
+ delete :destroy, {:id => person.to_param}, valid_session
158
+ expect(response).to redirect_to(people_url)
159
+ end
160
+ end
161
+
162
+ end
163
+ end