#345: fixed product_build_list_spec
This commit is contained in:
parent
57e167f1f2
commit
a63f5d47b2
|
@ -3,7 +3,16 @@ require 'spec_helper'
|
|||
describe ProductBuildList do
|
||||
before do
|
||||
stub_symlink_methods
|
||||
FactoryGirl.create(:product_build_list)
|
||||
end
|
||||
|
||||
context 'validates' do
|
||||
before do
|
||||
arch = double(:arch, id: 123, name: 'x86_64')
|
||||
allow(Arch).to receive(:find_by).with(name: 'x86_64').and_return(arch)
|
||||
end
|
||||
|
||||
it 'is valid given valid attributes' do
|
||||
FactoryGirl.build(:product_build_list).should be_valid
|
||||
end
|
||||
|
||||
it { should belong_to(:product) }
|
||||
|
@ -25,10 +34,13 @@ describe ProductBuildList do
|
|||
|
||||
it { should allow_mass_assignment_of(:status) }
|
||||
it { should allow_mass_assignment_of(:base_url) }
|
||||
end
|
||||
|
||||
# see app/ability.rb
|
||||
# can :read, ProductBuildList#, product: {platform: {visibility: 'open'}} # double nested hash don't work
|
||||
it 'should generate correct sql to get product build lists' do
|
||||
FactoryGirl.create(:arch, name: 'x86_64')
|
||||
FactoryGirl.create(:product_build_list)
|
||||
user = FactoryGirl.create(:user)
|
||||
ability = Ability.new user
|
||||
ProductBuildList.accessible_by(ability).count.should == 1
|
||||
|
|
Loading…
Reference in New Issue