Test ModerationModel methods
parent
d9b99bb6e7
commit
7612d2f45e
|
@ -8,7 +8,7 @@ describe TheModerator::Model do
|
||||||
subject.moderate(:name)
|
subject.moderate(:name)
|
||||||
|
|
||||||
expect(subject.moderations).to have(1).moderation
|
expect(subject.moderations).to have(1).moderation
|
||||||
expect(subject.name).to eq(nil)
|
expect(subject.name).to be_nil
|
||||||
expect(subject.content).to eq('Content')
|
expect(subject.content).to eq('Content')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe TheModerator::ModerationModel do
|
||||||
|
subject do
|
||||||
|
page = Page.new(name: 'Name', content: 'Content')
|
||||||
|
moderation = page.moderate(:name)
|
||||||
|
page.save
|
||||||
|
|
||||||
|
moderation
|
||||||
|
end
|
||||||
|
|
||||||
|
describe '#accept' do
|
||||||
|
it 'accepts moderated data' do
|
||||||
|
expect(subject.moderatable.name).to be_nil
|
||||||
|
subject.accept
|
||||||
|
|
||||||
|
expect(subject.moderatable.name).to eq('Name')
|
||||||
|
expect(subject.destroyed?).to be_true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe '#discard' do
|
||||||
|
it 'discards moderated data' do
|
||||||
|
expect(subject.moderatable.name).to be_nil
|
||||||
|
subject.discard
|
||||||
|
|
||||||
|
expect(subject.moderatable.name).to be_nil
|
||||||
|
expect(subject.destroyed?).to be_true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe '#preview' do
|
||||||
|
it 'previews moderated data' do
|
||||||
|
expect(subject.moderatable.name).to be_nil
|
||||||
|
preview = subject.preview
|
||||||
|
|
||||||
|
expect(preview.frozen?).to be_true
|
||||||
|
expect(preview.name).to eq('Name')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe '#include?' do
|
||||||
|
it 'includes name' do
|
||||||
|
expect(subject.include?(:name)).to be_true
|
||||||
|
expect(subject.include?(:content)).to be_false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue