#345: fixed product_build_list_spec, mass_build_spec
This commit is contained in:
parent
a63f5d47b2
commit
87fc8fca16
|
@ -3,7 +3,7 @@ FactoryGirl.define do
|
||||||
association :save_to_platform, factory: :platform
|
association :save_to_platform, factory: :platform
|
||||||
association :user
|
association :user
|
||||||
projects_list "first"
|
projects_list "first"
|
||||||
arches { [ Arch.find_or_create_by(name: 'x86_64').id ] }
|
arches { [ Arch.where(name: 'x86_64').first_or_create.id ] }
|
||||||
auto_publish true
|
auto_publish true
|
||||||
stop_build false
|
stop_build false
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,9 +4,9 @@ describe MassBuild do
|
||||||
before { stub_symlink_methods }
|
before { stub_symlink_methods }
|
||||||
|
|
||||||
context 'ensures that validations and associations exist' do
|
context 'ensures that validations and associations exist' do
|
||||||
before do
|
|
||||||
# Need for validate_uniqueness_of check
|
it 'is valid given valid attributes' do
|
||||||
FactoryGirl.create(:mass_build)
|
FactoryGirl.create(:mass_build).should be_true
|
||||||
end
|
end
|
||||||
|
|
||||||
it { should belong_to(:build_for_platform) }
|
it { should belong_to(:build_for_platform) }
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe ProductBuildList do
|
describe ProductBuildList do
|
||||||
before do
|
before { stub_symlink_methods }
|
||||||
stub_symlink_methods
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'validates' do
|
context 'ensures that validations and associations exist' do
|
||||||
before do
|
before do
|
||||||
arch = double(:arch, id: 123, name: 'x86_64')
|
arch = double(:arch, id: 123, name: 'x86_64')
|
||||||
allow(Arch).to receive(:find_by).with(name: 'x86_64').and_return(arch)
|
allow(Arch).to receive(:find_by).with(name: 'x86_64').and_return(arch)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'is valid given valid attributes' do
|
it 'is valid given valid attributes' do
|
||||||
FactoryGirl.build(:product_build_list).should be_valid
|
arch = FactoryGirl.create(:arch, name: 'x86_64')
|
||||||
|
allow(Arch).to receive(:find_by).with(name: 'x86_64').and_return(arch)
|
||||||
|
FactoryGirl.create(:product_build_list).should be_true
|
||||||
end
|
end
|
||||||
|
|
||||||
it { should belong_to(:product) }
|
it { should belong_to(:product) }
|
||||||
|
@ -20,14 +20,14 @@ describe ProductBuildList do
|
||||||
it { should ensure_length_of(:main_script).is_at_most(255) }
|
it { should ensure_length_of(:main_script).is_at_most(255) }
|
||||||
it { should ensure_length_of(:params).is_at_most(255) }
|
it { should ensure_length_of(:params).is_at_most(255) }
|
||||||
|
|
||||||
it { should validate_presence_of(:product_id)}
|
it { should validate_presence_of(:product_id) }
|
||||||
it { should validate_presence_of(:status)}
|
it { should validate_presence_of(:status) }
|
||||||
|
|
||||||
ProductBuildList::STATUSES.each do |value|
|
ProductBuildList::STATUSES.each do |value|
|
||||||
it {should allow_value(value).for(:status)}
|
it { should allow_value(value).for(:status) }
|
||||||
end
|
end
|
||||||
|
|
||||||
it {should_not allow_value(555).for(:status)}
|
it { should_not allow_value(555).for(:status) }
|
||||||
|
|
||||||
it { should have_readonly_attribute(:product_id) }
|
it { should have_readonly_attribute(:product_id) }
|
||||||
#it { should_not allow_mass_assignment_of(:product_id) }
|
#it { should_not allow_mass_assignment_of(:product_id) }
|
||||||
|
|
Loading…
Reference in New Issue