reform 2.3.0.rc2 → 2.6.0

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 (72) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/ci.yml +17 -0
  3. data/.gitignore +4 -2
  4. data/CHANGES.md +24 -1
  5. data/Gemfile +1 -7
  6. data/LICENSE.txt +1 -1
  7. data/README.md +5 -5
  8. data/Rakefile +2 -15
  9. data/lib/reform/contract/validate.rb +1 -1
  10. data/lib/reform/form/dry.rb +47 -9
  11. data/lib/reform/form/populator.rb +13 -3
  12. data/lib/reform/form/prepopulate.rb +1 -1
  13. data/lib/reform/form/validate.rb +3 -3
  14. data/lib/reform/validation/groups.rb +0 -1
  15. data/lib/reform/version.rb +1 -1
  16. data/reform.gemspec +3 -4
  17. data/test/call_test.rb +23 -0
  18. data/test/changed_test.rb +6 -6
  19. data/test/coercion_test.rb +17 -17
  20. data/test/{composition_new_api.rb → composition_test.rb} +27 -28
  21. data/test/{contract_new_api.rb → contract_test.rb} +8 -8
  22. data/test/default_test.rb +2 -2
  23. data/test/deserialize_test.rb +8 -8
  24. data/test/docs/validation_test.rb +134 -0
  25. data/test/{errors_new_api.rb → errors_test.rb} +41 -41
  26. data/test/feature_test.rb +2 -2
  27. data/test/fixtures/dry_error_messages.yml +64 -54
  28. data/test/{form_option_new_api.rb → form_option_test.rb} +1 -1
  29. data/test/{form_new_api.rb → form_test.rb} +3 -3
  30. data/test/from_test.rb +10 -10
  31. data/test/{inherit_new_api.rb → inherit_test.rb} +17 -17
  32. data/test/{module_new_api.rb → module_test.rb} +10 -10
  33. data/test/parse_option_test.rb +7 -7
  34. data/test/parse_pipeline_test.rb +1 -1
  35. data/test/{populate_new_api.rb → populate_test.rb} +136 -53
  36. data/test/populator_skip_test.rb +2 -2
  37. data/test/prepopulator_test.rb +16 -16
  38. data/test/read_only_test.rb +2 -2
  39. data/test/readable_test.rb +3 -3
  40. data/test/{reform_new_api.rb → reform_test.rb} +19 -19
  41. data/test/{save_new_api.rb → save_test.rb} +4 -4
  42. data/test/setup_test.rb +9 -9
  43. data/test/{skip_if_new_api.rb → skip_if_test.rb} +12 -12
  44. data/test/skip_setter_and_getter_test.rb +6 -6
  45. data/test/test_helper.rb +6 -7
  46. data/test/{validate_new_api.rb → validate_test.rb} +108 -76
  47. data/test/validation/{dry_validation_new_api.rb → dry_validation_test.rb} +145 -135
  48. data/test/validation/result_test.rb +14 -14
  49. data/test/virtual_test.rb +7 -7
  50. data/test/writeable_test.rb +8 -8
  51. metadata +46 -99
  52. data/.rubocop.yml +0 -30
  53. data/.rubocop_todo.yml +0 -460
  54. data/.travis.yml +0 -32
  55. data/lib/reform/form/dry/new_api.rb +0 -58
  56. data/lib/reform/form/dry/old_api.rb +0 -61
  57. data/test/call_new_api.rb +0 -23
  58. data/test/call_old_api.rb +0 -23
  59. data/test/composition_old_api.rb +0 -184
  60. data/test/contract_old_api.rb +0 -77
  61. data/test/errors_old_api.rb +0 -230
  62. data/test/fixtures/dry_new_api_error_messages.yml +0 -104
  63. data/test/form_old_api.rb +0 -57
  64. data/test/form_option_old_api.rb +0 -24
  65. data/test/inherit_old_api.rb +0 -105
  66. data/test/module_old_api.rb +0 -146
  67. data/test/populate_old_api.rb +0 -304
  68. data/test/reform_old_api.rb +0 -202
  69. data/test/save_old_api.rb +0 -101
  70. data/test/skip_if_old_api.rb +0 -92
  71. data/test/validate_old_api.rb +0 -410
  72. data/test/validation/dry_validation_old_api.rb +0 -772
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: d820c5f61dcb3ef74ab8ac15bbc662bd8e9490a8
4
- data.tar.gz: aa023d388b19459ebe7dd4c19862f8bc85364697
2
+ SHA256:
3
+ metadata.gz: 9a0dc23a8d6a5ba78556fdd827acdfdd596e45dc8354ed5e82acfdfaf5cf5dcf
4
+ data.tar.gz: 21216fc1a7d500ca8ecd7b59349166629e8ef8514d34d321d23eb5a857d378dd
5
5
  SHA512:
6
- metadata.gz: 48f9fcbc0917b9478d1124900146d6597e32e613a2ab4d61d504d359fb546b42d44ae958fff089df1bc315983c1fb70701b4246fb4a85b79341113f9460e5278
7
- data.tar.gz: eac447cc3824c9e09926e64fb33437e8e9c0b3e86a7dfd24ec1cc71407c23550854fd6c64ea25538de01cb1350fb6302bb033e542bebb1f52a65ea1a7d8674e9
6
+ metadata.gz: f5a8aeaa19e8a90c4d0276fba8fe6d85fb5574607e838e9c9298d556292182231ed7d2e29b24835f3265cabb9b37db93f6602388052889e6fcd759e5478ca6ef
7
+ data.tar.gz: c69fadd4887bfb63538d69a501ddf0e958bd9594ceb9ff97a4181c5017d1eec0a2bbc88fc9cb9ba417257be6f01ac655301b0e822c6babf36ca45d7b7c3fd4e3
@@ -0,0 +1,17 @@
1
+ name: CI
2
+ on: [push, pull_request]
3
+ jobs:
4
+ test:
5
+ strategy:
6
+ fail-fast: false
7
+ matrix:
8
+ # Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0'
9
+ ruby: [2.4, 2.5, 2.6, 2.7, '3.0', head]
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v2
13
+ - uses: ruby/setup-ruby@v1
14
+ with:
15
+ ruby-version: ${{ matrix.ruby }}
16
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
17
+ - run: bundle exec rake
data/.gitignore CHANGED
@@ -4,7 +4,6 @@
4
4
  .config
5
5
  .yardoc
6
6
  Gemfile.lock
7
- gemfiles/*.lock
8
7
  InstalledFiles
9
8
  _yardoc
10
9
  coverage
@@ -16,5 +15,8 @@ spec/reports
16
15
  test/tmp
17
16
  test/version_tmp
18
17
  tmp
19
- .rubocop-https*
18
+ .rubocop*
20
19
  .byebug_history
20
+ .idea
21
+ *.iml
22
+ gemfiles/*.gemfile.lock
data/CHANGES.md CHANGED
@@ -1,8 +1,31 @@
1
- ## 3.0.0
1
+ ## 2.6.0
2
2
 
3
+ * Support ruby-3 by using `Representable::Option` to handle `keyword_arguments` forwarding :tada:
4
+ * Upgrade `representable` and `disposable` dependencies which uses `trailblazer-option` over `declarative-option`.
5
+ * Deprecate populator's callable signature which accepts `form` as a separate positional argument. Make all callable (proc, method, `Uber::Callable`) signatures identical.
6
+
7
+ ## 2.5.0
8
+ * fix memory leak with Dry validation (#525)
9
+
10
+ ## 2.4.0
11
+
12
+ * [BREAKING] Dropping compatibility of dry-validation < 1.x
3
13
  [* Removed `Reform::Contract` ?]
4
14
  [* Move Form#deserializer to Form::deserializer]
5
15
 
16
+ ## 2.3.3
17
+
18
+ * Rename validation option for dry-v 1+ to `contract` instead of `schema`
19
+
20
+ ## 2.3.2
21
+
22
+ * Fix Validation block option :form incorrectly memoized between tests
23
+
24
+ ## 2.3.1
25
+ * With dry-validation 1.5 the form is always injected. Just add option :form to access it in the schema.
26
+ * Removed global monkey patching of Dry::Schema::DSL
27
+ * Tests in ruby 2.7
28
+
6
29
  ## 2.3.0
7
30
 
8
31
  You can upgrade from 2.2.0 without worries.
data/Gemfile CHANGED
@@ -2,10 +2,4 @@ source "https://rubygems.org"
2
2
 
3
3
  gemspec
4
4
 
5
- # gem "disposable", path: "../disposable"
6
-
7
- # just trying to add `dry-monads` correct version in base on dry-validation
8
- dry_v_version = ENV.fetch('DRY_VALIDATION', '~> 0.13.0')
9
- dry_m_version = "~> #{dry_v_version.gsub("~>", "").to_f}.0"
10
- gem 'dry-monads', dry_m_version if dry_v_version.gsub("~>", "").to_f >= 1
11
- gem 'dry-validation', ENV.fetch('DRY_VALIDATION', '~> 0.13.0')
5
+ gem 'dry-validation', '~> 1.5.0'
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2013 - 2016 Nick Sutterer
1
+ Copyright (c) 2013 - 2021 Nick Sutterer
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -10,11 +10,11 @@ _Form objects decoupled from your models._
10
10
 
11
11
  Reform gives you a form object with validations and nested setup of models. It is completely framework-agnostic and doesn't care about your database.
12
12
 
13
- Although reform can be used in any Ruby framework, it comes with [Rails support](#rails-integration), works with [simple_form and other form gems](#formbuilder-support), allows nesting forms to implement [has_one](#nesting-forms-1-1-relations) and [has_many](#nesting-forms-1-n-relations) relationships, can [compose a form](#compositions) from multiple objects and gives you [coercion](#coercion).
13
+ Although reform can be used in any Ruby framework, it comes with [Rails support](#rails-integration), works with simple_form and other form gems, allows nesting forms to implement has_one and has_many relationships, can [compose a form](#compositions) from multiple objects and gives you coercion.
14
14
 
15
15
  ## Full Documentation
16
16
 
17
- Reform is part of the [Trailblazer](http://trailblazer.to) framework. [Full documentation](http://trailblazer.to/gems/reform) is available on the project site.
17
+ Reform is part of the [Trailblazer](http://trailblazer.to) framework. [Full documentation](http://trailblazer.to/2.1/docs/reform.html) is available on the project site.
18
18
 
19
19
  ## Reform 2.2
20
20
 
@@ -250,7 +250,7 @@ The manual saving with block is not encouraged. You should rather check the Disp
250
250
 
251
251
  ## Populating Forms
252
252
 
253
- Very often, you need to give Reform some information how to create or find nested objects when `validate`ing. This directive is called _populator_ and [documented here](http://trailblazer.to/gems/reform/populator.html).
253
+ Very often, you need to give Reform some information how to create or find nested objects when `validate`ing. This directive is called _populator_ and [documented here](http://trailblazer.to/2.1/docs/reform.html#reform-populators).
254
254
 
255
255
  ## Installation
256
256
 
@@ -313,7 +313,7 @@ AlbumForm.new(album: album, cd: CD.find(1))
313
313
 
314
314
  ## More
315
315
 
316
- Reform comes many more optional features, like hash fields, coercion, virtual fields, and so on. Check the [full documentation here](http://trailblazer.to/gems/reform).
316
+ Reform comes many more optional features, like hash fields, coercion, virtual fields, and so on. Check the [full documentation here](http://trailblazer.to/2.1/docs/reform.html).
317
317
 
318
318
  [![](http://trailblazer.to/images/3dbuch-freigestellt.png)](https://leanpub.com/trailblazer)
319
319
 
@@ -330,7 +330,7 @@ Temporary note: This is the README and API for Reform 2. On the public API, only
330
330
 
331
331
  Anyway, please upgrade and _report problems_ and do not simply assume that we will magically find out what needs to get fixed. When in trouble, join us on [Gitter](https://gitter.im/trailblazer/chat).
332
332
 
333
- [Full documentation for Reform](http://trailblazer.to/gems/reform) is available online, or support us and grab the [Trailblazer book](https://leanpub.com/trailblazer). There is an [Upgrading Guide](http://trailblazer.to/gems/reform/upgrading-guide.html) to help you migrate from Reform 1.x.
333
+ [Full documentation for Reform](http://trailblazer.to/2.1/docs/reform.html) is available online, or support us and grab the [Trailblazer book](https://leanpub.com/trailblazer). There is an [Upgrading Guide](http://trailblazer.to/2.1/docs/reform.html#reform-upgrading-guide) to help you migrate through versions.
334
334
 
335
335
  ### Attributions!!!
336
336
 
data/Rakefile CHANGED
@@ -1,24 +1,11 @@
1
1
  require "bundler/gem_tasks"
2
2
  require "rake/testtask"
3
- require "rubocop/rake_task"
3
+ require "dry/types/version"
4
4
 
5
5
  task default: %i[test]
6
6
 
7
- TEST_WITH_OLD_AND_NEW_API = %w[
8
- validation/dry_validation call composition contract errors inherit module reform
9
- save skip_if populate validate form
10
- ].freeze
11
-
12
- def dry_v_test_files
13
- dry_v_version = ENV.fetch("DRY_VALIDATION", "~> 0.13.0")
14
- api = dry_v_version.gsub("~>", "").to_f >= 1.0 ? "new" : "old"
15
- TEST_WITH_OLD_AND_NEW_API.map { |file| "test/#{file}_#{api}_api.rb" }
16
- end
17
-
18
7
  Rake::TestTask.new(:test) do |test|
19
8
  test.libs << "test"
20
- test.test_files = FileList["test/*_test.rb"] + FileList["test/validation/*_test.rb"] + dry_v_test_files
9
+ test.test_files = FileList["test/**/*_test.rb"]
21
10
  test.verbose = true
22
11
  end
23
-
24
- RuboCop::RakeTask.new(:rubocop)
@@ -11,7 +11,7 @@ class Reform::Contract < Disposable::Twin
11
11
  validate!(nil).success?
12
12
  end
13
13
 
14
- # The #errors method will be removed in Reform 2.4/3.0 core.
14
+ # The #errors method will be removed in Reform 3.0 core.
15
15
  def errors(*args)
16
16
  Result::Errors.new(@result, self)
17
17
  end
@@ -1,19 +1,57 @@
1
+ gem 'dry-validation', '~> 1.5'
1
2
  require "dry-validation"
2
- require "dry/validation/version"
3
3
  require "reform/validation"
4
4
  require "reform/form/dry/input_hash"
5
5
 
6
+ ::Dry::Validation.load_extensions(:hints)
7
+
6
8
  module Reform::Form::Dry
9
+ class Contract < Dry::Validation::Contract
10
+ end
11
+
7
12
  def self.included(includer)
8
- if Gem::Version.new(Dry::Validation::VERSION) > Gem::Version.new("0.13.3")
9
- require "reform/form/dry/new_api"
10
- validations = Reform::Form::Dry::NewApi::Validations
11
- else
12
- require "reform/form/dry/old_api"
13
- validations = Reform::Form::Dry::OldApi::Validations
13
+ includer.send :include, Validations
14
+ includer.extend Validations::ClassMethods
15
+ end
16
+
17
+ module Validations
18
+ module ClassMethods
19
+ def validation_group_class
20
+ Group
21
+ end
22
+ end
23
+
24
+ def self.included(includer)
25
+ includer.extend(ClassMethods)
14
26
  end
15
27
 
16
- includer.send :include, validations
17
- includer.extend validations::ClassMethods
28
+ class Group
29
+ include InputHash
30
+
31
+ def initialize(options)
32
+ @validator = options.fetch(:contract, Contract)
33
+ @schema_inject_params = options.fetch(:with, {})
34
+ end
35
+
36
+ attr_reader :validator, :schema_inject_params, :block
37
+
38
+ def instance_exec(&block)
39
+ @block = block
40
+ end
41
+
42
+ def call(form)
43
+ # when passing options[:schema] the class instance is already created so we just need to call
44
+ # "call"
45
+ return validator.call(input_hash(form)) unless validator.is_a?(Class) && @validator <= ::Dry::Validation::Contract
46
+
47
+ dynamic_options = { form: form }
48
+ inject_options = schema_inject_params.merge(dynamic_options)
49
+ contract.new(**inject_options).call(input_hash(form))
50
+ end
51
+
52
+ def contract
53
+ @contract ||= Class.new(validator, &block)
54
+ end
55
+ end
18
56
  end
19
57
  end
@@ -7,7 +7,7 @@
7
7
  class Reform::Form::Populator
8
8
  def initialize(user_proc)
9
9
  @user_proc = user_proc # the actual `populator: ->{}` block from the user, via ::property.
10
- @value = Declarative::Option(user_proc, instance_exec: true, callable: Object) # we can now process Callable, procs, :symbol.
10
+ @value = ::Representable::Option(user_proc) # we can now process Callable, procs, :symbol.
11
11
  end
12
12
 
13
13
  def call(input, options)
@@ -30,7 +30,17 @@ class Reform::Form::Populator
30
30
 
31
31
  def call!(options)
32
32
  form = options[:represented]
33
- @value.(form, options) # Declarative::Option call.
33
+ evaluate_option(form, options)
34
+ end
35
+
36
+ def evaluate_option(form, options)
37
+ if @user_proc.is_a?(Uber::Callable) && @user_proc.method(:call).arity == 2 # def call(form, options)
38
+ warn %{[Reform] Accepting `form` as a positional argument in `:populator` will be deprecated. Please use `def call(form:, **options)` signature instead.}
39
+
40
+ return @value.(form, exec_context: form, keyword_arguments: options)
41
+ end
42
+
43
+ @value.(exec_context: form, keyword_arguments: options.merge(form: form)) # Representable::Option call
34
44
  end
35
45
 
36
46
  def handle_fail(twin, options)
@@ -66,7 +76,7 @@ class Reform::Form::Populator
66
76
  return @user_proc.new if @user_proc.is_a?(Class) # handle populate_if_empty: Class. this excludes using Callables, though.
67
77
 
68
78
  deprecate_positional_args(form, @user_proc, options) do
69
- @value.(form, options)
79
+ evaluate_option(form, options)
70
80
  end
71
81
  end
72
82
 
@@ -13,7 +13,7 @@ module Reform::Form::Prepopulate
13
13
  def prepopulate_local!(options)
14
14
  schema.each do |dfn|
15
15
  next unless block = dfn[:prepopulator]
16
- Declarative::Option(block, instance_exec: true).(self, options)
16
+ ::Representable::Option(block).(exec_context: self, keyword_arguments: options)
17
17
  end
18
18
  end
19
19
 
@@ -4,15 +4,15 @@ module Reform::Form::Validate
4
4
  class AllBlank
5
5
  include Uber::Callable
6
6
 
7
- def call(form, options)
7
+ def call(input:, binding:, **)
8
8
  # TODO: Schema should provide property names as plain list.
9
9
  # ensure param keys are strings.
10
- params = options[:input].each_with_object({}) { |(k, v), hash|
10
+ params = input.each_with_object({}) { |(k, v), hash|
11
11
  hash[k.to_s] = v
12
12
  }
13
13
 
14
14
  # return false if any property inputs are populated.
15
- options[:binding][:nested].definitions.each do |definition|
15
+ binding[:nested].definitions.each do |definition|
16
16
  value = params[definition.name.to_s]
17
17
  return false if (!value.nil? && value != '')
18
18
  end
@@ -43,7 +43,6 @@ module Reform::Validation
43
43
 
44
44
  groups.collect do |(name, group, options)|
45
45
  next unless evaluate?(options[:if], results, form)
46
-
47
46
  results[name] = group.(form) # run validation for group. store and collect <Result>.
48
47
  end
49
48
  end
@@ -1,3 +1,3 @@
1
1
  module Reform
2
- VERSION = "2.3.0.rc2".freeze
2
+ VERSION = "2.6.0".freeze
3
3
  end
data/reform.gemspec CHANGED
@@ -17,15 +17,14 @@ Gem::Specification.new do |spec|
17
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
18
  spec.require_paths = ["lib"]
19
19
 
20
- spec.add_dependency "disposable", ">= 0.4.2", "< 0.5.0"
21
- spec.add_dependency "representable", ">= 2.4.0", "< 3.1.0"
20
+ spec.add_dependency "disposable", "~> 0.5.0"
21
+ spec.add_dependency "representable", ">= 3.1.1", "< 3.2.0"
22
22
  spec.add_dependency "uber", "< 0.2.0"
23
23
 
24
24
  spec.add_development_dependency "bundler"
25
25
  spec.add_development_dependency "minitest"
26
26
  spec.add_development_dependency "minitest-line"
27
- spec.add_development_dependency "byebug"
27
+ spec.add_development_dependency "pry-byebug"
28
28
  spec.add_development_dependency "multi_json"
29
29
  spec.add_development_dependency "rake"
30
- spec.add_development_dependency "rubocop"
31
30
  end
data/test/call_test.rb ADDED
@@ -0,0 +1,23 @@
1
+ require "test_helper"
2
+
3
+ class CallTest < Minitest::Spec
4
+ Song = Struct.new(:title)
5
+
6
+ class SongForm < TestForm
7
+ property :title
8
+
9
+ validation do
10
+ params { required(:title).filled }
11
+ end
12
+ end
13
+
14
+ let(:form) { SongForm.new(Song.new) }
15
+
16
+ it { assert form.(title: "True North").success? }
17
+ it { refute form.(title: "True North").failure? }
18
+ it { refute form.(title: "").success? }
19
+ it { assert form.(title: "").failure? }
20
+
21
+ it { assert_equal form.(title: "True North").errors.messages, {} }
22
+ it { assert_equal form.(title: "").errors.messages, title: ["must be filled"] }
23
+ end
data/test/changed_test.rb CHANGED
@@ -26,16 +26,16 @@ class ChangedTest < MiniTest::Spec
26
26
 
27
27
  # nothing changed after setup.
28
28
  it do
29
- form.changed?(:name).must_equal false
30
- form.songs[0].changed?(:title).must_equal false
31
- form.songs[0].composer.changed?(:name).must_equal false
29
+ refute form.changed?(:name)
30
+ refute form.songs[0].changed?(:title)
31
+ refute form.songs[0].composer.changed?(:name)
32
32
  end
33
33
 
34
34
  # after validate, things might have changed.
35
35
  it do
36
36
  form.validate("name" => "Out Of Bounds", "songs" => [{"composer" => {"name" => "Ingemar Jansson & Mikael Danielsson"}}])
37
- form.changed?(:name).must_equal true
38
- form.songs[0].changed?(:title).must_equal false
39
- form.songs[0].composer.changed?(:name).must_equal true
37
+ assert form.changed?(:name)
38
+ refute form.songs[0].changed?(:title)
39
+ assert form.songs[0].composer.changed?(:name)
40
40
  end
41
41
  end
@@ -13,11 +13,11 @@ class CoercionTest < BaseTest
13
13
  feature Coercion
14
14
  include Disposable::Twin::Property::Hash
15
15
 
16
- property :released_at, type: DRY_TYPES_CONSTANT::DateTime
16
+ property :released_at, type: Types::Params::DateTime
17
17
 
18
18
  property :hit do
19
- property :length, type: DRY_TYPES_INT_CONSTANT
20
- property :good, type: DRY_TYPES_CONSTANT::Bool
19
+ property :length, type: Types::Params::Integer
20
+ property :good, type: Types::Params::Bool
21
21
  end
22
22
 
23
23
  property :band do
@@ -28,7 +28,7 @@ class CoercionTest < BaseTest
28
28
 
29
29
  property :metadata, field: :hash do
30
30
  property :publication_settings do
31
- property :featured, type: DRY_TYPES_CONSTANT::Bool
31
+ property :featured, type: Types::Params::Bool
32
32
  end
33
33
  end
34
34
  end
@@ -47,9 +47,9 @@ class CoercionTest < BaseTest
47
47
  end
48
48
 
49
49
  # it { subject.released_at.must_be_kind_of DateTime }
50
- it { subject.released_at.must_equal "31/03/1981" } # NO coercion in setup.
51
- it { subject.hit.length.must_equal "312" }
52
- it { subject.band.label.value.must_equal "9999.99" }
50
+ it { assert_equal subject.released_at, "31/03/1981" } # NO coercion in setup.
51
+ it { assert_equal subject.hit.length, "312" }
52
+ it { assert_equal subject.band.label.value, "9999.99" }
53
53
 
54
54
  let(:params) do
55
55
  {
@@ -75,24 +75,24 @@ class CoercionTest < BaseTest
75
75
  describe "#validate" do
76
76
  before { subject.validate(params) }
77
77
 
78
- it { subject.released_at.must_equal DateTime.parse("30/03/1981") }
79
- it { subject.hit.length.must_equal 312 }
80
- it { subject.hit.good.must_equal false }
81
- it { subject.band.label.value.must_equal "9999.999999.99" } # coercion happened once.
82
- it { subject.metadata.publication_settings.featured.must_equal false }
78
+ it { assert_equal subject.released_at, DateTime.parse("30/03/1981") }
79
+ it { assert_equal subject.hit.length, 312 }
80
+ it { assert_equal subject.hit.good, false }
81
+ it { assert_equal subject.band.label.value, "9999.999999.99" } # coercion happened once.
82
+ it { assert_equal subject.metadata.publication_settings.featured, false }
83
83
  end
84
84
 
85
85
  # sync
86
86
  describe "#sync" do
87
87
  before do
88
- subject.validate(params).must_equal true
88
+ assert subject.validate(params)
89
89
  subject.sync
90
90
  end
91
91
 
92
- it { album.released_at.must_equal DateTime.parse("30/03/1981") }
93
- it { album.hit.length.must_equal 312 }
94
- it { album.hit.good.must_equal false }
92
+ it { assert_equal album.released_at, DateTime.parse("30/03/1981") }
93
+ it { assert_equal album.hit.length, 312 }
94
+ it { assert_equal album.hit.good, false }
95
95
  it { assert_nil album.metadata[:publication_settings] }
96
- it { album.metadata["publication_settings"]["featured"].must_equal false }
96
+ it { assert_equal album.metadata["publication_settings"]["featured"], false }
97
97
  end
98
98
  end