feat: add github repository
This commit is contained in:
parent
5154b4b632
commit
97b9a87d26
16 changed files with 172 additions and 3 deletions
test
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
|
5
test/fixtures/github_repositories.yml
vendored
Normal file
5
test/fixtures/github_repositories.yml
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
one:
|
||||
name: rails/rails
|
||||
software: two
|
7
test/models/github_repository_test.rb
Normal file
7
test/models/github_repository_test.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class GithubRepositoryTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
7
test/models/repository_github_test.rb
Normal file
7
test/models/repository_github_test.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class RepositoryGithubTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue