Skip to content

Commit

Permalink
Fix class definitions in rspecs, Rename OptionsCleaner to Options, Ad…
Browse files Browse the repository at this point in the history
…d entry in CHANGELOG
  • Loading branch information
Jagdeep Singh committed Jun 23, 2016
1 parent ab6dc25 commit 50de994
Show file tree
Hide file tree
Showing 7 changed files with 127 additions and 118 deletions.
4 changes: 2 additions & 2 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ Metrics/PerceivedComplexity:
# Offense count: 44
Style/Documentation:
Exclude:
- 'lib/mongoid/history/services/options_cleaner.rb'
- 'lib/mongoid/history.rb'
- 'lib/mongoid/history/options.rb'
- 'lib/mongoid/history/trackable.rb'
- 'lib/mongoid/history/tracker.rb'
- 'lib/mongoid/history/version.rb'
Expand All @@ -53,7 +53,7 @@ Style/Documentation:
- 'spec/integration/nested_embedded_polymorphic_documents_spec.rb'
- 'spec/integration/subclasses_spec.rb'
- 'spec/support/mongoid_history.rb'
- 'spec/unit/services/options_cleaner_spec.rb'
- 'spec/unit/options_spec.rb'
- 'spec/unit/trackable_spec.rb'
- 'spec/unit/tracker_spec.rb'

Expand Down
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ rvm:
- 2.1.1
- 2.0.0
- 1.9.3
- rbx-2
- jruby-19mode

allow_failures:
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

* Your contribution here.

* [#150](https://github.com/aq1018/mongoid-history/pull/150): Added support for keeping embedded objects audit history in parent itself - [@JagdeepSingh](https://github.com/JagdeepSingh).

0.5.0 (2015/09/18)
------------------

Expand Down
2 changes: 1 addition & 1 deletion lib/mongoid/history.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'easy_diff'
require 'mongoid/compatibility'
require 'mongoid/history/services/options_cleaner'
require 'mongoid/history/options'
require 'mongoid/history/version'
require 'mongoid/history/tracker'
require 'mongoid/history/trackable'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Mongoid
module History
class OptionsCleaner
class Options
attr_reader :trackable, :options

def initialize(trackable)
Expand All @@ -23,7 +23,7 @@ def default_options
track_destroy: false }
end

def clean(options = {})
def parse(options = {})
@options = default_options.merge(options)
prepare_skipped_fields
prepare_tracked_fields_and_relations
Expand Down
6 changes: 3 additions & 3 deletions lib/mongoid/history/trackable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ module Trackable

module ClassMethods
def track_history(options = {})
options_cleaner = Mongoid::History::OptionsCleaner.new(self)
options = options_cleaner.clean(options)
options_parser = Mongoid::History::Options.new(self)
options = options_parser.parse(options)

field options[:version_field].to_sym, type: Integer

Expand All @@ -25,7 +25,7 @@ def track_history(options = {})
before_destroy :track_destroy if options[:track_destroy]

Mongoid::History.trackable_class_options ||= {}
Mongoid::History.trackable_class_options[options_cleaner.scope] = options
Mongoid::History.trackable_class_options[options_parser.scope] = options
end

def track_history?
Expand Down
226 changes: 116 additions & 110 deletions spec/unit/services/options_cleaner_spec.rb → spec/unit/options_spec.rb

Large diffs are not rendered by default.

0 comments on commit 50de994

Please sign in to comment.