effective_addresses 1.8.2 → 1.8.3

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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/app/views/effective/addresses/_form_with.html.haml +1 -1
  3. data/lib/effective_addresses/version.rb +1 -1
  4. metadata +3 -77
  5. data/spec/controllers/addresses_controller_spec.rb +0 -33
  6. data/spec/dummy/README.rdoc +0 -10
  7. data/spec/dummy/Rakefile +0 -6
  8. data/spec/dummy/app/assets/javascripts/application.js +0 -13
  9. data/spec/dummy/app/assets/stylesheets/application.css +0 -15
  10. data/spec/dummy/app/controllers/application_controller.rb +0 -5
  11. data/spec/dummy/app/helpers/application_helper.rb +0 -2
  12. data/spec/dummy/app/models/user.rb +0 -24
  13. data/spec/dummy/app/models/user_with_address.rb +0 -3
  14. data/spec/dummy/app/models/user_with_required_address.rb +0 -3
  15. data/spec/dummy/app/models/user_with_required_address_and_full_name.rb +0 -3
  16. data/spec/dummy/app/models/user_with_required_full_name.rb +0 -3
  17. data/spec/dummy/app/models/user_with_singular_address.rb +0 -3
  18. data/spec/dummy/app/views/layouts/application.html.erb +0 -14
  19. data/spec/dummy/bin/bundle +0 -3
  20. data/spec/dummy/bin/rails +0 -4
  21. data/spec/dummy/bin/rake +0 -4
  22. data/spec/dummy/config.ru +0 -4
  23. data/spec/dummy/config/application.rb +0 -29
  24. data/spec/dummy/config/boot.rb +0 -5
  25. data/spec/dummy/config/database.yml +0 -25
  26. data/spec/dummy/config/environment.rb +0 -5
  27. data/spec/dummy/config/environments/development.rb +0 -37
  28. data/spec/dummy/config/environments/production.rb +0 -83
  29. data/spec/dummy/config/environments/test.rb +0 -39
  30. data/spec/dummy/config/initializers/cookies_serializer.rb +0 -3
  31. data/spec/dummy/config/initializers/effective_addresses.rb +0 -15
  32. data/spec/dummy/config/initializers/session_store.rb +0 -3
  33. data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
  34. data/spec/dummy/config/routes.rb +0 -2
  35. data/spec/dummy/config/secrets.yml +0 -22
  36. data/spec/dummy/db/schema.rb +0 -57
  37. data/spec/models/acts_as_addressable_spec.rb +0 -154
  38. data/spec/models/address_spec.rb +0 -57
  39. data/spec/rails_helper.rb +0 -60
  40. data/spec/spec_helper.rb +0 -97
  41. data/spec/support/factories.rb +0 -60
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1f292affdc8035035a61ee0b6d1e3b15ca0c7adb
4
- data.tar.gz: 09170969f01905b828ac95200cfe51a6ac024101
3
+ metadata.gz: 657cd274dfe063bcd3fb821c88385cccc827fab5
4
+ data.tar.gz: 285737033853c79a7813b22f1f7f1b3c1846282f
5
5
  SHA512:
6
- metadata.gz: edb89284ca5afc1d3600660b332387946861c6e7b5a718f147d991724d0da8cf3696f5c64ce7b423c97f5e00d0f37e22e4cf45e4ee4b474367d3b6390b7ae5e4
7
- data.tar.gz: bd728ca42a5d26acfb0c6808eab6f5567b81c3999fdfb0d93e14305711de44c74840d42a8271e5533a912c3bd7d26893e4dae6df3a227a9fd8046f0d9e332d28
6
+ metadata.gz: 8d8e4ffb57497467499ed14e00198fc9a9dca2bd0e98a8bed2cbef0b75d1786626ab423081f402edda6d24d2ec3384f2d82c2d4ca5015b6e63c9edf58b97f0d1
7
+ data.tar.gz: 2c3baf1a628670734d026be960f264fedfeb840333495ea7e991c37caa7b8926473d67fb56f18409335b213aacf7ce7b287232f407c22f8221e031521c4af248
@@ -22,7 +22,7 @@
22
22
 
23
23
  = fa.text_field :address2,
24
24
  label: false,
25
- required: required,
25
+ required: false,
26
26
  disabled: same_as_billing,
27
27
  wrapper: wrapper_options
28
28
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveAddresses
2
- VERSION = '1.8.2'.freeze
2
+ VERSION = '1.8.3'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_addresses
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.2
4
+ version: 1.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-07 00:00:00.000000000 Z
11
+ date: 2018-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -84,43 +84,6 @@ files:
84
84
  - lib/effective_addresses/engine.rb
85
85
  - lib/effective_addresses/version.rb
86
86
  - lib/generators/effective_addresses/install_generator.rb
87
- - spec/controllers/addresses_controller_spec.rb
88
- - spec/dummy/README.rdoc
89
- - spec/dummy/Rakefile
90
- - spec/dummy/app/assets/javascripts/application.js
91
- - spec/dummy/app/assets/stylesheets/application.css
92
- - spec/dummy/app/controllers/application_controller.rb
93
- - spec/dummy/app/helpers/application_helper.rb
94
- - spec/dummy/app/models/user.rb
95
- - spec/dummy/app/models/user_with_address.rb
96
- - spec/dummy/app/models/user_with_required_address.rb
97
- - spec/dummy/app/models/user_with_required_address_and_full_name.rb
98
- - spec/dummy/app/models/user_with_required_full_name.rb
99
- - spec/dummy/app/models/user_with_singular_address.rb
100
- - spec/dummy/app/views/layouts/application.html.erb
101
- - spec/dummy/bin/bundle
102
- - spec/dummy/bin/rails
103
- - spec/dummy/bin/rake
104
- - spec/dummy/config.ru
105
- - spec/dummy/config/application.rb
106
- - spec/dummy/config/boot.rb
107
- - spec/dummy/config/database.yml
108
- - spec/dummy/config/environment.rb
109
- - spec/dummy/config/environments/development.rb
110
- - spec/dummy/config/environments/production.rb
111
- - spec/dummy/config/environments/test.rb
112
- - spec/dummy/config/initializers/cookies_serializer.rb
113
- - spec/dummy/config/initializers/effective_addresses.rb
114
- - spec/dummy/config/initializers/session_store.rb
115
- - spec/dummy/config/initializers/wrap_parameters.rb
116
- - spec/dummy/config/routes.rb
117
- - spec/dummy/config/secrets.yml
118
- - spec/dummy/db/schema.rb
119
- - spec/models/acts_as_addressable_spec.rb
120
- - spec/models/address_spec.rb
121
- - spec/rails_helper.rb
122
- - spec/spec_helper.rb
123
- - spec/support/factories.rb
124
87
  homepage: https://github.com/code-and-effect/effective_addresses
125
88
  licenses:
126
89
  - MIT
@@ -146,41 +109,4 @@ signing_key:
146
109
  specification_version: 4
147
110
  summary: Extend any ActiveRecord object to have one or more named addresses. Includes
148
111
  a geographic region-aware custom form input backed by Carmen.
149
- test_files:
150
- - spec/controllers/addresses_controller_spec.rb
151
- - spec/dummy/app/assets/javascripts/application.js
152
- - spec/dummy/app/assets/stylesheets/application.css
153
- - spec/dummy/app/controllers/application_controller.rb
154
- - spec/dummy/app/helpers/application_helper.rb
155
- - spec/dummy/app/models/user.rb
156
- - spec/dummy/app/models/user_with_address.rb
157
- - spec/dummy/app/models/user_with_required_address.rb
158
- - spec/dummy/app/models/user_with_required_address_and_full_name.rb
159
- - spec/dummy/app/models/user_with_required_full_name.rb
160
- - spec/dummy/app/models/user_with_singular_address.rb
161
- - spec/dummy/app/views/layouts/application.html.erb
162
- - spec/dummy/bin/bundle
163
- - spec/dummy/bin/rails
164
- - spec/dummy/bin/rake
165
- - spec/dummy/config/application.rb
166
- - spec/dummy/config/boot.rb
167
- - spec/dummy/config/database.yml
168
- - spec/dummy/config/environment.rb
169
- - spec/dummy/config/environments/development.rb
170
- - spec/dummy/config/environments/production.rb
171
- - spec/dummy/config/environments/test.rb
172
- - spec/dummy/config/initializers/cookies_serializer.rb
173
- - spec/dummy/config/initializers/effective_addresses.rb
174
- - spec/dummy/config/initializers/session_store.rb
175
- - spec/dummy/config/initializers/wrap_parameters.rb
176
- - spec/dummy/config/routes.rb
177
- - spec/dummy/config/secrets.yml
178
- - spec/dummy/config.ru
179
- - spec/dummy/db/schema.rb
180
- - spec/dummy/Rakefile
181
- - spec/dummy/README.rdoc
182
- - spec/models/acts_as_addressable_spec.rb
183
- - spec/models/address_spec.rb
184
- - spec/rails_helper.rb
185
- - spec/spec_helper.rb
186
- - spec/support/factories.rb
112
+ test_files: []
@@ -1,33 +0,0 @@
1
- require 'rails_helper'
2
-
3
- describe Effective::AddressesController do
4
- routes { EffectiveAddresses::Engine.routes }
5
-
6
- it 'should render the subregions partial' do
7
- get :subregions, :country_code => 'CA'
8
- response.status.should be 200
9
- response.should render_template 'effective/addresses/_subregions'
10
- end
11
-
12
- it 'should assign appropriate Canadian subregions' do
13
- get :subregions, :country_code => 'CA'
14
- assigns(:subregions).first.name.should eq 'Alberta'
15
- end
16
-
17
- it 'should assign appropriate US subregions' do
18
- get :subregions, :country_code => 'US'
19
- assigns(:subregions).first.name.should eq 'Alaska'
20
- end
21
-
22
- it 'should assign appropriate SG subregions' do
23
- get :subregions, :country_code => 'SG' # Singapore
24
- assigns(:subregions).first.name.should eq 'Central Singapore'
25
- end
26
-
27
- it 'Should return an error when passed bad country code' do
28
- get :subregions, :country_code => 'NOPE'
29
- response.status.should be 200
30
- response.body.should eq "<option value=''>None Available</option>"
31
- end
32
-
33
- end
@@ -1,10 +0,0 @@
1
- == README
2
-
3
- To change the test database in this dummy app:
4
-
5
- - Delete the existing test.sqlite3
6
- - No migrations, so just make whatever changes you want to schema.rb
7
-
8
- bundle exec rake app:db:test:prepare
9
-
10
- RAILS_ENV=test rake db:schema:load; rake
data/spec/dummy/Rakefile DELETED
@@ -1,6 +0,0 @@
1
- # Add your own tasks in files placed in lib/tasks ending in .rake,
2
- # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
-
4
- require File.expand_path('../config/application', __FILE__)
5
-
6
- Rails.application.load_tasks
@@ -1,13 +0,0 @@
1
- // This is a manifest file that'll be compiled into application.js, which will include all the files
2
- // listed below.
3
- //
4
- // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
- // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
- //
7
- // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
- // compiled file.
9
- //
10
- // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11
- // about supported directives.
12
- //
13
- //= require_tree .
@@ -1,15 +0,0 @@
1
- /*
2
- * This is a manifest file that'll be compiled into application.css, which will include all the files
3
- * listed below.
4
- *
5
- * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
- * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
- *
8
- * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
- * compiled file so the styles you add here take precedence over styles defined in any styles
10
- * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
- * file per style scope.
12
- *
13
- *= require_tree .
14
- *= require_self
15
- */
@@ -1,5 +0,0 @@
1
- class ApplicationController < ActionController::Base
2
- # Prevent CSRF attacks by raising an exception.
3
- # For APIs, you may want to use :null_session instead.
4
- protect_from_forgery with: :exception
5
- end
@@ -1,2 +0,0 @@
1
- module ApplicationHelper
2
- end
@@ -1,24 +0,0 @@
1
- class User < ActiveRecord::Base
2
- # structure do
3
- # # Devise attributes
4
- # encrypted_password :string
5
- # reset_password_token :string
6
- # reset_password_sent_at :datetime
7
- # remember_created_at :datetime
8
- # confirmation_sent_at :datetime
9
- # confirmed_at :datetime
10
- # confirmation_token :string
11
- # unconfirmed_email :string
12
- # sign_in_count :integer, :default => 0
13
- # current_sign_in_at :datetime
14
- # last_sign_in_at :datetime
15
- # current_sign_in_ip :string
16
- # last_sign_in_ip :string
17
- #
18
- # email :string
19
- # first_name :string
20
- # last_name :string
21
- #
22
- # timestamps
23
- # end
24
- end
@@ -1,3 +0,0 @@
1
- class UserWithAddress < User
2
- acts_as_addressable :billing, :shipping
3
- end
@@ -1,3 +0,0 @@
1
- class UserWithRequiredAddress < User
2
- acts_as_addressable :billing => {:presence => true, :use_full_name => false}, :shipping => false
3
- end
@@ -1,3 +0,0 @@
1
- class UserWithRequiredAddressAndFullName < User
2
- acts_as_addressable :billing => {:presence => true, :use_full_name => true}, :shipping => false
3
- end
@@ -1,3 +0,0 @@
1
- class UserWithRequiredFullName < User
2
- acts_as_addressable :billing => {:presence => false, :use_full_name => true}, :shipping => false
3
- end
@@ -1,3 +0,0 @@
1
- class UserWithSingularAddress < User
2
- acts_as_addressable :billing => {:singular => true}, :shipping => false
3
- end
@@ -1,14 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>Dummy</title>
5
- <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
6
- <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
7
- <%= csrf_meta_tags %>
8
- </head>
9
- <body>
10
-
11
- <%= yield %>
12
-
13
- </body>
14
- </html>
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../Gemfile', __FILE__)
3
- load Gem.bin_path('bundler', 'bundle')
data/spec/dummy/bin/rails DELETED
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_PATH = File.expand_path('../../config/application', __FILE__)
3
- require_relative '../config/boot'
4
- require 'rails/commands'
data/spec/dummy/bin/rake DELETED
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require_relative '../config/boot'
3
- require 'rake'
4
- Rake.application.run
data/spec/dummy/config.ru DELETED
@@ -1,4 +0,0 @@
1
- # This file is used by Rack-based servers to start the application.
2
-
3
- require ::File.expand_path('../config/environment', __FILE__)
4
- run Rails.application
@@ -1,29 +0,0 @@
1
- require File.expand_path('../boot', __FILE__)
2
-
3
- require 'rails/all'
4
-
5
- Bundler.require(*Rails.groups)
6
- require 'haml'
7
- require 'effective_addresses'
8
-
9
- module Dummy
10
- class Application < Rails::Application
11
- # Settings in config/environments/* take precedence over those specified here.
12
- # Application configuration should go into files in config/initializers
13
- # -- all .rb files in that directory are automatically loaded.
14
-
15
- # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
16
- # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
17
- # config.time_zone = 'Central Time (US & Canada)'
18
-
19
- # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
20
- # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
21
- # config.i18n.default_locale = :de
22
-
23
- config.generators do |g|
24
- g.template_engine :haml
25
- end
26
-
27
- end
28
- end
29
-
@@ -1,5 +0,0 @@
1
- # Set up gems listed in the Gemfile.
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
3
-
4
- require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5
- $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
@@ -1,25 +0,0 @@
1
- # SQLite version 3.x
2
- # gem install sqlite3
3
- #
4
- # Ensure the SQLite 3 gem is defined in your Gemfile
5
- # gem 'sqlite3'
6
- #
7
- default: &default
8
- adapter: sqlite3
9
- pool: 5
10
- timeout: 5000
11
-
12
- development:
13
- <<: *default
14
- database: db/development.sqlite3
15
-
16
- # Warning: The database defined as "test" will be erased and
17
- # re-generated from your development database when you run "rake".
18
- # Do not set this db to the same as development or production.
19
- test:
20
- <<: *default
21
- database: db/test.sqlite3
22
-
23
- production:
24
- <<: *default
25
- database: db/production.sqlite3
@@ -1,5 +0,0 @@
1
- # Load the Rails application.
2
- require File.expand_path('../application', __FILE__)
3
-
4
- # Initialize the Rails application.
5
- Rails.application.initialize!
@@ -1,37 +0,0 @@
1
- Rails.application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb.
3
-
4
- # In the development environment your application's code is reloaded on
5
- # every request. This slows down response time but is perfect for development
6
- # since you don't have to restart the web server when you make code changes.
7
- config.cache_classes = false
8
-
9
- # Do not eager load code on boot.
10
- config.eager_load = false
11
-
12
- # Show full error reports and disable caching.
13
- config.consider_all_requests_local = true
14
- config.action_controller.perform_caching = false
15
-
16
- # Don't care if the mailer can't send.
17
- config.action_mailer.raise_delivery_errors = false
18
-
19
- # Print deprecation notices to the Rails logger.
20
- config.active_support.deprecation = :log
21
-
22
- # Raise an error on page load if there are pending migrations.
23
- config.active_record.migration_error = :page_load
24
-
25
- # Debug mode disables concatenation and preprocessing of assets.
26
- # This option may cause significant delays in view rendering with a large
27
- # number of complex assets.
28
- config.assets.debug = true
29
-
30
- # Adds additional error checking when serving assets at runtime.
31
- # Checks for improperly declared sprockets dependencies.
32
- # Raises helpful error messages.
33
- config.assets.raise_runtime_errors = true
34
-
35
- # Raises error for missing translations
36
- # config.action_view.raise_on_missing_translations = true
37
- end
@@ -1,83 +0,0 @@
1
- Rails.application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb.
3
-
4
- # Code is not reloaded between requests.
5
- config.cache_classes = true
6
-
7
- # Eager load code on boot. This eager loads most of Rails and
8
- # your application in memory, allowing both threaded web servers
9
- # and those relying on copy on write to perform better.
10
- # Rake tasks automatically ignore this option for performance.
11
- config.eager_load = true
12
-
13
- # Full error reports are disabled and caching is turned on.
14
- config.consider_all_requests_local = false
15
- config.action_controller.perform_caching = true
16
-
17
- # Enable Rack::Cache to put a simple HTTP cache in front of your application
18
- # Add `rack-cache` to your Gemfile before enabling this.
19
- # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
20
- # config.action_dispatch.rack_cache = true
21
-
22
- # Disable Rails's static asset server (Apache or nginx will already do this).
23
- config.serve_static_files = false
24
-
25
- # Compress JavaScripts and CSS.
26
- config.assets.js_compressor = :uglifier
27
- # config.assets.css_compressor = :sass
28
-
29
- # Do not fallback to assets pipeline if a precompiled asset is missed.
30
- config.assets.compile = false
31
-
32
- # Generate digests for assets URLs.
33
- config.assets.digest = true
34
-
35
- # Version of your assets, change this if you want to expire all your assets.
36
- config.assets.version = '1.0'
37
-
38
- # Specifies the header that your server uses for sending files.
39
- # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
40
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
41
-
42
- # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
43
- # config.force_ssl = true
44
-
45
- # Set to :debug to see everything in the log.
46
- config.log_level = :info
47
-
48
- # Prepend all log lines with the following tags.
49
- # config.log_tags = [ :subdomain, :uuid ]
50
-
51
- # Use a different logger for distributed setups.
52
- # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
53
-
54
- # Use a different cache store in production.
55
- # config.cache_store = :mem_cache_store
56
-
57
- # Enable serving of images, stylesheets, and JavaScripts from an asset server.
58
- # config.action_controller.asset_host = "http://assets.example.com"
59
-
60
- # Precompile additional assets.
61
- # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
62
- # config.assets.precompile += %w( search.js )
63
-
64
- # Ignore bad email addresses and do not raise email delivery errors.
65
- # Set this to true and configure the email server for immediate delivery to raise delivery errors.
66
- # config.action_mailer.raise_delivery_errors = false
67
-
68
- # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
69
- # the I18n.default_locale when a translation cannot be found).
70
- config.i18n.fallbacks = true
71
-
72
- # Send deprecation notices to registered listeners.
73
- config.active_support.deprecation = :notify
74
-
75
- # Disable automatic flushing of the log to improve performance.
76
- # config.autoflush_log = false
77
-
78
- # Use default logging formatter so that PID and timestamp are not suppressed.
79
- config.log_formatter = ::Logger::Formatter.new
80
-
81
- # Do not dump schema after migrations.
82
- config.active_record.dump_schema_after_migration = false
83
- end
@@ -1,39 +0,0 @@
1
- Rails.application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb.
3
-
4
- # The test environment is used exclusively to run your application's
5
- # test suite. You never need to work with it otherwise. Remember that
6
- # your test database is "scratch space" for the test suite and is wiped
7
- # and recreated between test runs. Don't rely on the data there!
8
- config.cache_classes = true
9
-
10
- # Do not eager load code on boot. This avoids loading your whole application
11
- # just for the purpose of running a single test. If you are using a tool that
12
- # preloads Rails for running tests, you may have to set it to true.
13
- config.eager_load = false
14
-
15
- # Configure static asset server for tests with Cache-Control for performance.
16
- config.serve_static_files = true
17
- config.static_cache_control = 'public, max-age=3600'
18
-
19
- # Show full error reports and disable caching.
20
- config.consider_all_requests_local = true
21
- config.action_controller.perform_caching = false
22
-
23
- # Raise exceptions instead of rendering exception templates.
24
- config.action_dispatch.show_exceptions = false
25
-
26
- # Disable request forgery protection in test environment.
27
- config.action_controller.allow_forgery_protection = false
28
-
29
- # Tell Action Mailer not to deliver emails to the real world.
30
- # The :test delivery method accumulates sent emails in the
31
- # ActionMailer::Base.deliveries array.
32
- config.action_mailer.delivery_method = :test
33
-
34
- # Print deprecation notices to the stderr.
35
- config.active_support.deprecation = :stderr
36
-
37
- # Raises error for missing translations
38
- # config.action_view.raise_on_missing_translations = true
39
- end
@@ -1,3 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- Rails.application.config.action_dispatch.cookies_serializer = :json
@@ -1,15 +0,0 @@
1
- EffectiveAddresses.setup do |config|
2
- # Database table name to store addresses in. Default is :addresses
3
- config.addresses_table_name = :addresses
4
-
5
- # Display Full Name on Address forms, and validate presence by default
6
- # (can be overridden on a per address basis)
7
- config.use_full_name = false
8
-
9
- # Country codes to display in country_select dropdowns.
10
- config.country_codes = :all #
11
- config.country_codes_priority = ['US', 'CA'] # nil for no priority countries
12
-
13
- # Or you can be more selective...
14
- #config.country_codes = ['US', 'CA']
15
- end
@@ -1,3 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- Rails.application.config.session_store :cookie_store, key: '_dummy_session'
@@ -1,14 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # This file contains settings for ActionController::ParamsWrapper which
4
- # is enabled by default.
5
-
6
- # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
- ActiveSupport.on_load(:action_controller) do
8
- wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
9
- end
10
-
11
- # To enable root element in JSON for ActiveRecord objects.
12
- # ActiveSupport.on_load(:active_record) do
13
- # self.include_root_in_json = true
14
- # end
@@ -1,2 +0,0 @@
1
- Rails.application.routes.draw do
2
- end
@@ -1,22 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Your secret key is used for verifying the integrity of signed cookies.
4
- # If you change this key, all old signed cookies will become invalid!
5
-
6
- # Make sure the secret is at least 30 characters and all random,
7
- # no regular words or you'll be exposed to dictionary attacks.
8
- # You can use `rake secret` to generate a secure secret key.
9
-
10
- # Make sure the secrets in this file are kept private
11
- # if you're sharing your code publicly.
12
-
13
- development:
14
- secret_key_base: 19ae140d6bd4164a8b1f37a052b1bf6ca83798d42339f0f7ae3d7303b3d0f6a3007327150783292086599a2dd43c56f75e805c3235a8763df32eeac6a59045d8
15
-
16
- test:
17
- secret_key_base: 72dcfceca73511a73eb4011013eb18f9af41567c1b924314eb4142b44c770dc6713196cfa8071d206b5066f57975dbe57df873389c033a9834fa42ae37083054
18
-
19
- # Do not keep production secrets in the repository,
20
- # instead read values from the environment.
21
- production:
22
- secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
@@ -1,57 +0,0 @@
1
- # encoding: UTF-8
2
- # This file is auto-generated from the current state of the database. Instead
3
- # of editing this file, please use the migrations feature of Active Record to
4
- # incrementally modify your database, and then regenerate this schema definition.
5
- #
6
- # Note that this schema.rb definition is the authoritative source for your
7
- # database schema. If you need to create the application database on another
8
- # system, you should be using db:schema:load, not running all the migrations
9
- # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
- # you'll amass, the slower it'll run and the greater likelihood for issues).
11
- #
12
- # It's strongly recommended to check this file into your version control system.
13
-
14
- ActiveRecord::Schema.define(:version => 4) do
15
-
16
- create_table "addresses", :force => true do |t|
17
- t.string "addressable_type"
18
- t.integer "addressable_id"
19
- t.string "category", :limit => 64
20
- t.string "full_name"
21
- t.string "address1"
22
- t.string "address2"
23
- t.string "city"
24
- t.string "state_code"
25
- t.string "country_code"
26
- t.string "postal_code"
27
- t.datetime "updated_at"
28
- t.datetime "created_at"
29
- end
30
-
31
- add_index "addresses", ["addressable_id"], :name => "index_addresses_on_addressable_id"
32
- add_index "addresses", ["addressable_type", "addressable_id"], :name => "index_addresses_on_addressable_type_and_addressable_id"
33
-
34
- create_table "users", force: true do |t|
35
- t.string "encrypted_password"
36
- t.string "reset_password_token"
37
- t.datetime "reset_password_sent_at"
38
- t.datetime "remember_created_at"
39
- t.datetime "confirmation_sent_at"
40
- t.datetime "confirmed_at"
41
- t.string "confirmation_token"
42
- t.string "unconfirmed_email"
43
- t.integer "sign_in_count", default: 0
44
- t.datetime "current_sign_in_at"
45
- t.datetime "last_sign_in_at"
46
- t.string "current_sign_in_ip"
47
- t.string "last_sign_in_ip"
48
- t.string "email"
49
- t.string "first_name"
50
- t.string "last_name"
51
- t.integer "roles_mask", default: 0
52
- t.boolean "archived", default: false
53
- t.datetime "updated_at"
54
- t.datetime "created_at"
55
- end
56
-
57
- end
@@ -1,154 +0,0 @@
1
- require 'rails_helper'
2
-
3
- describe User do
4
-
5
- describe 'Validations' do
6
- let(:address) { FactoryGirl.create(:address) }
7
- let(:address_with_full_name) { FactoryGirl.create(:address_with_full_name) }
8
-
9
- describe 'no requirements' do
10
- let(:user) { FactoryGirl.build(:user_with_address) }
11
-
12
- it 'is valid without an address' do
13
- user.valid?.should eq true
14
- end
15
- end
16
-
17
- describe 'required address' do
18
- let(:user) { FactoryGirl.build(:user_with_required_address) }
19
-
20
- it 'is invalid without an address' do
21
- user.valid?.should eq false
22
- user.errors[:billing_address].present?.should eq true
23
-
24
- # Now lets make it valid
25
- user.billing_address = address
26
-
27
- user.valid?.should eq true
28
- user.errors[:billing_address].present?.should eq false
29
- end
30
- end
31
-
32
- describe 'no required address, required full_name' do
33
- let(:user) { FactoryGirl.build(:user_with_required_full_name) }
34
-
35
- it 'is valid without an address' do
36
- user.valid?.should eq true
37
- end
38
-
39
- it 'is invalid when an address without full name is present' do
40
- user.billing_address = address
41
- user.valid?.should eq false
42
- user.errors[:billing_address].present?.should eq true
43
-
44
- # Now lets make it valid
45
- user.billing_address = address_with_full_name
46
- user.valid?.should eq true
47
- user.errors[:billing_address].present?.should eq false
48
- end
49
- end
50
-
51
- describe 'required address, required full_name' do
52
- let(:user) { FactoryGirl.build(:user_with_required_address_and_full_name) }
53
-
54
- it 'is invalid without an address' do
55
- user.valid?.should eq false
56
- end
57
-
58
- it 'is invalid when an address without full name is present' do
59
- user.billing_address = address
60
- user.valid?.should eq false
61
- user.errors[:billing_address].present?.should eq true
62
-
63
- # Now lets make it valid
64
- user.billing_address = address_with_full_name
65
- user.valid?.should eq true
66
- user.errors[:billing_address].present?.should eq false
67
- end
68
- end
69
- end
70
-
71
- describe 'Many Addresses' do
72
- let(:user) { FactoryGirl.build(:user_with_address) }
73
- let(:address) { FactoryGirl.build(:address) }
74
- let(:address2) { FactoryGirl.build(:address) }
75
-
76
- it 'saves an address when parent record is saved' do
77
- user.billing_address = address
78
- user.save!
79
-
80
- Effective::Address.all.count.should eq 1
81
- user.addresses.length.should eq 1
82
- end
83
-
84
- it 'saves an additional address when parent record is saved with new address' do
85
- user.billing_address = address
86
- user.save!
87
-
88
- user.billing_address = address2
89
- user.save!
90
-
91
- Effective::Address.all.count.should eq 2
92
- user.addresses.length.should eq 2
93
-
94
- user.billing_address.should eq address2
95
- user.reload
96
- user.billing_address.should eq address2
97
- end
98
-
99
- it 'doesnt save an additional address when saved with a duplicate address' do
100
- user.billing_address = address
101
- user.save!
102
-
103
- address2.address1 = address.address1 # New object, same attributes
104
-
105
- user.billing_address = address2
106
- user.save!
107
-
108
- Effective::Address.all.count.should eq 1
109
- user.addresses.length.should eq 1
110
-
111
- user.billing_address.should eq address
112
- user.billing_address.should eq address2
113
- end
114
-
115
- end
116
-
117
- describe 'Singular Addresses' do
118
- let(:user) { FactoryGirl.build(:user_with_singular_address) }
119
- let(:address) { FactoryGirl.build(:address) }
120
- let(:address2) { FactoryGirl.build(:address) }
121
-
122
- it 'saves an address when parent record is saved' do
123
- user.billing_address = address
124
- user.save!
125
-
126
- Effective::Address.all.count.should eq 1
127
- user.addresses.length.should eq 1
128
- end
129
-
130
- it 'does not save an additional address when parent record is saved with new address' do
131
- user.billing_address = address
132
- user.save!
133
-
134
- address_id = user.billing_address.id
135
- address_id.present?.should eq true
136
-
137
- # Now let's assign another address with different atts
138
- user.billing_address = address2
139
- user.save!.should eq true
140
-
141
- Effective::Address.all.count.should eq 1
142
- user.addresses.length.should eq 1
143
-
144
- user.reload
145
-
146
- user.billing_address.id.should eq address_id
147
- user.billing_address.address1.should eq address2.address1
148
- user.billing_address.address1.should_not eq address.address1
149
- end
150
-
151
- end
152
-
153
-
154
- end
@@ -1,57 +0,0 @@
1
- require 'rails_helper'
2
-
3
- describe Effective::Address do
4
- let(:address) { FactoryGirl.create(:address) }
5
-
6
- it "should be valid" do
7
- address.valid?.should == true
8
- end
9
-
10
- it "should be able to clone" do
11
- address2 = address.dup
12
- address2.save
13
-
14
- address.full_name.should == address2.full_name
15
- address.address1.should == address2.address1
16
- address.address2.should == address2.address2
17
- address.city.should == address2.city
18
- address.state.should == address2.state
19
- address.country.should == address2.country
20
- address.postal_code.should == address2.postal_code
21
- address.category.should == address2.category
22
-
23
- address.id.should_not == address2.id
24
- address.created_at.should_not == address2.created_at
25
- address.updated_at.should_not == address2.updated_at
26
- end
27
-
28
- it "should compare details and == to another address" do
29
- address2 = address.dup
30
- address.should == address2
31
- end
32
-
33
- it 'should return the country name when given the country code' do
34
- address.country_code = 'CA'
35
- address.country.should eq 'Canada'
36
-
37
- address.country_code = 'US'
38
- address.country.should eq 'United States'
39
- end
40
-
41
- it 'should return the appropriate province when country code is set' do
42
- address.country_code = 'CA'
43
- address.state_code = 'AB'
44
- address.state.should eq 'Alberta'
45
-
46
- address.country_code = 'US'
47
- address.state_code = 'NY'
48
- address.state.should eq 'New York'
49
- end
50
-
51
- describe '#to_s' do
52
- it 'works without a postal code' do
53
- address.postal_code = nil
54
- expect(address.to_s).to be_a(String)
55
- end
56
- end
57
- end
data/spec/rails_helper.rb DELETED
@@ -1,60 +0,0 @@
1
- # This file is copied to spec/ when you run 'rails generate rspec:install'
2
- ENV['RAILS_ENV'] ||= 'test'
3
- require 'spec_helper'
4
- require File.expand_path("../dummy/config/environment", __FILE__)
5
-
6
- require 'rspec/rails'
7
- require 'carmen-rails'
8
- require 'factory_girl_rails'
9
-
10
- # Add additional requires below this line. Rails is not loaded until this point!
11
-
12
- # Requires supporting ruby files with custom matchers and macros, etc, in
13
- # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
14
- # run as spec files by default. This means that files in spec/support that end
15
- # in _spec.rb will both be required and run as specs, causing the specs to be
16
- # run twice. It is recommended that you do not name files matching this glob to
17
- # end with _spec.rb. You can configure this pattern with the --pattern
18
- # option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
19
- #
20
- # The following line is provided for convenience purposes. It has the downside
21
- # of increasing the boot-up time by auto-requiring all files in the support
22
- # directory. Alternatively, in the individual `*_spec.rb` files, manually
23
- # require only the support files necessary.
24
- #
25
-
26
- Dir[Rails.root.join("../../spec/support/**/*.rb")].each {|f| require f }
27
-
28
- Carmen.i18n_backend.load_path << (Carmen.root_path.to_s + '/locale/base/en/world.yml')
29
- Carmen.i18n_backend.load_path << (Carmen.root_path.to_s + '/locale/base/en/world/ca.yml')
30
- Carmen.i18n_backend.load_path << (Carmen.root_path.to_s + '/locale/base/en/world/us.yml')
31
- Carmen.i18n_backend.load_path << (Carmen.root_path.to_s + '/locale/base/en/world/sg.yml')
32
-
33
- # Checks for pending migrations before tests are run.
34
- # If you are not using ActiveRecord, you can remove this line.
35
- ActiveRecord::Migration.maintain_test_schema!
36
-
37
- RSpec.configure do |config|
38
- # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
39
- config.fixture_path = "#{::Rails.root}/spec/fixtures"
40
-
41
- # If you're not using ActiveRecord, or you'd prefer not to run each of your
42
- # examples within a transaction, remove the following line or assign false
43
- # instead of true.
44
- config.use_transactional_fixtures = true
45
-
46
- # RSpec Rails can automatically mix in different behaviours to your tests
47
- # based on their file location, for example enabling you to call `get` and
48
- # `post` in specs under `spec/controllers`.
49
- #
50
- # You can disable this behaviour by removing the line below, and instead
51
- # explicitly tag your specs with their type, e.g.:
52
- #
53
- # RSpec.describe UsersController, :type => :controller do
54
- # # ...
55
- # end
56
- #
57
- # The different available types are documented in the features, such as in
58
- # https://relishapp.com/rspec/rspec-rails/docs
59
- config.infer_spec_type_from_file_location!
60
- end
data/spec/spec_helper.rb DELETED
@@ -1,97 +0,0 @@
1
- # This file was generated by the `rspec --init` command. Conventionally, all
2
- # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
- # The generated `.rspec` file contains `--require spec_helper` which will cause
4
- # this file to always be loaded, without a need to explicitly require it in any
5
- # files.
6
- #
7
- # Given that it is always loaded, you are encouraged to keep this file as
8
- # light-weight as possible. Requiring heavyweight dependencies from this file
9
- # will add to the boot time of your test suite on EVERY test run, even for an
10
- # individual file that may not need all of that loaded. Instead, consider making
11
- # a separate helper file that requires the additional dependencies and performs
12
- # the additional setup, and require it from the spec files that actually need
13
- # it.
14
- #
15
- # The `.rspec` file also contains a few flags that are not defaults but that
16
- # users commonly want.
17
- #
18
- # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
19
- RSpec.configure do |config|
20
- # rspec-expectations config goes here. You can use an alternate
21
- # assertion/expectation library such as wrong or the stdlib/minitest
22
- # assertions if you prefer.
23
- config.expect_with :rspec do |expectations|
24
- # This option will default to `true` in RSpec 4. It makes the `description`
25
- # and `failure_message` of custom matchers include text for helper methods
26
- # defined using `chain`, e.g.:
27
- # be_bigger_than(2).and_smaller_than(4).description
28
- # # => "be bigger than 2 and smaller than 4"
29
- # ...rather than:
30
- # # => "be bigger than 2"
31
- expectations.include_chain_clauses_in_custom_matcher_descriptions = true
32
- end
33
-
34
- # rspec-mocks config goes here. You can use an alternate test double
35
- # library (such as bogus or mocha) by changing the `mock_with` option here.
36
- config.mock_with :rspec do |mocks|
37
- # Prevents you from mocking or stubbing a method that does not exist on
38
- # a real object. This is generally recommended, and will default to
39
- # `true` in RSpec 4.
40
- mocks.verify_partial_doubles = true
41
- end
42
-
43
- config.order = :random
44
-
45
- config.expect_with :rspec do |c|
46
- c.syntax = [:should, :expect]
47
- end
48
-
49
- # The settings below are suggested to provide a good initial experience
50
- # with RSpec, but feel free to customize to your heart's content.
51
- =begin
52
- # These two settings work together to allow you to limit a spec run
53
- # to individual examples or groups you care about by tagging them with
54
- # `:focus` metadata. When nothing is tagged with `:focus`, all examples
55
- # get run.
56
- config.filter_run :focus
57
- config.run_all_when_everything_filtered = true
58
-
59
- # Limits the available syntax to the non-monkey patched syntax that is
60
- # recommended. For more details, see:
61
- # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
62
- # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
63
- # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
64
- config.disable_monkey_patching!
65
-
66
- # This setting enables warnings. It's recommended, but in some cases may
67
- # be too noisy due to issues in dependencies.
68
- config.warnings = true
69
-
70
- # Many RSpec users commonly either run the entire suite or an individual
71
- # file, and it's useful to allow more verbose output when running an
72
- # individual spec file.
73
- if config.files_to_run.one?
74
- # Use the documentation formatter for detailed output,
75
- # unless a formatter has already been configured
76
- # (e.g. via a command-line flag).
77
- config.default_formatter = 'doc'
78
- end
79
-
80
- # Print the 10 slowest examples and example groups at the
81
- # end of the spec run, to help surface which specs are running
82
- # particularly slow.
83
- config.profile_examples = 10
84
-
85
- # Run specs in random order to surface order dependencies. If you find an
86
- # order dependency and want to debug it, you can fix the order by providing
87
- # the seed, which is printed after each run.
88
- # --seed 1234
89
- config.order = :random
90
-
91
- # Seed global randomization in this process using the `--seed` CLI option.
92
- # Setting this allows you to use `--seed` to deterministically reproduce
93
- # test failures related to randomization by passing the same `--seed` value
94
- # as the one that triggered the failure.
95
- Kernel.srand config.seed
96
- =end
97
- end
@@ -1,60 +0,0 @@
1
- require 'factory_girl'
2
-
3
- FactoryGirl.define do
4
- factory :address, :class => Effective::Address do
5
- category 'billing'
6
- full_name nil
7
- sequence(:address1) { |n| "1234#{n} Fake Street" }
8
- city 'San Antonio'
9
- state_code 'TX'
10
- country_code 'US'
11
- postal_code '92387'
12
- end
13
-
14
- factory :address_with_full_name, :class => Effective::Address do
15
- category 'billing'
16
- full_name 'Peter Pan'
17
- sequence(:address1) { |n| "1234#{n} Fake Street" }
18
- city 'San Antonio'
19
- state_code 'TX'
20
- country_code 'US'
21
- postal_code '92387'
22
- end
23
-
24
- factory :user do
25
- sequence(:email) { |n| "user_#{n}@effective_addresses.test"}
26
- sequence(:first_name) { |n| "First Name #{n}"}
27
- sequence(:last_name) { |n| "Last Name #{n}"}
28
- end
29
-
30
- factory :user_with_address do
31
- sequence(:email) { |n| "user_#{n}@effective_addresses.test"}
32
- sequence(:first_name) { |n| "First Name #{n}"}
33
- sequence(:last_name) { |n| "Last Name #{n}"}
34
- end
35
-
36
- factory :user_with_required_address do
37
- sequence(:email) { |n| "user_#{n}@effective_addresses.test"}
38
- sequence(:first_name) { |n| "First Name #{n}"}
39
- sequence(:last_name) { |n| "Last Name #{n}"}
40
- end
41
-
42
- factory :user_with_required_full_name do
43
- sequence(:email) { |n| "user_#{n}@effective_addresses.test"}
44
- sequence(:first_name) { |n| "First Name #{n}"}
45
- sequence(:last_name) { |n| "Last Name #{n}"}
46
- end
47
-
48
- factory :user_with_required_address_and_full_name do
49
- sequence(:email) { |n| "user_#{n}@effective_addresses.test"}
50
- sequence(:first_name) { |n| "First Name #{n}"}
51
- sequence(:last_name) { |n| "Last Name #{n}"}
52
- end
53
-
54
- factory :user_with_singular_address do
55
- sequence(:email) { |n| "user_#{n}@effective_addresses.test"}
56
- sequence(:first_name) { |n| "First Name #{n}"}
57
- sequence(:last_name) { |n| "Last Name #{n}"}
58
- end
59
-
60
- end