45 lines
1.1 KiB
Ruby
45 lines
1.1 KiB
Ruby
require 'test_helper'
|
|
|
|
class GithubRepositoryControllerTest < ActionDispatch::IntegrationTest
|
|
test 'should not save repository without data' do
|
|
repository = GithubRepository.new
|
|
assert_not repository.save
|
|
end
|
|
|
|
test 'should not save repository without software_id' do
|
|
data = { name: 'test/test' }
|
|
repository = GithubRepository.new(data)
|
|
|
|
assert_not repository.save
|
|
end
|
|
|
|
test 'should not save repository if a repository already exist' do
|
|
data = {
|
|
name: 'test/test',
|
|
software_id: Software.find_by_name('Ruby on Rails').id
|
|
}
|
|
repository = GithubRepository.new(data)
|
|
|
|
assert_not repository.save
|
|
end
|
|
|
|
test 'should not save repository if a repository with the same name exist' do
|
|
data = {
|
|
name: 'rails/rails',
|
|
software_id: Software.find_by_name('Kaiho').id
|
|
}
|
|
repository = GithubRepository.new(data)
|
|
|
|
assert_not repository.save
|
|
end
|
|
|
|
test 'should save repository' do
|
|
data = {
|
|
name: 'kaiho/kaiho',
|
|
software_id: Software.find_by_name('Kaiho').id
|
|
}
|
|
repository = GithubRepository.new(data)
|
|
|
|
assert repository.save
|
|
end
|
|
end
|