rosa-build/spec/models/build_list/package_spec.rb

39 lines
901 B
Ruby
Raw Permalink Normal View History

2013-09-12 15:00:41 +01:00
require 'spec_helper'
describe BuildList::Package do
before { stub_symlink_methods }
it 'is valid' do
expect(FactoryGirl.create(:build_list_package)).to be_persisted
2013-09-12 15:00:41 +01:00
end
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
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
expect(package.epoch).to eq 55
2013-09-12 15:00:41 +01:00
end
end
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