magic_addresses 0.0.12 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (225) hide show
  1. checksums.yaml +5 -13
  2. data/README.md +58 -4
  3. data/app/views/magic_addresses/addresses/_address_fields.html.erb +1 -1
  4. data/app/views/magic_addresses/addresses/_addresses_fields.html.erb +1 -1
  5. data/lib/app/models/magic_addresses/address.rb +116 -41
  6. data/lib/app/models/magic_addresses/addressible.rb +21 -0
  7. data/lib/app/models/magic_addresses/association.rb +51 -15
  8. data/lib/app/models/magic_addresses/owner_proxy.rb +14 -0
  9. data/lib/generators/magic_addresses/add_earthdistance_generator.rb +25 -0
  10. data/lib/generators/magic_addresses/templates/earthdistance_migration.rb +32 -0
  11. data/lib/generators/magic_addresses/templates/geocoder_initializer.rb +4 -2
  12. data/lib/generators/magic_addresses/templates/magic_addresses_migration.rb +5 -0
  13. data/lib/generators/magic_addresses/templates/magic_initializer.rb +15 -9
  14. data/lib/generators/magic_addresses/templates/update_address_migration.rb +45 -0
  15. data/lib/generators/magic_addresses/update_generator.rb +25 -0
  16. data/lib/magic_addresses/configuration.rb +18 -6
  17. data/lib/magic_addresses/version.rb +1 -1
  18. data/lib/magic_addresses.rb +6 -0
  19. data/spec/dummy/app/models/company.rb +5 -0
  20. data/spec/dummy/app/views/users/index.html.erb +2 -2
  21. data/spec/dummy/config/environments/test.rb +5 -0
  22. data/spec/dummy/config/initializers/magic_addresses.rb +11 -3
  23. data/spec/dummy/db/development.sqlite3 +0 -0
  24. data/spec/dummy/db/migrate/20151111133333_create_companies.rb +10 -0
  25. data/spec/dummy/db/migrate/20151118102658_update_magic_addresses.rb +45 -0
  26. data/spec/dummy/db/schema.rb +23 -7
  27. data/spec/dummy/db/test.sqlite3 +0 -0
  28. data/spec/dummy/log/development.log +18969 -70324
  29. data/spec/dummy/log/test.log +42010 -94562
  30. data/spec/dummy/tmp/pids/server.pid +1 -0
  31. data/spec/models/company_spec.rb +17 -0
  32. data/spec/models/magic_addresses/address_spec.rb +52 -27
  33. data/spec/models/user_spec.rb +23 -0
  34. data/spec/rails_helper.rb +3 -0
  35. metadata +35 -399
  36. data/spec/dummy/tmp/cache/assets/development/sass/19b60152c4654e1688273867e38ff5e0b6236ab2/_aside_nav.scssc +0 -0
  37. data/spec/dummy/tmp/cache/assets/development/sass/19b60152c4654e1688273867e38ff5e0b6236ab2/_banner.scssc +0 -0
  38. data/spec/dummy/tmp/cache/assets/development/sass/19b60152c4654e1688273867e38ff5e0b6236ab2/_box.scssc +0 -0
  39. data/spec/dummy/tmp/cache/assets/development/sass/19b60152c4654e1688273867e38ff5e0b6236ab2/_buttons.scssc +0 -0
  40. data/spec/dummy/tmp/cache/assets/development/sass/19b60152c4654e1688273867e38ff5e0b6236ab2/_buttons_nice.scssc +0 -0
  41. data/spec/dummy/tmp/cache/assets/development/sass/19b60152c4654e1688273867e38ff5e0b6236ab2/_forms.scssc +0 -0
  42. data/spec/dummy/tmp/cache/assets/development/sass/19b60152c4654e1688273867e38ff5e0b6236ab2/_helper.scssc +0 -0
  43. data/spec/dummy/tmp/cache/assets/development/sass/19b60152c4654e1688273867e38ff5e0b6236ab2/_icons.scssc +0 -0
  44. data/spec/dummy/tmp/cache/assets/development/sass/19b60152c4654e1688273867e38ff5e0b6236ab2/_inputs.scssc +0 -0
  45. data/spec/dummy/tmp/cache/assets/development/sass/19b60152c4654e1688273867e38ff5e0b6236ab2/_labels.scssc +0 -0
  46. data/spec/dummy/tmp/cache/assets/development/sass/19b60152c4654e1688273867e38ff5e0b6236ab2/_navbar.scssc +0 -0
  47. data/spec/dummy/tmp/cache/assets/development/sass/19b60152c4654e1688273867e38ff5e0b6236ab2/_notice.scssc +0 -0
  48. data/spec/dummy/tmp/cache/assets/development/sass/19b60152c4654e1688273867e38ff5e0b6236ab2/_panel.scssc +0 -0
  49. data/spec/dummy/tmp/cache/assets/development/sass/19b60152c4654e1688273867e38ff5e0b6236ab2/_pix.scssc +0 -0
  50. data/spec/dummy/tmp/cache/assets/development/sass/24c51698ad01336e4b987229e799c2cc59a52365/_alerts.scssc +0 -0
  51. data/spec/dummy/tmp/cache/assets/development/sass/24c51698ad01336e4b987229e799c2cc59a52365/_background-variant.scssc +0 -0
  52. data/spec/dummy/tmp/cache/assets/development/sass/24c51698ad01336e4b987229e799c2cc59a52365/_border-radius.scssc +0 -0
  53. data/spec/dummy/tmp/cache/assets/development/sass/24c51698ad01336e4b987229e799c2cc59a52365/_buttons.scssc +0 -0
  54. data/spec/dummy/tmp/cache/assets/development/sass/24c51698ad01336e4b987229e799c2cc59a52365/_center-block.scssc +0 -0
  55. data/spec/dummy/tmp/cache/assets/development/sass/24c51698ad01336e4b987229e799c2cc59a52365/_clearfix.scssc +0 -0
  56. data/spec/dummy/tmp/cache/assets/development/sass/24c51698ad01336e4b987229e799c2cc59a52365/_forms.scssc +0 -0
  57. data/spec/dummy/tmp/cache/assets/development/sass/24c51698ad01336e4b987229e799c2cc59a52365/_gradients.scssc +0 -0
  58. data/spec/dummy/tmp/cache/assets/development/sass/24c51698ad01336e4b987229e799c2cc59a52365/_grid-framework.scssc +0 -0
  59. data/spec/dummy/tmp/cache/assets/development/sass/24c51698ad01336e4b987229e799c2cc59a52365/_grid.scssc +0 -0
  60. data/spec/dummy/tmp/cache/assets/development/sass/24c51698ad01336e4b987229e799c2cc59a52365/_hide-text.scssc +0 -0
  61. data/spec/dummy/tmp/cache/assets/development/sass/24c51698ad01336e4b987229e799c2cc59a52365/_image.scssc +0 -0
  62. data/spec/dummy/tmp/cache/assets/development/sass/24c51698ad01336e4b987229e799c2cc59a52365/_labels.scssc +0 -0
  63. data/spec/dummy/tmp/cache/assets/development/sass/24c51698ad01336e4b987229e799c2cc59a52365/_list-group.scssc +0 -0
  64. data/spec/dummy/tmp/cache/assets/development/sass/24c51698ad01336e4b987229e799c2cc59a52365/_nav-divider.scssc +0 -0
  65. data/spec/dummy/tmp/cache/assets/development/sass/24c51698ad01336e4b987229e799c2cc59a52365/_nav-vertical-align.scssc +0 -0
  66. data/spec/dummy/tmp/cache/assets/development/sass/24c51698ad01336e4b987229e799c2cc59a52365/_opacity.scssc +0 -0
  67. data/spec/dummy/tmp/cache/assets/development/sass/24c51698ad01336e4b987229e799c2cc59a52365/_pagination.scssc +0 -0
  68. data/spec/dummy/tmp/cache/assets/development/sass/24c51698ad01336e4b987229e799c2cc59a52365/_panels.scssc +0 -0
  69. data/spec/dummy/tmp/cache/assets/development/sass/24c51698ad01336e4b987229e799c2cc59a52365/_progress-bar.scssc +0 -0
  70. data/spec/dummy/tmp/cache/assets/development/sass/24c51698ad01336e4b987229e799c2cc59a52365/_reset-filter.scssc +0 -0
  71. data/spec/dummy/tmp/cache/assets/development/sass/24c51698ad01336e4b987229e799c2cc59a52365/_resize.scssc +0 -0
  72. data/spec/dummy/tmp/cache/assets/development/sass/24c51698ad01336e4b987229e799c2cc59a52365/_responsive-visibility.scssc +0 -0
  73. data/spec/dummy/tmp/cache/assets/development/sass/24c51698ad01336e4b987229e799c2cc59a52365/_size.scssc +0 -0
  74. data/spec/dummy/tmp/cache/assets/development/sass/24c51698ad01336e4b987229e799c2cc59a52365/_tab-focus.scssc +0 -0
  75. data/spec/dummy/tmp/cache/assets/development/sass/24c51698ad01336e4b987229e799c2cc59a52365/_table-row.scssc +0 -0
  76. data/spec/dummy/tmp/cache/assets/development/sass/24c51698ad01336e4b987229e799c2cc59a52365/_text-emphasis.scssc +0 -0
  77. data/spec/dummy/tmp/cache/assets/development/sass/24c51698ad01336e4b987229e799c2cc59a52365/_text-overflow.scssc +0 -0
  78. data/spec/dummy/tmp/cache/assets/development/sass/24c51698ad01336e4b987229e799c2cc59a52365/_vendor-prefixes.scssc +0 -0
  79. data/spec/dummy/tmp/cache/assets/development/sass/2557903008e29020a1e41f44af8141d40a1e1147/_corset.scssc +0 -0
  80. data/spec/dummy/tmp/cache/assets/development/sass/2557903008e29020a1e41f44af8141d40a1e1147/_fullpage_table.scssc +0 -0
  81. data/spec/dummy/tmp/cache/assets/development/sass/2557903008e29020a1e41f44af8141d40a1e1147/_section.scssc +0 -0
  82. data/spec/dummy/tmp/cache/assets/development/sass/4a366ea161250132a268ef32a1b08cac8de6b5ae/_asset-pipeline.scssc +0 -0
  83. data/spec/dummy/tmp/cache/assets/development/sass/4a366ea161250132a268ef32a1b08cac8de6b5ae/_prefixer.scssc +0 -0
  84. data/spec/dummy/tmp/cache/assets/development/sass/4a366ea161250132a268ef32a1b08cac8de6b5ae/_px-to-em.scssc +0 -0
  85. data/spec/dummy/tmp/cache/assets/development/sass/51b770beda224b19a22a5fcca280d5fcfa460146/_colors.scssc +0 -0
  86. data/spec/dummy/tmp/cache/assets/development/sass/51b770beda224b19a22a5fcca280d5fcfa460146/_fonts.scssc +0 -0
  87. data/spec/dummy/tmp/cache/assets/development/sass/51b770beda224b19a22a5fcca280d5fcfa460146/_variables.scssc +0 -0
  88. data/spec/dummy/tmp/cache/assets/development/sass/54164dda167544c9a2234eb3643bf0895da180fd/_animation.scssc +0 -0
  89. data/spec/dummy/tmp/cache/assets/development/sass/54164dda167544c9a2234eb3643bf0895da180fd/_appearance.scssc +0 -0
  90. data/spec/dummy/tmp/cache/assets/development/sass/54164dda167544c9a2234eb3643bf0895da180fd/_backface-visibility.scssc +0 -0
  91. data/spec/dummy/tmp/cache/assets/development/sass/54164dda167544c9a2234eb3643bf0895da180fd/_background-image.scssc +0 -0
  92. data/spec/dummy/tmp/cache/assets/development/sass/54164dda167544c9a2234eb3643bf0895da180fd/_background.scssc +0 -0
  93. data/spec/dummy/tmp/cache/assets/development/sass/54164dda167544c9a2234eb3643bf0895da180fd/_border-image.scssc +0 -0
  94. data/spec/dummy/tmp/cache/assets/development/sass/54164dda167544c9a2234eb3643bf0895da180fd/_border-radius.scssc +0 -0
  95. data/spec/dummy/tmp/cache/assets/development/sass/54164dda167544c9a2234eb3643bf0895da180fd/_box-sizing.scssc +0 -0
  96. data/spec/dummy/tmp/cache/assets/development/sass/54164dda167544c9a2234eb3643bf0895da180fd/_calc.scssc +0 -0
  97. data/spec/dummy/tmp/cache/assets/development/sass/54164dda167544c9a2234eb3643bf0895da180fd/_columns.scssc +0 -0
  98. data/spec/dummy/tmp/cache/assets/development/sass/54164dda167544c9a2234eb3643bf0895da180fd/_filter.scssc +0 -0
  99. data/spec/dummy/tmp/cache/assets/development/sass/54164dda167544c9a2234eb3643bf0895da180fd/_flex-box.scssc +0 -0
  100. data/spec/dummy/tmp/cache/assets/development/sass/54164dda167544c9a2234eb3643bf0895da180fd/_font-face.scssc +0 -0
  101. data/spec/dummy/tmp/cache/assets/development/sass/54164dda167544c9a2234eb3643bf0895da180fd/_font-feature-settings.scssc +0 -0
  102. data/spec/dummy/tmp/cache/assets/development/sass/54164dda167544c9a2234eb3643bf0895da180fd/_hidpi-media-query.scssc +0 -0
  103. data/spec/dummy/tmp/cache/assets/development/sass/54164dda167544c9a2234eb3643bf0895da180fd/_hyphens.scssc +0 -0
  104. data/spec/dummy/tmp/cache/assets/development/sass/54164dda167544c9a2234eb3643bf0895da180fd/_image-rendering.scssc +0 -0
  105. data/spec/dummy/tmp/cache/assets/development/sass/54164dda167544c9a2234eb3643bf0895da180fd/_keyframes.scssc +0 -0
  106. data/spec/dummy/tmp/cache/assets/development/sass/54164dda167544c9a2234eb3643bf0895da180fd/_linear-gradient.scssc +0 -0
  107. data/spec/dummy/tmp/cache/assets/development/sass/54164dda167544c9a2234eb3643bf0895da180fd/_perspective.scssc +0 -0
  108. data/spec/dummy/tmp/cache/assets/development/sass/54164dda167544c9a2234eb3643bf0895da180fd/_placeholder.scssc +0 -0
  109. data/spec/dummy/tmp/cache/assets/development/sass/54164dda167544c9a2234eb3643bf0895da180fd/_radial-gradient.scssc +0 -0
  110. data/spec/dummy/tmp/cache/assets/development/sass/54164dda167544c9a2234eb3643bf0895da180fd/_selection.scssc +0 -0
  111. data/spec/dummy/tmp/cache/assets/development/sass/54164dda167544c9a2234eb3643bf0895da180fd/_text-decoration.scssc +0 -0
  112. data/spec/dummy/tmp/cache/assets/development/sass/54164dda167544c9a2234eb3643bf0895da180fd/_transform.scssc +0 -0
  113. data/spec/dummy/tmp/cache/assets/development/sass/54164dda167544c9a2234eb3643bf0895da180fd/_transition.scssc +0 -0
  114. data/spec/dummy/tmp/cache/assets/development/sass/54164dda167544c9a2234eb3643bf0895da180fd/_user-select.scssc +0 -0
  115. data/spec/dummy/tmp/cache/assets/development/sass/5dac14e9bcf503fc8fa7c4f4440118fabc865d43/autocomplete.cssc +0 -0
  116. data/spec/dummy/tmp/cache/assets/development/sass/65afb1d40636d95636e95a91bc4e33776a5f48ba/magic-stylez.scssc +0 -0
  117. data/spec/dummy/tmp/cache/assets/development/sass/67eeb42d1b5d8b7a99a388bcbdece61f954c9cb0/icomoon.scssc +0 -0
  118. data/spec/dummy/tmp/cache/assets/development/sass/67eeb42d1b5d8b7a99a388bcbdece61f954c9cb0/magicons.scssc +0 -0
  119. data/spec/dummy/tmp/cache/assets/development/sass/67eeb42d1b5d8b7a99a388bcbdece61f954c9cb0/orderlifticons.scssc +0 -0
  120. data/spec/dummy/tmp/cache/assets/development/sass/6b16abfb17fe2503733e43257f3ae1774c687e5f/_assign.scssc +0 -0
  121. data/spec/dummy/tmp/cache/assets/development/sass/6b16abfb17fe2503733e43257f3ae1774c687e5f/_color-lightness.scssc +0 -0
  122. data/spec/dummy/tmp/cache/assets/development/sass/6b16abfb17fe2503733e43257f3ae1774c687e5f/_contains.scssc +0 -0
  123. data/spec/dummy/tmp/cache/assets/development/sass/6b16abfb17fe2503733e43257f3ae1774c687e5f/_is-length.scssc +0 -0
  124. data/spec/dummy/tmp/cache/assets/development/sass/6b16abfb17fe2503733e43257f3ae1774c687e5f/_is-size.scssc +0 -0
  125. data/spec/dummy/tmp/cache/assets/development/sass/6b16abfb17fe2503733e43257f3ae1774c687e5f/_modular-scale.scssc +0 -0
  126. data/spec/dummy/tmp/cache/assets/development/sass/6b16abfb17fe2503733e43257f3ae1774c687e5f/_px-to-em.scssc +0 -0
  127. data/spec/dummy/tmp/cache/assets/development/sass/6b16abfb17fe2503733e43257f3ae1774c687e5f/_px-to-rem.scssc +0 -0
  128. data/spec/dummy/tmp/cache/assets/development/sass/6b16abfb17fe2503733e43257f3ae1774c687e5f/_strip-units.scssc +0 -0
  129. data/spec/dummy/tmp/cache/assets/development/sass/6b16abfb17fe2503733e43257f3ae1774c687e5f/_tint-shade.scssc +0 -0
  130. data/spec/dummy/tmp/cache/assets/development/sass/6b16abfb17fe2503733e43257f3ae1774c687e5f/_transition-property-name.scssc +0 -0
  131. data/spec/dummy/tmp/cache/assets/development/sass/6b16abfb17fe2503733e43257f3ae1774c687e5f/_unpack.scssc +0 -0
  132. data/spec/dummy/tmp/cache/assets/development/sass/75433b62dd2cb96bb75c34d9a3e28f92ab357b7f/_convert-units.scssc +0 -0
  133. data/spec/dummy/tmp/cache/assets/development/sass/75433b62dd2cb96bb75c34d9a3e28f92ab357b7f/_font-source-declaration.scssc +0 -0
  134. data/spec/dummy/tmp/cache/assets/development/sass/75433b62dd2cb96bb75c34d9a3e28f92ab357b7f/_gradient-positions-parser.scssc +0 -0
  135. data/spec/dummy/tmp/cache/assets/development/sass/75433b62dd2cb96bb75c34d9a3e28f92ab357b7f/_is-num.scssc +0 -0
  136. data/spec/dummy/tmp/cache/assets/development/sass/75433b62dd2cb96bb75c34d9a3e28f92ab357b7f/_linear-angle-parser.scssc +0 -0
  137. data/spec/dummy/tmp/cache/assets/development/sass/75433b62dd2cb96bb75c34d9a3e28f92ab357b7f/_linear-gradient-parser.scssc +0 -0
  138. data/spec/dummy/tmp/cache/assets/development/sass/75433b62dd2cb96bb75c34d9a3e28f92ab357b7f/_linear-positions-parser.scssc +0 -0
  139. data/spec/dummy/tmp/cache/assets/development/sass/75433b62dd2cb96bb75c34d9a3e28f92ab357b7f/_linear-side-corner-parser.scssc +0 -0
  140. data/spec/dummy/tmp/cache/assets/development/sass/75433b62dd2cb96bb75c34d9a3e28f92ab357b7f/_radial-arg-parser.scssc +0 -0
  141. data/spec/dummy/tmp/cache/assets/development/sass/75433b62dd2cb96bb75c34d9a3e28f92ab357b7f/_radial-gradient-parser.scssc +0 -0
  142. data/spec/dummy/tmp/cache/assets/development/sass/75433b62dd2cb96bb75c34d9a3e28f92ab357b7f/_radial-positions-parser.scssc +0 -0
  143. data/spec/dummy/tmp/cache/assets/development/sass/75433b62dd2cb96bb75c34d9a3e28f92ab357b7f/_render-gradients.scssc +0 -0
  144. data/spec/dummy/tmp/cache/assets/development/sass/75433b62dd2cb96bb75c34d9a3e28f92ab357b7f/_shape-size-stripper.scssc +0 -0
  145. data/spec/dummy/tmp/cache/assets/development/sass/75433b62dd2cb96bb75c34d9a3e28f92ab357b7f/_str-to-num.scssc +0 -0
  146. data/spec/dummy/tmp/cache/assets/development/sass/92cf243fa656f5697aab51e7d90e01c1822b2659/_alerts.scssc +0 -0
  147. data/spec/dummy/tmp/cache/assets/development/sass/92cf243fa656f5697aab51e7d90e01c1822b2659/_badges.scssc +0 -0
  148. data/spec/dummy/tmp/cache/assets/development/sass/92cf243fa656f5697aab51e7d90e01c1822b2659/_breadcrumbs.scssc +0 -0
  149. data/spec/dummy/tmp/cache/assets/development/sass/92cf243fa656f5697aab51e7d90e01c1822b2659/_button-groups.scssc +0 -0
  150. data/spec/dummy/tmp/cache/assets/development/sass/92cf243fa656f5697aab51e7d90e01c1822b2659/_buttons.scssc +0 -0
  151. data/spec/dummy/tmp/cache/assets/development/sass/92cf243fa656f5697aab51e7d90e01c1822b2659/_carousel.scssc +0 -0
  152. data/spec/dummy/tmp/cache/assets/development/sass/92cf243fa656f5697aab51e7d90e01c1822b2659/_close.scssc +0 -0
  153. data/spec/dummy/tmp/cache/assets/development/sass/92cf243fa656f5697aab51e7d90e01c1822b2659/_code.scssc +0 -0
  154. data/spec/dummy/tmp/cache/assets/development/sass/92cf243fa656f5697aab51e7d90e01c1822b2659/_component-animations.scssc +0 -0
  155. data/spec/dummy/tmp/cache/assets/development/sass/92cf243fa656f5697aab51e7d90e01c1822b2659/_dropdowns.scssc +0 -0
  156. data/spec/dummy/tmp/cache/assets/development/sass/92cf243fa656f5697aab51e7d90e01c1822b2659/_forms.scssc +0 -0
  157. data/spec/dummy/tmp/cache/assets/development/sass/92cf243fa656f5697aab51e7d90e01c1822b2659/_glyphicons.scssc +0 -0
  158. data/spec/dummy/tmp/cache/assets/development/sass/92cf243fa656f5697aab51e7d90e01c1822b2659/_grid.scssc +0 -0
  159. data/spec/dummy/tmp/cache/assets/development/sass/92cf243fa656f5697aab51e7d90e01c1822b2659/_input-groups.scssc +0 -0
  160. data/spec/dummy/tmp/cache/assets/development/sass/92cf243fa656f5697aab51e7d90e01c1822b2659/_jumbotron.scssc +0 -0
  161. data/spec/dummy/tmp/cache/assets/development/sass/92cf243fa656f5697aab51e7d90e01c1822b2659/_labels.scssc +0 -0
  162. data/spec/dummy/tmp/cache/assets/development/sass/92cf243fa656f5697aab51e7d90e01c1822b2659/_list-group.scssc +0 -0
  163. data/spec/dummy/tmp/cache/assets/development/sass/92cf243fa656f5697aab51e7d90e01c1822b2659/_media.scssc +0 -0
  164. data/spec/dummy/tmp/cache/assets/development/sass/92cf243fa656f5697aab51e7d90e01c1822b2659/_mixins.scssc +0 -0
  165. data/spec/dummy/tmp/cache/assets/development/sass/92cf243fa656f5697aab51e7d90e01c1822b2659/_modals.scssc +0 -0
  166. data/spec/dummy/tmp/cache/assets/development/sass/92cf243fa656f5697aab51e7d90e01c1822b2659/_navbar.scssc +0 -0
  167. data/spec/dummy/tmp/cache/assets/development/sass/92cf243fa656f5697aab51e7d90e01c1822b2659/_navs.scssc +0 -0
  168. data/spec/dummy/tmp/cache/assets/development/sass/92cf243fa656f5697aab51e7d90e01c1822b2659/_normalize.scssc +0 -0
  169. data/spec/dummy/tmp/cache/assets/development/sass/92cf243fa656f5697aab51e7d90e01c1822b2659/_pager.scssc +0 -0
  170. data/spec/dummy/tmp/cache/assets/development/sass/92cf243fa656f5697aab51e7d90e01c1822b2659/_pagination.scssc +0 -0
  171. data/spec/dummy/tmp/cache/assets/development/sass/92cf243fa656f5697aab51e7d90e01c1822b2659/_panels.scssc +0 -0
  172. data/spec/dummy/tmp/cache/assets/development/sass/92cf243fa656f5697aab51e7d90e01c1822b2659/_popovers.scssc +0 -0
  173. data/spec/dummy/tmp/cache/assets/development/sass/92cf243fa656f5697aab51e7d90e01c1822b2659/_print.scssc +0 -0
  174. data/spec/dummy/tmp/cache/assets/development/sass/92cf243fa656f5697aab51e7d90e01c1822b2659/_progress-bars.scssc +0 -0
  175. data/spec/dummy/tmp/cache/assets/development/sass/92cf243fa656f5697aab51e7d90e01c1822b2659/_responsive-embed.scssc +0 -0
  176. data/spec/dummy/tmp/cache/assets/development/sass/92cf243fa656f5697aab51e7d90e01c1822b2659/_responsive-utilities.scssc +0 -0
  177. data/spec/dummy/tmp/cache/assets/development/sass/92cf243fa656f5697aab51e7d90e01c1822b2659/_scaffolding.scssc +0 -0
  178. data/spec/dummy/tmp/cache/assets/development/sass/92cf243fa656f5697aab51e7d90e01c1822b2659/_tables.scssc +0 -0
  179. data/spec/dummy/tmp/cache/assets/development/sass/92cf243fa656f5697aab51e7d90e01c1822b2659/_thumbnails.scssc +0 -0
  180. data/spec/dummy/tmp/cache/assets/development/sass/92cf243fa656f5697aab51e7d90e01c1822b2659/_tooltip.scssc +0 -0
  181. data/spec/dummy/tmp/cache/assets/development/sass/92cf243fa656f5697aab51e7d90e01c1822b2659/_type.scssc +0 -0
  182. data/spec/dummy/tmp/cache/assets/development/sass/92cf243fa656f5697aab51e7d90e01c1822b2659/_utilities.scssc +0 -0
  183. data/spec/dummy/tmp/cache/assets/development/sass/92cf243fa656f5697aab51e7d90e01c1822b2659/_variables.scssc +0 -0
  184. data/spec/dummy/tmp/cache/assets/development/sass/92cf243fa656f5697aab51e7d90e01c1822b2659/_wells.scssc +0 -0
  185. data/spec/dummy/tmp/cache/assets/development/sass/ba4757a1a53e47b8d77e8b3e570956e2688fcda4/_bourbon-deprecated-upcoming.scssc +0 -0
  186. data/spec/dummy/tmp/cache/assets/development/sass/ba4757a1a53e47b8d77e8b3e570956e2688fcda4/_bourbon.scssc +0 -0
  187. data/spec/dummy/tmp/cache/assets/development/sass/bbf3f90fe22893a2ce61a9eb12fae3a9f2defd14/_animation.scssc +0 -0
  188. data/spec/dummy/tmp/cache/assets/development/sass/bbf3f90fe22893a2ce61a9eb12fae3a9f2defd14/_cross_browser.scssc +0 -0
  189. data/spec/dummy/tmp/cache/assets/development/sass/bbf3f90fe22893a2ce61a9eb12fae3a9f2defd14/_filter.scssc +0 -0
  190. data/spec/dummy/tmp/cache/assets/development/sass/bbf3f90fe22893a2ce61a9eb12fae3a9f2defd14/_forms.scssc +0 -0
  191. data/spec/dummy/tmp/cache/assets/development/sass/bbf3f90fe22893a2ce61a9eb12fae3a9f2defd14/_helper.scssc +0 -0
  192. data/spec/dummy/tmp/cache/assets/development/sass/bbf3f90fe22893a2ce61a9eb12fae3a9f2defd14/_media_querries.scssc +0 -0
  193. data/spec/dummy/tmp/cache/assets/development/sass/bbf3f90fe22893a2ce61a9eb12fae3a9f2defd14/_text.scssc +0 -0
  194. data/spec/dummy/tmp/cache/assets/development/sass/bbf3f90fe22893a2ce61a9eb12fae3a9f2defd14/_twbs.scssc +0 -0
  195. data/spec/dummy/tmp/cache/assets/development/sass/d11e29c08f9a4c5de5e232de8e0405a1753a5793/application.css.scssc +0 -0
  196. data/spec/dummy/tmp/cache/assets/development/sass/d6dffb77922b7d3b25f0a1059d1311e3279ff693/_circle_diagram.scssc +0 -0
  197. data/spec/dummy/tmp/cache/assets/development/sass/de5c39bfb8e330e076983d775f6d2e28dbe78636/_clearfix.scssc +0 -0
  198. data/spec/dummy/tmp/cache/assets/development/sass/de5c39bfb8e330e076983d775f6d2e28dbe78636/_directional-values.scssc +0 -0
  199. data/spec/dummy/tmp/cache/assets/development/sass/de5c39bfb8e330e076983d775f6d2e28dbe78636/_ellipsis.scssc +0 -0
  200. data/spec/dummy/tmp/cache/assets/development/sass/de5c39bfb8e330e076983d775f6d2e28dbe78636/_font-family.scssc +0 -0
  201. data/spec/dummy/tmp/cache/assets/development/sass/de5c39bfb8e330e076983d775f6d2e28dbe78636/_hide-text.scssc +0 -0
  202. data/spec/dummy/tmp/cache/assets/development/sass/de5c39bfb8e330e076983d775f6d2e28dbe78636/_html5-input-types.scssc +0 -0
  203. data/spec/dummy/tmp/cache/assets/development/sass/de5c39bfb8e330e076983d775f6d2e28dbe78636/_position.scssc +0 -0
  204. data/spec/dummy/tmp/cache/assets/development/sass/de5c39bfb8e330e076983d775f6d2e28dbe78636/_prefixer.scssc +0 -0
  205. data/spec/dummy/tmp/cache/assets/development/sass/de5c39bfb8e330e076983d775f6d2e28dbe78636/_retina-image.scssc +0 -0
  206. data/spec/dummy/tmp/cache/assets/development/sass/de5c39bfb8e330e076983d775f6d2e28dbe78636/_size.scssc +0 -0
  207. data/spec/dummy/tmp/cache/assets/development/sass/de5c39bfb8e330e076983d775f6d2e28dbe78636/_timing-functions.scssc +0 -0
  208. data/spec/dummy/tmp/cache/assets/development/sass/de5c39bfb8e330e076983d775f6d2e28dbe78636/_triangle.scssc +0 -392
  209. data/spec/dummy/tmp/cache/assets/development/sass/de5c39bfb8e330e076983d775f6d2e28dbe78636/_word-wrap.scssc +0 -42
  210. data/spec/dummy/tmp/cache/assets/development/sass/e0bbbca13012c1d2a33d6ed35ab7224d7120f071/_all.scssc +0 -0
  211. data/spec/dummy/tmp/cache/assets/development/sass/e0bbbca13012c1d2a33d6ed35ab7224d7120f071/_arrow_hints.scssc +0 -0
  212. data/spec/dummy/tmp/cache/assets/development/sass/e0bbbca13012c1d2a33d6ed35ab7224d7120f071/_crossed.scssc +0 -0
  213. data/spec/dummy/tmp/cache/assets/development/sass/e0bbbca13012c1d2a33d6ed35ab7224d7120f071/_divider.scssc +0 -0
  214. data/spec/dummy/tmp/cache/assets/development/sass/e0bbbca13012c1d2a33d6ed35ab7224d7120f071/_dots.scssc +0 -0
  215. data/spec/dummy/tmp/cache/assets/development/sass/e0bbbca13012c1d2a33d6ed35ab7224d7120f071/_text.scssc +0 -0
  216. data/spec/dummy/tmp/cache/assets/development/sass/e0bbbca13012c1d2a33d6ed35ab7224d7120f071/_three_previews.scssc +0 -0
  217. data/spec/dummy/tmp/cache/assets/development/sass/e68899ee835edcf02d7ab60e48d61fa544850864/_nav.scssc +0 -0
  218. data/spec/dummy/tmp/cache/assets/development/sass/ec54c41325c4a582d617d517b74a3bd29b054c6a/_reflections.scssc +0 -0
  219. data/spec/dummy/tmp/cache/assets/development/sass/ec54c41325c4a582d617d517b74a3bd29b054c6a/_shadows.scssc +0 -0
  220. data/spec/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  221. data/spec/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  222. data/spec/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  223. data/spec/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  224. data/spec/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  225. data/spec/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
@@ -0,0 +1 @@
1
+ 84678
@@ -0,0 +1,17 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe Company, type: :model do
4
+
5
+ describe 'should have default attributes' do
6
+ it { should respond_to :name }
7
+ end
8
+
9
+ describe 'should not have MagicAddresses attributes' do
10
+
11
+ it { should_not respond_to :address }
12
+ it { should respond_to :addresses }
13
+
14
+ end
15
+
16
+
17
+ end
@@ -8,6 +8,8 @@ describe MagicAddresses::Address do
8
8
  # usual
9
9
  it { should respond_to :name }
10
10
 
11
+ it { should respond_to :status }
12
+
11
13
  # location
12
14
  it { should respond_to :latitude }
13
15
  it { should respond_to :longitude }
@@ -18,9 +20,10 @@ describe MagicAddresses::Address do
18
20
  it { should accept_nested_attributes_for :translations }
19
21
 
20
22
  # polymorph owner
21
- it { should respond_to :owner }
22
- it { should respond_to :owner_type }
23
- it { should respond_to :owner_id }
23
+ # => it { should respond_to :owner }
24
+ # => it { should respond_to :owner_type }
25
+ # => it { should respond_to :owner_id }
26
+ it { should respond_to :addressibles }
24
27
 
25
28
  # fetch params
26
29
  it { should respond_to :fetch_address }
@@ -64,8 +67,9 @@ describe MagicAddresses::Address do
64
67
 
65
68
  describe "use fetch address to save street" do
66
69
 
67
- let(:user){ User.create!(name: "Test User") }
68
- let(:address){ MagicAddresses::Address.create!(name: "Test", owner: user) }
70
+ let(:user){ User.new(name: "Test User") }
71
+ # let(:address){ MagicAddresses::Address.create!(name: "Test", owner: user) }
72
+ let(:address){ user.build_address(name: "Test") }
69
73
 
70
74
 
71
75
  it "save attributes first in fetch_address" do
@@ -79,9 +83,10 @@ describe MagicAddresses::Address do
79
83
  expect( address.street ).to eq "Heinz-Kapelle-Street"
80
84
  expect( address.fetch_street ).to eq "Heinz-Kapelle-Street"
81
85
  expect( address.street_name ).to eq "Heinz-Kapelle-Street"
82
- address.save
86
+ # address.save
87
+ user.save
83
88
  expect( address.street ).to eq "Heinz-Kapelle-Street"
84
- expect( address.fetch_street ).to eq( nil )
89
+ #expect( address.fetch_street ).to eq( nil )
85
90
  expect( address.street_name ).to eq "Heinz-Kapelle-Street"
86
91
  I18n.locale = :de
87
92
  address.street = "Heinz-Kapelle-Straße"
@@ -91,7 +96,7 @@ describe MagicAddresses::Address do
91
96
  expect( address.street_name ).to eq "Heinz-Kapelle-Straße"
92
97
  address.save
93
98
  expect( address.street ).to eq "Heinz-Kapelle-Straße"
94
- expect( address.fetch_street ).to eq( nil )
99
+ #expect( address.fetch_street ).to eq( nil )
95
100
  expect( address.street_name ).to eq "Heinz-Kapelle-Straße"
96
101
  I18n.locale = :en
97
102
  expect( address.street_name ).to eq "Heinz-Kapelle-Street"
@@ -103,7 +108,8 @@ describe MagicAddresses::Address do
103
108
 
104
109
  describe "use fetch address to save foreign attributes" do
105
110
  let(:user){ User.create!(name: "Some User") }
106
- let(:address){ MagicAddresses::Address.create!(name: "Another", owner: user) }
111
+ # let(:address){ MagicAddresses::Address.create!(name: "Another", owner: user) }
112
+ let(:address){ user.build_address(name: "Another") }
107
113
 
108
114
  it "save country attributes first in fetch_address" do
109
115
  I18n.locale = :en
@@ -129,32 +135,44 @@ describe MagicAddresses::Address do
129
135
 
130
136
  describe "fetches correct address after save" do
131
137
 
132
- let(:user){ User.create!(name: "Some User") }
133
- let(:address){ MagicAddresses::Address.create!(name: "Another", owner: user) }
138
+ let(:user){ User.create!(name: "Some User", address_attributes: { street: "Heinz-Kapelle-Str.", number: "6", postalcode: 10407, city: "Berlin", country:"Germany"}) }
139
+ # let(:address){ MagicAddresses::Address.create!(name: "Another", owner: user) }
140
+ let(:address){
141
+ user.address
142
+ }
134
143
 
135
144
  it "save country attributes first in fetch_address" do
136
145
  I18n.locale = :en
137
- expect( address.fetch_address ).to eq( {} )
138
- address.street = "Heinz-Kapelle-Str."
139
- address.number = "6"
140
- address.postalcode = 10407
141
- address.city = "Berlin"
142
- address.country = "Germany"
146
+ # expect( address.fetch_address ).to eq( {} )
147
+ # address.street = "Heinz-Kapelle-Str."
148
+ # address.number = "6"
149
+ # address.postalcode = 10407
150
+ # address.city = "Berlin"
151
+ # address.country = "Germany"
152
+ #
153
+ # # there should be no associations if no address yet
154
+ # expect( MagicAddresses::Country.all.count ).to eq( 0 )
155
+ # expect( MagicAddresses::State.all.count ).to eq( 0 )
156
+ # expect( MagicAddresses::City.all.count ).to eq( 0 )
157
+ # expect( MagicAddresses::District.all.count ).to eq( 0 )
158
+ # expect( MagicAddresses::Subdistrict.all.count ).to eq( 0 )
159
+ #
160
+ # # fetch_address should be set
161
+ #expect( address.fetch_address ).to eq( { "fetch_street" => "Heinz-Kapelle-Str.", "fetch_number" => "6", "fetch_zipcode" => 10407, "fetch_city" => "Berlin", "fetch_country" => "Germany" } )
162
+ #expect( user.address.fetch_address ).to eq( { "fetch_street" => "Heinz-Kapelle-Str.", "fetch_number" => "6", "fetch_zipcode" => 10407, "fetch_city" => "Berlin", "fetch_country" => "Germany" } )
163
+ #
164
+ # # address.save
165
+ # user.save
143
166
 
144
- # there should be no associations if no address yet
145
- expect( MagicAddresses::Country.all.count ).to eq( 0 )
146
- expect( MagicAddresses::State.all.count ).to eq( 0 )
147
- expect( MagicAddresses::City.all.count ).to eq( 0 )
148
- expect( MagicAddresses::District.all.count ).to eq( 0 )
149
- expect( MagicAddresses::Subdistrict.all.count ).to eq( 0 )
167
+ puts address.inspect
150
168
 
151
- # fetch_address should be set
152
- expect( address.fetch_address ).to eq( { "fetch_street" => "Heinz-Kapelle-Str.", "fetch_number" => "6", "fetch_zipcode" => 10407, "fetch_city" => "Berlin", "fetch_country" => "Germany" } )
153
169
 
154
- address.save
170
+ # sleep 2
171
+
172
+ user = User.first
155
173
 
156
174
  # fetch_address should be emty again
157
- expect( address.fetch_address ).to eq( {} )
175
+ # expect( address.fetch_address ).to eq( {} )
158
176
 
159
177
  # address should have needed associations now
160
178
  expect( MagicAddresses::Country.all.count ).to eq( 1 )
@@ -188,6 +206,13 @@ describe MagicAddresses::Address do
188
206
  expect( MagicAddresses::Country.first.translations.all.count ).to eq( 2 )
189
207
  expect( MagicAddresses::Country.first.translations.where(name: [nil, ""]).count ).to eq( 0 )
190
208
  # both "Berlin"
209
+
210
+ puts "address: #{ address.translations.map{ |x| "#{x.locale} = #{x.street_name}"}.join(", ") }"
211
+ puts "State: #{ MagicAddresses::State.first.translations.map{ |x| "#{x.locale} = #{x.name}"}.join(", ") }"
212
+ puts "City: #{ MagicAddresses::City.first.translations.map{ |x| "#{x.locale} = #{x.name}"}.join(", ") }"
213
+ puts "District: #{ MagicAddresses::District.first.translations.map{ |x| "#{x.locale} = #{x.name}"}.join(", ") }"
214
+ puts "Subdistrict: #{ MagicAddresses::Subdistrict.first.translations.map{ |x| "#{x.locale} = #{x.name}"}.join(", ") }"
215
+
191
216
  expect( MagicAddresses::State.first.translations.all.count ).to eq( 1 )
192
217
  expect( MagicAddresses::State.first.translations.where(name: [nil, ""]).count ).to eq( 0 )
193
218
  # both "Berlin"
@@ -9,6 +9,29 @@ RSpec.describe User, type: :model do
9
9
  describe 'should not have MagicAddresses attributes' do
10
10
 
11
11
  it { should_not respond_to :addresses }
12
+ it { should respond_to :address }
13
+
14
+ end
15
+
16
+ it "not saves the same address twice" do
17
+
18
+ addr = { street: "Heinz-Kapelle-Str.", number: "6", postalcode: "10407", city: "Berlin"}
19
+ usr1 = { name: "tom", address_attributes: addr }
20
+ usr2 = { name: "tim", address_attributes: addr }
21
+
22
+ u1 = User.create!( usr1 )
23
+ u2 = User.create!( usr2 )
24
+
25
+ expect( User.all.count ).to eq 2
26
+ expect( MagicAddresses::Address.all.count ).to eq 1
27
+
28
+ u1 = User.find_by( name: "tom" )
29
+ u2 = User.find_by( name: "tim" )
30
+
31
+ expect( u1.address.id ).to eq MagicAddresses::Address.first.id
32
+ expect( u2.address.id ).to eq MagicAddresses::Address.first.id
33
+
34
+ expect( u1.address.id ).to eq u2.address.id
12
35
 
13
36
  end
14
37
 
data/spec/rails_helper.rb CHANGED
@@ -29,6 +29,9 @@ RSpec.configure do |config|
29
29
  # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
30
30
  config.fixture_path = "#{::Rails.root}/spec/fixtures"
31
31
 
32
+ config.filter_run focus: true
33
+ config.run_all_when_everything_filtered = true
34
+
32
35
  # If you're not using ActiveRecord, or you'd prefer not to run each of your
33
36
  # examples within a transaction, remove the following line or assign false
34
37
  # instead of true.