centsable 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +24 -0
  3. data/.rspec +2 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE.txt +22 -0
  6. data/README.md +66 -0
  7. data/Rakefile +2 -0
  8. data/centsable.gemspec +24 -0
  9. data/lib/centsable/version.rb +3 -0
  10. data/lib/centsable.rb +33 -0
  11. data/spec/dummy/README.rdoc +28 -0
  12. data/spec/dummy/Rakefile +6 -0
  13. data/spec/dummy/app/assets/images/.keep +0 -0
  14. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  15. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  16. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  17. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  18. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  19. data/spec/dummy/app/mailers/.keep +0 -0
  20. data/spec/dummy/app/models/.keep +0 -0
  21. data/spec/dummy/app/models/concerns/.keep +0 -0
  22. data/spec/dummy/app/models/price_history.rb +5 -0
  23. data/spec/dummy/app/models/product.rb +3 -0
  24. data/spec/dummy/app/views/home/index.html.erb +1 -0
  25. data/spec/dummy/app/views/layouts/application.html.erb +15 -0
  26. data/spec/dummy/app/views/secrets/index.html.erb +5 -0
  27. data/spec/dummy/bin/bundle +3 -0
  28. data/spec/dummy/bin/rails +4 -0
  29. data/spec/dummy/bin/rake +4 -0
  30. data/spec/dummy/bin/setup +29 -0
  31. data/spec/dummy/config/application.rb +26 -0
  32. data/spec/dummy/config/boot.rb +5 -0
  33. data/spec/dummy/config/database.yml +25 -0
  34. data/spec/dummy/config/environment.rb +5 -0
  35. data/spec/dummy/config/environments/development.rb +41 -0
  36. data/spec/dummy/config/environments/production.rb +79 -0
  37. data/spec/dummy/config/environments/test.rb +42 -0
  38. data/spec/dummy/config/initializers/assets.rb +11 -0
  39. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  40. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  41. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  42. data/spec/dummy/config/initializers/inflections.rb +16 -0
  43. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  44. data/spec/dummy/config/initializers/session_store.rb +3 -0
  45. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  46. data/spec/dummy/config/locales/en.yml +23 -0
  47. data/spec/dummy/config/routes.rb +2 -0
  48. data/spec/dummy/config/secrets.yml +22 -0
  49. data/spec/dummy/config/ssl_private.key +12 -0
  50. data/spec/dummy/config.ru +4 -0
  51. data/spec/dummy/db/migrate/20151125153613_create_products.rb +10 -0
  52. data/spec/dummy/db/migrate/20151125154041_create_price_histories.rb +11 -0
  53. data/spec/dummy/db/schema.rb +33 -0
  54. data/spec/dummy/lib/assets/.keep +0 -0
  55. data/spec/dummy/log/.keep +0 -0
  56. data/spec/dummy/public/404.html +67 -0
  57. data/spec/dummy/public/422.html +67 -0
  58. data/spec/dummy/public/500.html +66 -0
  59. data/spec/dummy/public/favicon.ico +0 -0
  60. data/spec/models/centsable_spec.rb +47 -0
  61. data/spec/rails_helper.rb +64 -0
  62. data/spec/spec_helper.rb +92 -0
  63. metadata +213 -0
@@ -0,0 +1,4 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
@@ -0,0 +1,3 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Rails.application.config.session_store :cookie_store, key: '_dummy_session'
@@ -0,0 +1,14 @@
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
@@ -0,0 +1,23 @@
1
+ # Files in the config/locales directory are used for internationalization
2
+ # and are automatically loaded by Rails. If you want to use locales other
3
+ # than English, add the necessary files in this directory.
4
+ #
5
+ # To use the locales, use `I18n.t`:
6
+ #
7
+ # I18n.t 'hello'
8
+ #
9
+ # In views, this is aliased to just `t`:
10
+ #
11
+ # <%= t('hello') %>
12
+ #
13
+ # To use a different locale, set it with `I18n.locale`:
14
+ #
15
+ # I18n.locale = :es
16
+ #
17
+ # This would use the information in config/locales/es.yml.
18
+ #
19
+ # To learn more, please read the Rails Internationalization guide
20
+ # available at http://guides.rubyonrails.org/i18n.html.
21
+
22
+ en:
23
+ hello: "Hello world"
@@ -0,0 +1,2 @@
1
+ Rails.application.routes.draw do
2
+ end
@@ -0,0 +1,22 @@
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: 37234f414ad4fb121e72057b7aa4afb72eefee1276d82f4a5f4fce0dd9d9baeab07a7a1721a23e7c35ab2809907c6a04758b025363c6e985932129006ac0bdcd
15
+
16
+ test:
17
+ secret_key_base: 30029b72cc5ae4f7fc1470c4464fe2db2c0f15dba526a53c08c858abf494cb21b56eea248bc85ff6f3e2df7559dfca7933895e25b738dfe2d3390d7997ed73fa
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"] %>
@@ -0,0 +1,12 @@
1
+ -----BEGIN RSA PRIVATE KEY-----
2
+ MIIByQIBAAJhAKfzKFRVCFNf3fUq4Da6aL3eVsYLHlXpi8Z8WDMkAPO477nthwnc
3
+ HmyYK1PZSa3ThMVH8U75KownXEvgak3HD57/RBMroM+O0XXO7HNuwiiS4+1cPU/s
4
+ ZDfeyc6sdkqa1wIDAQABAmAstgALi2OfBouJZDOyfie6PEGvkXAvAPC0E5BLdQ9H
5
+ 0vkG72QezNnQoSYPuW3y97cXYgGmp6dOMfnpg9o4a0VkeUKbbPNqAWK8EWAwciTU
6
+ RLD1FxUrgbBGUcYC9ch13HECMQDZmsMtsAAzTr4UfKM3lknAaB+TiowloKbMXDVO
7
+ M1bS0xYHNX/BLLGmn9IyadgW4rkCMQDFlXuYA+yPrNFJMQrT9sm3soVu3U0VCBU/
8
+ UQ0/0JD+mT2FEvjbdh2XmUKUJiks4g8CMBoEoymnTZ7U321bqbhPw+m5iWz+t9sX
9
+ 5lmw/L6o7MywaIXcI7ZZPbSKj3tvpGK4IQIwYxzwKbpWMWBEf82dG+ThHUftDUbv
10
+ wswSNHfJCKjsAvsF1DpHIXensoNL1Zsq7nvbAjA8MNEA3uZErjPiKlce8cq4hsds
11
+ YIIhdZwZV92CFY8zOF9pCMaXA7X3sc3MDDd7TOM=
12
+ -----END RSA PRIVATE KEY-----
@@ -0,0 +1,4 @@
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
@@ -0,0 +1,10 @@
1
+ class CreateProducts < ActiveRecord::Migration
2
+ def change
3
+ create_table :products do |t|
4
+ t.string :title
5
+ t.integer :price
6
+
7
+ t.timestamps null: false
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,11 @@
1
+ class CreatePriceHistories < ActiveRecord::Migration
2
+ def change
3
+ create_table :price_histories do |t|
4
+ t.references :product, index: true, foreign_key: true
5
+ t.integer :price
6
+ t.integer :price_old
7
+
8
+ t.timestamps null: false
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,33 @@
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 that you check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(version: 20151125154041) do
15
+
16
+ create_table "price_histories", force: :cascade do |t|
17
+ t.integer "product_id"
18
+ t.integer "price"
19
+ t.integer "price_old"
20
+ t.datetime "created_at", null: false
21
+ t.datetime "updated_at", null: false
22
+ end
23
+
24
+ add_index "price_histories", ["product_id"], name: "index_price_histories_on_product_id"
25
+
26
+ create_table "products", force: :cascade do |t|
27
+ t.string "title"
28
+ t.integer "price"
29
+ t.datetime "created_at", null: false
30
+ t.datetime "updated_at", null: false
31
+ end
32
+
33
+ end
File without changes
File without changes
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body>
58
+ <!-- This file lives in public/404.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>The page you were looking for doesn't exist.</h1>
62
+ <p>You may have mistyped the address or the page may have moved.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
65
+ </div>
66
+ </body>
67
+ </html>
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body>
58
+ <!-- This file lives in public/422.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>The change you wanted was rejected.</h1>
62
+ <p>Maybe you tried to change something you didn't have access to.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
65
+ </div>
66
+ </body>
67
+ </html>
@@ -0,0 +1,66 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body>
58
+ <!-- This file lives in public/500.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>We're sorry, but something went wrong.</h1>
62
+ </div>
63
+ <p>If you are the application owner check the logs for more information.</p>
64
+ </div>
65
+ </body>
66
+ </html>
File without changes
@@ -0,0 +1,47 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe Centsable, type: :model do
4
+ context 'given a model with price' do
5
+ let(:product) { Product.create(title: 'test', price: 23.45) }
6
+
7
+ it 'should return price as float' do
8
+ expect(product.price).to eq 23.45
9
+ end
10
+
11
+ it 'should return price_in_cents as integer' do
12
+ expect(product.price_in_cents).to eq 2345
13
+ end
14
+ end
15
+
16
+ context 'given a model without price' do
17
+ let(:product) { Product.create(title: 'test') }
18
+
19
+ it 'should return a nil price' do
20
+ expect(product.price).to be_nil
21
+ end
22
+
23
+ it 'should return a nil price_in_cents' do
24
+ expect(product.price_in_cents).to be_nil
25
+ end
26
+ end
27
+
28
+ context 'given a model with two price attributes' do
29
+ let(:product) { Product.create(title: 'test') }
30
+ let(:price_history) { PriceHistory.create(product: product, price: 45.67, price_old: 12.34) }
31
+
32
+ it 'should return price as float' do
33
+ expect(price_history.price).to eq 45.67
34
+ expect(price_history.price_old).to eq 12.34
35
+ end
36
+
37
+ it 'should return price_in_cents as integer' do
38
+ expect(price_history.price_in_cents).to eq 4567
39
+ expect(price_history.price_old_in_cents).to eq 1234
40
+ end
41
+ end
42
+
43
+ context '#in_cents' do
44
+ it { expect(Product.in_cents(23.45)).to eq 2345 }
45
+ it { expect(Product.in_cents(nil)).to be_nil }
46
+ end
47
+ end
@@ -0,0 +1,64 @@
1
+ require 'rails/all'
2
+
3
+ # This file is copied to spec/ when you run 'rails generate rspec:install'
4
+ ENV['RAILS_ENV'] ||= 'test'
5
+ # require File.expand_path('../../config/environment', __FILE__)
6
+ # Prevent database truncation if the environment is production
7
+ abort('The Rails environment is running in production mode!') if Rails.env.production?
8
+ require 'spec_helper'
9
+ require 'rspec/rails'
10
+ # Add additional requires below this line. Rails is not loaded until this point!
11
+ require File.expand_path('../dummy/config/environment.rb', __FILE__)
12
+ ActiveRecord::Migrator.migrations_paths = [File.expand_path('../dummy/db/migrate', __FILE__)]
13
+ ActiveRecord::Migrator.migrations_paths << File.expand_path('../../db/migrate', __FILE__)
14
+
15
+ # Requires supporting ruby files with custom matchers and macros, etc, in
16
+ # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
17
+ # run as spec files by default. This means that files in spec/support that end
18
+ # in _spec.rb will both be required and run as specs, causing the specs to be
19
+ # run twice. It is recommended that you do not name files matching this glob to
20
+ # end with _spec.rb. You can configure this pattern with the --pattern
21
+ # option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
22
+ #
23
+ # The following line is provided for convenience purposes. It has the downside
24
+ # of increasing the boot-up time by auto-requiring all files in the support
25
+ # directory. Alternatively, in the individual `*_spec.rb` files, manually
26
+ # require only the support files necessary.
27
+ #
28
+ # Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
29
+
30
+ # Checks for pending migration and applies them before tests are run.
31
+ # If you are not using ActiveRecord, you can remove this line.
32
+ ActiveRecord::Migration.maintain_test_schema!
33
+
34
+ RSpec.configure do |config|
35
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
36
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
37
+
38
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
39
+ # examples within a transaction, remove the following line or assign false
40
+ # instead of true.
41
+ config.use_transactional_fixtures = true
42
+
43
+ # RSpec Rails can automatically mix in different behaviours to your tests
44
+ # based on their file location, for example enabling you to call `get` and
45
+ # `post` in specs under `spec/controllers`.
46
+ #
47
+ # You can disable this behaviour by removing the line below, and instead
48
+ # explicitly tag your specs with their type, e.g.:
49
+ #
50
+ # RSpec.describe UsersController, :type => :controller do
51
+ # # ...
52
+ # end
53
+ #
54
+ # The different available types are documented in the features, such as in
55
+ # https://relishapp.com/rspec/rspec-rails/docs
56
+ config.infer_spec_type_from_file_location!
57
+
58
+ # Filter lines from Rails gems in backtraces.
59
+ config.filter_rails_from_backtrace!
60
+ # arbitrary gems may also be filtered via:
61
+ # config.filter_gems_from_backtrace("gem name")
62
+
63
+ config.include Rails.application.routes.url_helpers
64
+ end
@@ -0,0 +1,92 @@
1
+ # This file was generated by the `rails generate rspec:install` 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
+ # The settings below are suggested to provide a good initial experience
44
+ # with RSpec, but feel free to customize to your heart's content.
45
+ =begin
46
+ # These two settings work together to allow you to limit a spec run
47
+ # to individual examples or groups you care about by tagging them with
48
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
49
+ # get run.
50
+ config.filter_run :focus
51
+ config.run_all_when_everything_filtered = true
52
+
53
+ # Allows RSpec to persist some state between runs in order to support
54
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
55
+ # you configure your source control system to ignore this file.
56
+ config.example_status_persistence_file_path = "spec/examples.txt"
57
+
58
+ # Limits the available syntax to the non-monkey patched syntax that is
59
+ # recommended. For more details, see:
60
+ # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
61
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
62
+ # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
63
+ config.disable_monkey_patching!
64
+
65
+ # Many RSpec users commonly either run the entire suite or an individual
66
+ # file, and it's useful to allow more verbose output when running an
67
+ # individual spec file.
68
+ if config.files_to_run.one?
69
+ # Use the documentation formatter for detailed output,
70
+ # unless a formatter has already been configured
71
+ # (e.g. via a command-line flag).
72
+ config.default_formatter = 'doc'
73
+ end
74
+
75
+ # Print the 10 slowest examples and example groups at the
76
+ # end of the spec run, to help surface which specs are running
77
+ # particularly slow.
78
+ config.profile_examples = 10
79
+
80
+ # Run specs in random order to surface order dependencies. If you find an
81
+ # order dependency and want to debug it, you can fix the order by providing
82
+ # the seed, which is printed after each run.
83
+ # --seed 1234
84
+ config.order = :random
85
+
86
+ # Seed global randomization in this process using the `--seed` CLI option.
87
+ # Setting this allows you to use `--seed` to deterministically reproduce
88
+ # test failures related to randomization by passing the same `--seed` value
89
+ # as the one that triggered the failure.
90
+ Kernel.srand config.seed
91
+ =end
92
+ end