feat: add github repository
This commit is contained in:
parent
5154b4b632
commit
97b9a87d26
16 changed files with 172 additions and 3 deletions
test/controllers
45
test/controllers/github_repository_controller_test.rb
Normal file
45
test/controllers/github_repository_controller_test.rb
Normal file
|
@ -0,0 +1,45 @@
|
|||
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
|
Loading…
Add table
Add a link
Reference in a new issue