Skip to content

Commit

Permalink
Remove deprecated: paper_trail_on, paper_trail_off
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredbeck committed Jul 14, 2015
1 parent 5bad080 commit 9ebad0d
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 42 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

### Changed

- Removed deprecated methods `paper_trail_on` and `paper_trail_off`.
Use `paper_trail_on!` and `paper_trail_off!` instead.
- Using a Rails initializer to reopen PaperTrail::Version or otherwise extend
PaperTrail is no longer recommended. An alternative is described in the
readme. See https://github.com/airblade/paper_trail/pull/557 and
Expand Down
10 changes: 0 additions & 10 deletions lib/paper_trail/has_paper_trail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,21 +96,11 @@ def paper_trail_off!
PaperTrail.enabled_for_model(self, false)
end

def paper_trail_off
warn "DEPRECATED: use `paper_trail_off!` instead of `paper_trail_off`. Support for `paper_trail_off` will be removed in PaperTrail 4.0"
self.paper_trail_off!
end

# Switches PaperTrail on for this class.
def paper_trail_on!
PaperTrail.enabled_for_model(self, true)
end

def paper_trail_on
warn "DEPRECATED: use `paper_trail_on!` instead of `paper_trail_on`. Support for `paper_trail_on` will be removed in PaperTrail 4.0"
self.paper_trail_on!
end

def paper_trail_enabled_for_model?
return false unless self.include?(PaperTrail::Model::InstanceMethods)
PaperTrail.enabled_for_model?(self)
Expand Down
32 changes: 0 additions & 32 deletions spec/models/widget_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -282,21 +282,6 @@
end
end

describe '#paper_trail_off' do
it { is_expected.to respond_to(:paper_trail_off) }

it 'should set the invoke `paper_trail_off!`' do
is_expected.to receive(:warn)
is_expected.to receive(:paper_trail_off!)
subject.paper_trail_off
end

it 'should display a deprecation warning' do
is_expected.to receive(:warn).with("DEPRECATED: use `paper_trail_on!` instead of `paper_trail_on`. Support for `paper_trail_on` will be removed in PaperTrail 4.0")
subject.paper_trail_on
end
end

describe '#paper_trail_on!' do
before { subject.paper_trail_off! }

Expand All @@ -308,23 +293,6 @@
expect(subject.paper_trail_enabled_for_model?).to be true
end
end

describe '#paper_trail_on' do
before { subject.paper_trail_off! }

it { is_expected.to respond_to(:paper_trail_on) }

it 'should set the invoke `paper_trail_on!`' do
is_expected.to receive(:warn)
is_expected.to receive(:paper_trail_on!)
subject.paper_trail_on
end

it 'should display a deprecation warning' do
is_expected.to receive(:warn).with("DEPRECATED: use `paper_trail_on!` instead of `paper_trail_on`. Support for `paper_trail_on` will be removed in PaperTrail 4.0")
subject.paper_trail_on
end
end
end
end
end

0 comments on commit 9ebad0d

Please sign in to comment.