Merge branch 'master' of github.com:domify/registry

This commit is contained in:
Martin Lensment 2015-06-09 16:03:20 +03:00
commit ac886fb4cb
8 changed files with 64 additions and 52 deletions

View file

@ -1,5 +1,8 @@
Fabricator(:pricelist) do
active_from 1.year.ago
active_until 1.year.since
valid_from 1.year.ago
valid_to 1.year.since
category '.ee'
duration '1year'
operation_category 'new'
price 10
end

View file

@ -15,9 +15,9 @@ describe Pricelist do
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"
"Category is missing",
"Duration is missing",
"Operation category is missing"
])
end
@ -32,6 +32,11 @@ describe Pricelist do
it 'should not have any versions' do
@pricelist.versions.should == []
end
it 'should not have name' do
@pricelist.name.should == ' '
end
end
context 'with valid attributes' do
@ -50,10 +55,14 @@ describe Pricelist do
@pricelist.errors.full_messages.should match_array([])
end
it 'should have name' do
@pricelist.name.should == 'new .ee'
end
it 'should have one version' do
with_versioning do
@pricelist.versions.reload.should == []
@pricelist.name = 'New name'
@pricelist.price = 11
@pricelist.save
@pricelist.errors.full_messages.should match_array([])
@pricelist.versions.size.should == 1