2013-09-12 15:00:41 +01:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe BuildList::Package do
|
|
|
|
before { stub_symlink_methods }
|
|
|
|
|
|
|
|
it 'is valid' do
|
2015-06-16 22:00:57 +01:00
|
|
|
expect(FactoryGirl.create(:build_list_package)).to be_persisted
|
2013-09-12 15:00:41 +01:00
|
|
|
end
|
|
|
|
|
2015-06-16 22:00:57 +01:00
|
|
|
|
|
|
|
describe '#set_epoch' do
|
2013-09-12 15:00:41 +01:00
|
|
|
let(:package) { FactoryGirl.build(:build_list_package) }
|
|
|
|
|
|
|
|
['', '(none)'].each do |epoch|
|
|
|
|
it "ensures that epoch is set to nil when epoch is '#{epoch}'" do
|
|
|
|
package.epoch = epoch
|
|
|
|
package.save
|
2015-06-16 22:00:57 +01:00
|
|
|
expect(package.epoch).to be_nil
|
2013-09-12 15:00:41 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
it "ensures that valid epoch has been setted" do
|
|
|
|
package.epoch = '55'
|
|
|
|
package.save
|
2015-06-16 22:00:57 +01:00
|
|
|
expect(package.epoch).to eq 55
|
2013-09-12 15:00:41 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
2015-06-16 22:00:57 +01:00
|
|
|
describe '#dependent_packages=' do
|
|
|
|
it 'sets a packages' do
|
|
|
|
package = FactoryGirl.build(:build_list_package, dependent_packages: 'x y z')
|
|
|
|
expect(package).to be_valid
|
|
|
|
expect(package.dependent_packages).to eq %w(x y z)
|
|
|
|
end
|
|
|
|
end
|
2013-09-12 15:00:41 +01:00
|
|
|
end
|