customer_vault 0.0.4 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (177) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +2 -2
  3. data/app/assets/images/customer_vault/icons/group-128.png +0 -0
  4. data/app/assets/images/customer_vault/icons/group-16.png +0 -0
  5. data/app/assets/images/customer_vault/icons/group-20.png +0 -0
  6. data/app/assets/images/customer_vault/icons/group-24.png +0 -0
  7. data/app/assets/images/customer_vault/icons/group-256.png +0 -0
  8. data/app/assets/images/customer_vault/icons/group-32.png +0 -0
  9. data/app/assets/images/customer_vault/icons/group-48.png +0 -0
  10. data/app/assets/images/customer_vault/icons/group-512.png +0 -0
  11. data/app/assets/images/customer_vault/icons/group-64.png +0 -0
  12. data/app/assets/stylesheets/customer_vault/{application.css → application.css.scss} +54 -5
  13. data/app/assets/stylesheets/customer_vault/{people.css → individuals.css} +1 -0
  14. data/app/assets/stylesheets/customer_vault/links.css +3 -0
  15. data/app/controllers/customer_vault/corporations_controller.rb +5 -7
  16. data/app/controllers/customer_vault/individuals_controller.rb +61 -0
  17. data/app/controllers/customer_vault/links_controller.rb +53 -0
  18. data/app/controllers/customer_vault/people_controller.rb +5 -54
  19. data/app/helpers/customer_vault/individuals_helper.rb +4 -0
  20. data/app/models/customer_vault/corporation.rb +5 -1
  21. data/app/models/customer_vault/individual.rb +15 -0
  22. data/app/models/customer_vault/link.rb +6 -0
  23. data/app/models/customer_vault/person.rb +13 -2
  24. data/app/views/customer_vault/corporations/_form.html.slim +28 -21
  25. data/app/views/customer_vault/corporations/_list_details.html.slim +29 -0
  26. data/app/views/customer_vault/corporations/_show_details.html.slim +36 -0
  27. data/app/views/customer_vault/corporations/edit.html.slim +22 -7
  28. data/app/views/customer_vault/corporations/new.html.slim +22 -5
  29. data/app/views/customer_vault/corporations/show.html.slim +41 -16
  30. data/app/views/customer_vault/{people → individuals}/_form.html.slim +16 -13
  31. data/app/views/customer_vault/individuals/_list_details.html.slim +39 -0
  32. data/app/views/customer_vault/individuals/_show_details.html.slim +52 -0
  33. data/app/views/customer_vault/individuals/edit.html.slim +23 -0
  34. data/app/views/customer_vault/individuals/new.html.slim +25 -0
  35. data/app/views/customer_vault/individuals/show.html.slim +42 -0
  36. data/app/views/customer_vault/layout/_form_error.html.slim +5 -0
  37. data/app/views/customer_vault/links/_aside.html.slim +4 -0
  38. data/app/views/customer_vault/links/_title.html.slim +3 -0
  39. data/app/views/customer_vault/links/edit.html.slim +30 -0
  40. data/app/views/customer_vault/links/new.html.slim +32 -0
  41. data/app/views/customer_vault/people/_select.html.slim +1 -0
  42. data/app/views/customer_vault/people/index.html.slim +29 -58
  43. data/config/cucumber.yml +8 -0
  44. data/config/routes.rb +7 -3
  45. data/db/migrate/20141016151955_change_people_to_individuals.rb +5 -0
  46. data/db/migrate/20141017085621_add_link.rb +12 -0
  47. data/lib/customer_vault/engine.rb +1 -0
  48. data/lib/customer_vault/version.rb +1 -1
  49. data/lib/tasks/cucumber.rake +65 -0
  50. data/spec/controllers/customer_vault/corporations_controller_spec.rb +3 -9
  51. data/spec/controllers/customer_vault/individuals_controller_spec.rb +156 -0
  52. data/spec/dummy/config/initializers/inflections.rb +1 -1
  53. data/spec/dummy/config/routes.rb +1 -1
  54. data/spec/dummy/db/development.sqlite3 +0 -0
  55. data/spec/dummy/db/migrate/20141013153526_create_dorsale_addresses.dorsale.rb +14 -0
  56. data/spec/dummy/db/migrate/20141014073225_add_polymorphic_fields_to_addresses.dorsale.rb +7 -0
  57. data/spec/dummy/db/schema.rb +24 -2
  58. data/spec/dummy/db/test.sqlite3 +0 -0
  59. data/spec/dummy/log/development.log +22059 -0
  60. data/spec/dummy/log/test.log +35561 -0
  61. data/spec/dummy/tmp/cache/assets/development/sass/8f425af8af5194cec6da5008411d913407b2b024/application.css.scssc +0 -0
  62. data/spec/dummy/tmp/cache/assets/development/sprockets/03c4e7aa08d7d8a9e984a1e4eea01566 +0 -0
  63. data/spec/dummy/tmp/cache/assets/development/sprockets/190ff82deecfbbe385c03ee8f8f3d2bf +0 -0
  64. data/spec/dummy/tmp/cache/assets/development/sprockets/201cb9b3ce55f2f4dea6232ab8220cc3 +0 -0
  65. data/spec/dummy/tmp/cache/assets/development/sprockets/2de61d7dd16d9e661790bc2973cc609a +0 -0
  66. data/spec/dummy/tmp/cache/assets/development/sprockets/34d14962fde7e4fd6e2671844bcfaa78 +0 -0
  67. data/spec/dummy/tmp/cache/assets/development/sprockets/39c67f2e186cde8355bb4533f16da267 +0 -0
  68. data/spec/dummy/tmp/cache/assets/development/sprockets/47170c4182a8457e8d53507ea76fa76b +0 -0
  69. data/spec/dummy/tmp/cache/assets/development/sprockets/471d75c3acc9522efc857f3be05b8375 +0 -0
  70. data/spec/dummy/tmp/cache/assets/development/sprockets/49ff98533b89b4c09d5d1ecb9d45f207 +0 -0
  71. data/spec/dummy/tmp/cache/assets/development/sprockets/4b15ccd40e1d9deecfe3f523edb32a25 +0 -0
  72. data/spec/dummy/tmp/cache/assets/development/sprockets/4cd6d71a32c5da916328bfcfa972bd6c +0 -0
  73. data/spec/dummy/tmp/cache/assets/development/sprockets/5d0e775359a27eb80c837eee1bdd52cb +0 -0
  74. data/spec/dummy/tmp/cache/assets/development/sprockets/6355dea7c574d08602bd4e7e16a4c0d2 +0 -0
  75. data/spec/dummy/tmp/cache/assets/development/sprockets/6847fabb2f2a2ff6011d957adb14a11e +0 -0
  76. data/spec/dummy/tmp/cache/assets/development/sprockets/78ef508640527d1bb135c1077223fb7c +0 -0
  77. data/spec/dummy/tmp/cache/assets/development/sprockets/8e1929049a5ed5974d9bbb22b2c1bbc4 +0 -0
  78. data/spec/dummy/tmp/cache/assets/development/sprockets/92220e9fcf5e0717b9dc27169bf512e9 +0 -0
  79. data/spec/dummy/tmp/cache/assets/development/sprockets/a774486cb0f2787691a7e585e008caea +0 -0
  80. data/spec/dummy/tmp/cache/assets/development/sprockets/aa60fba48cd1c25f138255570918b3db +0 -0
  81. data/spec/dummy/tmp/cache/assets/development/sprockets/ac788eb47a519e5f2837cf9504d74f53 +0 -0
  82. data/spec/dummy/tmp/cache/assets/development/sprockets/ac8cf41eb80a554f4f15e80fa6e1ea58 +0 -0
  83. data/spec/dummy/tmp/cache/assets/development/sprockets/df9e45a4bc905f29f8544c37dc9e9a18 +0 -0
  84. data/spec/dummy/tmp/cache/assets/development/sprockets/e5782a71fc01b88e6ac0c1c963bf7e3e +0 -0
  85. data/spec/dummy/tmp/cache/assets/development/sprockets/f516186931f15a3e5c86af1b1632d256 +0 -0
  86. data/spec/dummy/tmp/cache/assets/development/sprockets/faca8abcf70e21e966cebb74604b729f +0 -0
  87. data/spec/dummy/tmp/cache/assets/test/sass/8f425af8af5194cec6da5008411d913407b2b024/application.css.scssc +0 -0
  88. data/spec/dummy/tmp/cache/assets/test/sprockets/03c4e7aa08d7d8a9e984a1e4eea01566 +0 -0
  89. data/spec/dummy/tmp/cache/assets/test/sprockets/0e2a9601926844c961e7e97d32e775be +0 -0
  90. data/spec/dummy/tmp/cache/assets/test/sprockets/183bdc6b3ba504dc16e7b94a0f38fe06 +0 -0
  91. data/spec/dummy/tmp/cache/assets/test/sprockets/190ff82deecfbbe385c03ee8f8f3d2bf +0 -0
  92. data/spec/dummy/tmp/cache/assets/test/sprockets/1dc5cb7209fcdb172bfcde9c841c19e3 +0 -0
  93. data/spec/dummy/tmp/cache/assets/test/sprockets/201cb9b3ce55f2f4dea6232ab8220cc3 +0 -0
  94. data/spec/dummy/tmp/cache/assets/test/sprockets/2b9d45522b3d1f3105e1c33e325dc6de +0 -0
  95. data/spec/dummy/tmp/cache/assets/test/sprockets/2df425d43fef5663aadfc1bcc3087066 +0 -0
  96. data/spec/dummy/tmp/cache/assets/test/sprockets/2e7625733abd8050be92fe0ca1487fad +0 -0
  97. data/spec/dummy/tmp/cache/assets/test/sprockets/31876fc299b61887fae3e657773d7b15 +0 -0
  98. data/spec/dummy/tmp/cache/assets/test/sprockets/338e8df8f4119a2a48b920613a8026a9 +0 -0
  99. data/spec/dummy/tmp/cache/assets/test/sprockets/34d14962fde7e4fd6e2671844bcfaa78 +0 -0
  100. data/spec/dummy/tmp/cache/assets/test/sprockets/36adb34aba0d7825a4c9a4cf09c33572 +0 -0
  101. data/spec/dummy/tmp/cache/assets/test/sprockets/39c67f2e186cde8355bb4533f16da267 +0 -0
  102. data/spec/dummy/tmp/cache/assets/test/sprockets/40dbaa1db791d7be2279ddd67d33a1c4 +0 -0
  103. data/spec/dummy/tmp/cache/assets/test/sprockets/47170c4182a8457e8d53507ea76fa76b +0 -0
  104. data/spec/dummy/tmp/cache/assets/test/sprockets/471d75c3acc9522efc857f3be05b8375 +0 -0
  105. data/spec/dummy/tmp/cache/assets/test/sprockets/49ff98533b89b4c09d5d1ecb9d45f207 +0 -0
  106. data/spec/dummy/tmp/cache/assets/test/sprockets/4b15ccd40e1d9deecfe3f523edb32a25 +0 -0
  107. data/spec/dummy/tmp/cache/assets/test/sprockets/4cd6d71a32c5da916328bfcfa972bd6c +0 -0
  108. data/spec/dummy/tmp/cache/assets/test/sprockets/4d0235c7b6e465a89ad270537681be7f +0 -0
  109. data/spec/dummy/tmp/cache/assets/test/sprockets/52f82b29641b7e97fabca983410c944d +0 -0
  110. data/spec/dummy/tmp/cache/assets/test/sprockets/5b95ef84d5ea3822d0364f3a6f5fa9ff +0 -0
  111. data/spec/dummy/tmp/cache/assets/test/sprockets/5bc4ad6e6b955197190847aeff8df8bd +0 -0
  112. data/spec/dummy/tmp/cache/assets/test/sprockets/5d0e775359a27eb80c837eee1bdd52cb +0 -0
  113. data/spec/dummy/tmp/cache/assets/test/sprockets/6355dea7c574d08602bd4e7e16a4c0d2 +0 -0
  114. data/spec/dummy/tmp/cache/assets/test/sprockets/67a7734fae2f02d979ee498add75d3eb +0 -0
  115. data/spec/dummy/tmp/cache/assets/test/sprockets/6847fabb2f2a2ff6011d957adb14a11e +0 -0
  116. data/spec/dummy/tmp/cache/assets/test/sprockets/78ef508640527d1bb135c1077223fb7c +0 -0
  117. data/spec/dummy/tmp/cache/assets/test/sprockets/86a049860d05103d78ab689003d6ccb3 +0 -0
  118. data/spec/dummy/tmp/cache/assets/test/sprockets/8e1929049a5ed5974d9bbb22b2c1bbc4 +0 -0
  119. data/spec/dummy/tmp/cache/assets/test/sprockets/92220e9fcf5e0717b9dc27169bf512e9 +0 -0
  120. data/spec/dummy/tmp/cache/assets/test/sprockets/a5c73696137ab9dbdda376c8d7ffa3b9 +0 -0
  121. data/spec/dummy/tmp/cache/assets/test/sprockets/a8e30d24c0bb5789981c4751cd2cdd76 +0 -0
  122. data/spec/dummy/tmp/cache/assets/test/sprockets/ac788eb47a519e5f2837cf9504d74f53 +0 -0
  123. data/spec/dummy/tmp/cache/assets/test/sprockets/ac8cf41eb80a554f4f15e80fa6e1ea58 +0 -0
  124. data/spec/dummy/tmp/cache/assets/test/sprockets/b10f86698e41bfdaafc9fb6bbf5bfbd9 +0 -0
  125. data/spec/dummy/tmp/cache/assets/test/sprockets/c08aad292c2ca4aee63f927a45ba90ef +0 -0
  126. data/spec/dummy/tmp/cache/assets/test/sprockets/c9db74506cdab0aec9f855c956f47726 +0 -0
  127. data/spec/dummy/tmp/cache/assets/test/sprockets/d04aeffd159aa29e71a9770dc8630259 +0 -0
  128. data/spec/dummy/tmp/cache/assets/test/sprockets/db5f1ec4fd27d454a95b2824fff064d1 +0 -0
  129. data/spec/dummy/tmp/cache/assets/test/sprockets/df9e45a4bc905f29f8544c37dc9e9a18 +0 -0
  130. data/spec/dummy/tmp/cache/assets/test/sprockets/e5782a71fc01b88e6ac0c1c963bf7e3e +0 -0
  131. data/spec/dummy/tmp/cache/assets/test/sprockets/f516186931f15a3e5c86af1b1632d256 +0 -0
  132. data/spec/dummy/tmp/cache/assets/test/sprockets/faca8abcf70e21e966cebb74604b729f +0 -0
  133. data/spec/dummy/tmp/capybara/capybara-201410171416122395182759.html +13 -0
  134. data/spec/factories/customer_vault_corporations.rb +4 -4
  135. data/spec/factories/{customer_vault_people.rb → customer_vault_individuals.rb} +1 -1
  136. data/spec/factories/customer_vault_links.rb +9 -0
  137. data/spec/helpers/customer_vault/{people_helper_spec.rb → individuals_helper_spec.rb} +3 -3
  138. data/spec/models/customer_vault/corporation_spec.rb +1 -0
  139. data/spec/models/customer_vault/individual_spec.rb +15 -0
  140. data/spec/models/customer_vault/link_spec.rb +13 -0
  141. data/spec/models/customer_vault/person_spec.rb +28 -6
  142. data/spec/routing/customer_vault/corporations_routing_spec.rb +22 -4
  143. data/spec/routing/customer_vault/individual_routing_spec.rb +54 -0
  144. data/spec/routing/customer_vault/people_routing_spec.rb +1 -26
  145. data/spec/spec_helper.rb +1 -0
  146. data/spec/views/customer_vault/individuals/edit.html.slim_spec.rb +47 -0
  147. data/spec/views/customer_vault/individuals/new.html.slim_spec.rb +47 -0
  148. data/spec/views/customer_vault/{people → individuals}/show.html.slim_spec.rb +2 -3
  149. metadata +226 -49
  150. data/app/assets/images/customer_vault/icons/add_person-128.png +0 -0
  151. data/app/assets/images/customer_vault/icons/add_person-20.png +0 -0
  152. data/app/assets/images/customer_vault/icons/add_person-24.png +0 -0
  153. data/app/assets/images/customer_vault/icons/add_person-256.png +0 -0
  154. data/app/assets/images/customer_vault/icons/add_person-32.png +0 -0
  155. data/app/assets/images/customer_vault/icons/add_person-48.png +0 -0
  156. data/app/assets/images/customer_vault/icons/add_person-512.png +0 -0
  157. data/app/assets/images/customer_vault/icons/add_person-64.png +0 -0
  158. data/app/helpers/customer_vault/people_helper.rb +0 -12
  159. data/app/views/customer_vault/corporations/index.html.slim +0 -27
  160. data/app/views/customer_vault/people/edit.html.slim +0 -21
  161. data/app/views/customer_vault/people/new.html.slim +0 -21
  162. data/app/views/customer_vault/people/show.html.slim +0 -57
  163. data/spec/controllers/customer_vault/people_controller_spec.rb +0 -163
  164. data/spec/views/customer_vault/corporations/index.html.slim_spec.rb +0 -29
  165. data/spec/views/customer_vault/people/edit.html.slim_spec.rb +0 -47
  166. data/spec/views/customer_vault/people/index.html.slim_spec.rb +0 -43
  167. data/spec/views/customer_vault/people/new.html.slim_spec.rb +0 -47
  168. /data/app/assets/images/customer_vault/icons/{people-128.png → individual-128.png} +0 -0
  169. /data/app/assets/images/customer_vault/icons/{people-16.png → individual-16.png} +0 -0
  170. /data/app/assets/images/customer_vault/icons/{people-20.png → individual-20.png} +0 -0
  171. /data/app/assets/images/customer_vault/icons/{people-24.png → individual-24.png} +0 -0
  172. /data/app/assets/images/customer_vault/icons/{people-256.png → individual-256.png} +0 -0
  173. /data/app/assets/images/customer_vault/icons/{people-32.png → individual-32.png} +0 -0
  174. /data/app/assets/images/customer_vault/icons/{people-48.png → individual-48.png} +0 -0
  175. /data/app/assets/images/customer_vault/icons/{people-512.png → individual-512.png} +0 -0
  176. /data/app/assets/images/customer_vault/icons/{people-64.png → individual-64.png} +0 -0
  177. /data/app/assets/javascripts/customer_vault/{people.js → individuals.js} +0 -0
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html><html><head>
2
+ <title>Dummy</title>
3
+ <link href="/assets/customer_vault/application.css" media="all" rel="stylesheet">
4
+ <script src="/assets/customer_vault/application.js"></script>
5
+
6
+ </head>
7
+ <body>
8
+
9
+ <div class="container-fluid"><div class="col-lg-12"><ol class="breadcrumb"><li><a href="/">Home</a></li><li><a href="/customer_vault/people">People</a></li><li class="active">MyString&nbsp;MyString</li></ol></div><div class="col-lg-12"><div class="col-lg-4"><aside class="col-lg-12 cadre"><div class="row"><div class="col-lg-12 cdiv"><img alt="Individual 64" src="/assets/customer_vault/icons/individual-64.png"></div><div class="col-lg-12 cdiv"><span class="text-muted titre bold">MyString&nbsp;MyString&nbsp;MyString</span></div></div><div class="row"><div class="col-lg-12 top-buffer"><div class="col-lg-12 cdiv"><div class="bold text-muted cdiv">Email</div><span>MyString </span></div></div><div class="col-lg-12 cdiv"><div class="bold text-muted cdiv">Twitter</div><span>MyString</span></div><div class="col-lg-12 cdiv"><div class="bold text-muted cdiv">Phone</div><span>MyString</span></div><div class="col-lg-12 cdiv"><div class="bold text-muted cdiv">Mobile</div><span>MyString</span></div><div class="col-lg-12 cdiv"><div class="bold text-muted cdiv">Fax</div><span>MyString</span></div><div class="col-lg-12 cdiv"><div class="bold text-muted cdiv">Context</div><span>MyText</span></div><div class="col-lg-12 cdiv"><div class="bold text-muted cdiv">Internet Site</div><a href="http://MyString">http://MyString</a></div><div class="col-lg-12 cdiv"></div></div><div class="row mega-top-buffer bottom-buffer"><div class="col-lg-4 cdiv"><a class="btn btn-success btn-sm" href="/customer_vault/individuals/1/edit">Editer</a></div><div class="col-lg-4 cdiv"><a class="btn btn-danger btn-sm" data-confirm="Are you sure?" data-method="delete" href="/customer_vault/individuals/1" rel="nofollow">Effacer</a></div><div class="col-lg-4 cdiv"><a class="btn btn-primary btn-sm" href="/customer_vault/people">Retour</a></div></div></aside></div><div class="col-lg-8"><div class="col-lg-12"><ul class="nav nav-tabs" role="tablist"><li class="active"><a data-toggle="tab" href="#linkable" role="tab">Links </a></li><li><a data-toggle="tab" href="#history" role="tab">History</a></li><li><a data-toggle="tab" href="#todos" role="tab">Todos</a></li></ul><div class="tab-content"><div class="tab-pane active" id="linkable"><ul class="linkable"><a class="btn btn-success btn-lg" href="/customer_vault/individuals/1/links/new" id="new-link">New link</a></ul></div><div class="tab-pane" id="history"><p>History is soon to come </p></div><div class="tab-pane" id="todos"><p>Todos are soon to come </p></div></div></div></div></div></div>
10
+
11
+
12
+
13
+ </body></html>
@@ -2,9 +2,9 @@
2
2
 
3
3
  FactoryGirl.define do
4
4
  factory :customer_vault_corporation, :class => 'CustomerVault::Corporation' do
5
- name "MyString"
6
- email "MyString"
7
- phone "MyString"
8
- fax "MyString"
5
+ name {"#{Faker::Name.last_name} Corp"}
6
+ email {Faker::Internet.email}
7
+ phone "06xxxxxxxx"
8
+ fax "09xxxxxxx"
9
9
  end
10
10
  end
@@ -1,7 +1,7 @@
1
1
  # Read about factories at https://github.com/thoughtbot/factory_girl
2
2
 
3
3
  FactoryGirl.define do
4
- factory :customer_vault_person, :class => 'CustomerVault::Person' do
4
+ factory :customer_vault_individual, :class => 'CustomerVault::Individual' do
5
5
  first_name "MyString"
6
6
  last_name "MyString"
7
7
  email "MyString"
@@ -0,0 +1,9 @@
1
+ # Read about factories at https://github.com/thoughtbot/factory_girl
2
+
3
+ FactoryGirl.define do
4
+ factory :customer_vault_link, :class => 'CustomerVault::Link' do
5
+ association :alice , factory: :customer_vault_individual
6
+ association :bob , factory: :customer_vault_corporation
7
+ title "Manager"
8
+ end
9
+ end
@@ -1,9 +1,9 @@
1
1
  require 'rails_helper'
2
2
 
3
3
  # Specs in this file have access to a helper object that includes
4
- # the PeopleHelper. For example:
4
+ # the IndividualsHelper. For example:
5
5
  #
6
- # describe PeopleHelper do
6
+ # describe IndividualsHelper do
7
7
  # describe "string concat" do
8
8
  # it "concats two strings with spaces" do
9
9
  # expect(helper.concat_strings("this","that")).to eq("this that")
@@ -11,6 +11,6 @@ require 'rails_helper'
11
11
  # end
12
12
  # end
13
13
  module CustomerVault
14
- RSpec.describe PeopleHelper, :type => :helper do
14
+ RSpec.describe IndividualsHelper, :type => :helper do
15
15
  end
16
16
  end
@@ -3,5 +3,6 @@ require 'rails_helper'
3
3
  module CustomerVault
4
4
  RSpec.describe Corporation, :type => :model do
5
5
  it { should validate_presence_of :name }
6
+ it { should have_one :address }
6
7
  end
7
8
  end
@@ -0,0 +1,15 @@
1
+ require 'rails_helper'
2
+
3
+ module CustomerVault
4
+ RSpec.describe Individual, :type => :model do
5
+ it 'should have a valid factory' do
6
+ individual = FactoryGirl.build(:customer_vault_individual)
7
+ expect(individual).to be_valid
8
+ end
9
+
10
+ it { should validate_presence_of :first_name }
11
+ it { should validate_presence_of :last_name }
12
+ it { should have_one :address }
13
+
14
+ end
15
+ end
@@ -0,0 +1,13 @@
1
+ require 'rails_helper'
2
+
3
+ module CustomerVault
4
+ RSpec.describe Link, :type => :model do
5
+ it 'should have a valid factory' do
6
+ link = FactoryGirl.build(:customer_vault_link)
7
+ expect(link).to be_valid
8
+ end
9
+
10
+ it { should belong_to :alice}
11
+ it { should belong_to :bob}
12
+ end
13
+ end
@@ -2,13 +2,35 @@ require 'rails_helper'
2
2
 
3
3
  module CustomerVault
4
4
  RSpec.describe Person, :type => :model do
5
- it 'should have a valid factory' do
6
- person = FactoryGirl.build(:customer_vault_person)
7
- expect(person).to be_valid
8
- end
5
+ describe '#links' do
6
+ let(:c) {FactoryGirl.create(:customer_vault_corporation)}
7
+ let(:c2) {FactoryGirl.create(:customer_vault_corporation)}
8
+ let(:i) {FactoryGirl.create(:customer_vault_individual)}
9
+ let(:i2) {FactoryGirl.create(:customer_vault_individual)}
10
+
11
+ before :each do
12
+ @l1 = FactoryGirl.create(:customer_vault_link, alice: c, bob: c2, title: 'h')
13
+ @l2 = FactoryGirl.create(:customer_vault_link, alice: i, bob: c, title: 'm')
14
+ @l3 = FactoryGirl.create(:customer_vault_link, alice: i2, bob: i, title: 'p')
15
+ end
16
+
17
+ describe 'corporations' do
18
+ it 'should return all links wether its alice or bob' do
19
+ expect(c.links).to include({title: 'h', person: c2, origin: @l1})
20
+ expect(c.links).to include({title: 'm', person: i, origin: @l2})
9
21
 
10
- it { should validate_presence_of :first_name }
11
- it { should validate_presence_of :last_name }
22
+ expect(c2.links).to eq [{title: 'h', person: c, origin: @l1}]
23
+ end
24
+ end
25
+
26
+ describe 'individuals' do
27
+ it 'should return all links wether its alice or bob' do
28
+ expect(i.links).to include({title: 'm', person: c, origin: @l2})
29
+ expect(i.links).to include({title: 'p', person: i2, origin: @l3})
12
30
 
31
+ expect(i2.links).to eq [{title: 'p', person: i, origin: @l3}]
32
+ end
33
+ end
34
+ end
13
35
  end
14
36
  end
@@ -4,10 +4,6 @@ module CustomerVault
4
4
  RSpec.describe CorporationsController, :type => :routing do
5
5
  routes { CustomerVault::Engine.routes }
6
6
  describe "routing" do
7
- it "routes to #index" do
8
- expect(:get => "/corporations").to route_to("customer_vault/corporations#index")
9
- end
10
-
11
7
  it "routes to #new" do
12
8
  expect(:get => "/corporations/new").to route_to("customer_vault/corporations#new")
13
9
  end
@@ -32,6 +28,28 @@ module CustomerVault
32
28
  expect(:delete => "/corporations/1").to route_to("customer_vault/corporations#destroy", :id => "1")
33
29
  end
34
30
 
31
+ describe 'links' do
32
+ it "routes to links#new" do
33
+ expect(:get => "/corporations/1/links/new").to route_to("customer_vault/links#new", :corporation_id => "1")
34
+ end
35
+
36
+ it "routes to links#edit" do
37
+ expect(:get => "/corporations/1/links/2/edit").to route_to("customer_vault/links#edit", :corporation_id => "1", :id => "2")
38
+ end
39
+
40
+ it "routes to links#create" do
41
+ expect(:post => "/corporations/1/links").to route_to("customer_vault/links#create", :corporation_id => "1")
42
+ end
43
+
44
+ it "routes to links#update" do
45
+ expect(:put => "/corporations/1/links/2").to route_to("customer_vault/links#update", :corporation_id => "1", :id => "2")
46
+ end
47
+
48
+ it "routes to links#destroy" do
49
+ expect(:delete => "/corporations/1/links/2").to route_to("customer_vault/links#destroy", :corporation_id => "1", :id => "2")
50
+ end
51
+ end
52
+
35
53
  end
36
54
  end
37
55
  end
@@ -0,0 +1,54 @@
1
+ require "rails_helper"
2
+
3
+ module CustomerVault
4
+ RSpec.describe IndividualsController, :type => :routing do
5
+ describe "routing" do
6
+ routes { CustomerVault::Engine.routes }
7
+ it "routes to #new" do
8
+ expect(:get => "/individuals/new").to route_to("customer_vault/individuals#new")
9
+ end
10
+
11
+ it "routes to #show" do
12
+ expect(:get => "/individuals/1").to route_to("customer_vault/individuals#show", :id => "1")
13
+ end
14
+
15
+ it "routes to #edit" do
16
+ expect(:get => "/individuals/1/edit").to route_to("customer_vault/individuals#edit", :id => "1")
17
+ end
18
+
19
+ it "routes to #create" do
20
+ expect(:post => "/individuals").to route_to("customer_vault/individuals#create")
21
+ end
22
+
23
+ it "routes to #update" do
24
+ expect(:put => "/individuals/1").to route_to("customer_vault/individuals#update", :id => "1")
25
+ end
26
+
27
+ it "routes to #destroy" do
28
+ expect(:delete => "/individuals/1").to route_to("customer_vault/individuals#destroy", :id => "1")
29
+ end
30
+
31
+ describe 'links' do
32
+ it "routes to links#new" do
33
+ expect(:get => "/individuals/1/links/new").to route_to("customer_vault/links#new", :individual_id => "1")
34
+ end
35
+
36
+ it "routes to links#edit" do
37
+ expect(:get => "/individuals/1/links/2/edit").to route_to("customer_vault/links#edit", :individual_id => "1", :id => "2")
38
+ end
39
+
40
+ it "routes to links#create" do
41
+ expect(:post => "/individuals/1/links").to route_to("customer_vault/links#create", :individual_id => "1")
42
+ end
43
+
44
+ it "routes to links#update" do
45
+ expect(:put => "/individuals/1/links/2").to route_to("customer_vault/links#update", :individual_id => "1", :id => "2")
46
+ end
47
+
48
+ it "routes to links#destroy" do
49
+ expect(:delete => "/individuals/1/links/2").to route_to("customer_vault/links#destroy", :individual_id => "1", :id => "2")
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -7,31 +7,6 @@ module CustomerVault
7
7
  it "routes to #index" do
8
8
  expect(:get => "/people").to route_to("customer_vault/people#index")
9
9
  end
10
-
11
- it "routes to #new" do
12
- expect(:get => "/people/new").to route_to("customer_vault/people#new")
13
- end
14
-
15
- it "routes to #show" do
16
- expect(:get => "/people/1").to route_to("customer_vault/people#show", :id => "1")
17
- end
18
-
19
- it "routes to #edit" do
20
- expect(:get => "/people/1/edit").to route_to("customer_vault/people#edit", :id => "1")
21
- end
22
-
23
- it "routes to #create" do
24
- expect(:post => "/people").to route_to("customer_vault/people#create")
25
- end
26
-
27
- it "routes to #update" do
28
- expect(:put => "/people/1").to route_to("customer_vault/people#update", :id => "1")
29
- end
30
-
31
- it "routes to #destroy" do
32
- expect(:delete => "/people/1").to route_to("customer_vault/people#destroy", :id => "1")
33
- end
34
-
35
10
  end
36
11
  end
37
- end
12
+ end
data/spec/spec_helper.rb CHANGED
@@ -38,6 +38,7 @@ RSpec.configure do |config|
38
38
  # `true` in RSpec 4.
39
39
  mocks.verify_partial_doubles = true
40
40
  end
41
+
41
42
 
42
43
  # The settings below are suggested to provide a good initial experience
43
44
  # with RSpec, but feel free to customize to your heart's content.
@@ -0,0 +1,47 @@
1
+ require 'rails_helper'
2
+
3
+ module CustomerVault
4
+ RSpec.describe "customer_vault/individuals/edit", :type => :view do
5
+ before(:each) do
6
+ @individual = assign(:individual, Individual.create!(
7
+ :first_name => "MyString",
8
+ :last_name => "MyString",
9
+ :email => "MyString",
10
+ :title => "MyString",
11
+ :twitter => "MyString",
12
+ :www => "MyString",
13
+ :context => "MyText",
14
+ :phone => "MyString",
15
+ :fax => "MyString",
16
+ :mobile => "MyString"
17
+ ))
18
+ end
19
+
20
+ it "renders the edit individual form" do
21
+ render
22
+
23
+ assert_select "form[action=?][method=?]", customer_vault.individual_path(@individual), "post" do
24
+
25
+ assert_select "input#individual_first_name[name=?]", "individual[first_name]"
26
+
27
+ assert_select "input#individual_last_name[name=?]", "individual[last_name]"
28
+
29
+ assert_select "input#individual_email[name=?]", "individual[email]"
30
+
31
+ assert_select "input#individual_title[name=?]", "individual[title]"
32
+
33
+ assert_select "input#individual_twitter[name=?]", "individual[twitter]"
34
+
35
+ assert_select "input#individual_www[name=?]", "individual[www]"
36
+
37
+ assert_select "textarea#individual_context[name=?]", "individual[context]"
38
+
39
+ assert_select "input#individual_phone[name=?]", "individual[phone]"
40
+
41
+ assert_select "input#individual_fax[name=?]", "individual[fax]"
42
+
43
+ assert_select "input#individual_mobile[name=?]", "individual[mobile]"
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,47 @@
1
+ require 'rails_helper'
2
+
3
+ module CustomerVault
4
+ RSpec.describe "customer_vault/individuals/new", :type => :view do
5
+ before(:each) do
6
+ assign(:individual, Individual.new(
7
+ :first_name => "MyString",
8
+ :last_name => "MyString",
9
+ :email => "MyString",
10
+ :title => "MyString",
11
+ :twitter => "MyString",
12
+ :www => "MyString",
13
+ :context => "MyText",
14
+ :phone => "MyString",
15
+ :fax => "MyString",
16
+ :mobile => "MyString"
17
+ ))
18
+ end
19
+
20
+ it "renders new individual form" do
21
+ render
22
+
23
+ assert_select "form[action=?][method=?]", customer_vault.individuals_path, "post" do
24
+
25
+ assert_select "input#individual_first_name[name=?]", "individual[first_name]"
26
+
27
+ assert_select "input#individual_last_name[name=?]", "individual[last_name]"
28
+
29
+ assert_select "input#individual_email[name=?]", "individual[email]"
30
+
31
+ assert_select "input#individual_title[name=?]", "individual[title]"
32
+
33
+ assert_select "input#individual_twitter[name=?]", "individual[twitter]"
34
+
35
+ assert_select "input#individual_www[name=?]", "individual[www]"
36
+
37
+ assert_select "textarea#individual_context[name=?]", "individual[context]"
38
+
39
+ assert_select "input#individual_phone[name=?]", "individual[phone]"
40
+
41
+ assert_select "input#individual_fax[name=?]", "individual[fax]"
42
+
43
+ assert_select "input#individual_mobile[name=?]", "individual[mobile]"
44
+ end
45
+ end
46
+ end
47
+ end
@@ -1,9 +1,9 @@
1
1
  require 'rails_helper'
2
2
 
3
3
  module CustomerVault
4
- RSpec.describe "customer_vault/people/show", :type => :view do
4
+ RSpec.describe "customer_vault/individuals/show", :type => :view do
5
5
  before(:each) do
6
- @person = assign(:person, Person.create!(
6
+ @individual = assign(:individual, Individual.create!(
7
7
  :first_name => "First Name",
8
8
  :last_name => "Last Name",
9
9
  :email => "Email",
@@ -22,7 +22,6 @@ module CustomerVault
22
22
  expect(rendered).to match(/First Name/)
23
23
  expect(rendered).to match(/Last Name/)
24
24
  expect(rendered).to match(/Email/)
25
- expect(rendered).to match(/Title/)
26
25
  expect(rendered).to match(/Twitter/)
27
26
  expect(rendered).to match(/Www/)
28
27
  expect(rendered).to match(/MyText/)