mirror of
https://github.com/internetee/registry.git
synced 2025-05-16 09:27:19 +02:00
* Remove factory_girl include from dev rake task
No longer needed after 92b125b4a7
* Add missing factories
* Use FactoryBot factories instead of fabricators
* Remove all fabricators
* Remove unused method
* Remove fabrication gem
* Rename FactoryGirl to FactoryBot
https://robots.thoughtbot.com/factory_bot
47 lines
1 KiB
Ruby
47 lines
1 KiB
Ruby
require 'rails_helper'
|
|
|
|
describe Message do
|
|
context 'with invalid attribute' do
|
|
before :all do
|
|
@mssage = Message.new
|
|
end
|
|
|
|
it 'should not be valid' do
|
|
@mssage.valid?
|
|
@mssage.errors.full_messages.should match_array([
|
|
"Body is missing"
|
|
])
|
|
end
|
|
|
|
it 'should not have any versions' do
|
|
@mssage.versions.should == []
|
|
end
|
|
end
|
|
|
|
context 'with valid attributes' do
|
|
before :all do
|
|
@mssage = create(:message)
|
|
end
|
|
|
|
it 'should be valid' do
|
|
@mssage.valid?
|
|
@mssage.errors.full_messages.should match_array([])
|
|
end
|
|
|
|
it 'should be valid twice' do
|
|
@mssage = create(:message)
|
|
@mssage.valid?
|
|
@mssage.errors.full_messages.should match_array([])
|
|
end
|
|
|
|
it 'should have one version' do
|
|
with_versioning do
|
|
@mssage.versions.should == []
|
|
@mssage.body = 'New body'
|
|
@mssage.save
|
|
@mssage.errors.full_messages.should match_array([])
|
|
@mssage.versions.size.should == 1
|
|
end
|
|
end
|
|
end
|
|
end
|