mirror of
https://github.com/internetee/registry.git
synced 2025-08-06 01:35:10 +02:00
Added pricelist to admin #2380
This commit is contained in:
parent
a262e1e708
commit
4b5243585d
101 changed files with 3155 additions and 76 deletions
63
spec/models/pricelist_spec.rb
Normal file
63
spec/models/pricelist_spec.rb
Normal file
|
@ -0,0 +1,63 @@
|
|||
require 'rails_helper'
|
||||
|
||||
describe Pricelist do
|
||||
before :all do
|
||||
end
|
||||
|
||||
context 'about class' do
|
||||
end
|
||||
|
||||
context 'with invalid attribute' do
|
||||
before :all do
|
||||
@pricelist = Pricelist.new
|
||||
end
|
||||
|
||||
it 'should not be valid' do
|
||||
@pricelist.valid?
|
||||
@pricelist.errors.full_messages.should match_array([
|
||||
"Valid from is missing",
|
||||
"Active until is missing",
|
||||
"Category is missing"
|
||||
])
|
||||
end
|
||||
|
||||
it 'should not have creator' do
|
||||
@pricelist.creator.should == nil
|
||||
end
|
||||
|
||||
it 'should not have updater' do
|
||||
@pricelist.updator.should == nil
|
||||
end
|
||||
|
||||
it 'should not have any versions' do
|
||||
@pricelist.versions.should == []
|
||||
end
|
||||
end
|
||||
|
||||
context 'with valid attributes' do
|
||||
before :all do
|
||||
@pricelist = Fabricate(:pricelist)
|
||||
end
|
||||
|
||||
it 'should be valid' do
|
||||
@pricelist.valid?
|
||||
@pricelist.errors.full_messages.should match_array([])
|
||||
end
|
||||
|
||||
it 'should be valid twice' do
|
||||
@pricelist = Fabricate(:pricelist)
|
||||
@pricelist.valid?
|
||||
@pricelist.errors.full_messages.should match_array([])
|
||||
end
|
||||
|
||||
it 'should have one version' do
|
||||
with_versioning do
|
||||
@pricelist.versions.reload.should == []
|
||||
@pricelist.name = 'New name'
|
||||
@pricelist.save
|
||||
@pricelist.errors.full_messages.should match_array([])
|
||||
@pricelist.versions.size.should == 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue