rosa-build/spec/models/project_to_repository_spec.rb

25 lines
830 B
Ruby
Raw Normal View History

require 'spec_helper'
describe ProjectToRepository do
2014-06-19 20:35:53 +01:00
let(:platform) { FactoryGirl.create(:platform) }
let(:first_repo) { FactoryGirl.create(:repository, platform: platform) }
let(:second_repo) { FactoryGirl.create(:repository, platform: platform) }
let(:project) { FactoryGirl.create(:project) }
before do
stub_symlink_methods
2014-06-19 20:35:53 +01:00
first_repo.projects << project
first_repo.save
end
it 'should not add the same project in different repositories of same platform' do
2014-06-19 20:35:53 +01:00
p2r = second_repo.project_to_repositories.build project: project
expect(p2r).to_not be_valid
end
it 'creates task for removing project from repository on destroy' do
expect(DestroyProjectFromRepositoryJob).to receive(:perform).with(project, first_repo)
2014-06-19 20:35:53 +01:00
first_repo.project_to_repositories.destroy_all
end
end