feat: add test for github_repository update method
This commit is contained in:
parent
4e62cb6593
commit
4e0478429c
3 changed files with 26 additions and 1 deletions
|
@ -23,7 +23,7 @@ class GithubRepositoryControllerTest < ActionDispatch::IntegrationTest
|
|||
assert_not repository.save
|
||||
end
|
||||
|
||||
test 'should not save repository if a repository with the same name exist' do
|
||||
test 'should not save repository if a repository has the same name' do
|
||||
data = {
|
||||
name: 'rails/rails',
|
||||
software_id: Software.find_by_name('Kaiho').id
|
||||
|
@ -42,4 +42,22 @@ class GithubRepositoryControllerTest < ActionDispatch::IntegrationTest
|
|||
|
||||
assert repository.save
|
||||
end
|
||||
|
||||
test 'should not update repository if a repository has the same name' do
|
||||
data = {
|
||||
name: 'rails/rails'
|
||||
}
|
||||
repository = GithubRepository.find_by_name('ruby/ruby')
|
||||
|
||||
assert_not repository.update(data)
|
||||
end
|
||||
|
||||
test 'should update repository' do
|
||||
data = {
|
||||
name: 'rails/rails2'
|
||||
}
|
||||
repository = GithubRepository.find_by_name('rails/rails')
|
||||
|
||||
assert repository.update(data)
|
||||
end
|
||||
end
|
||||
|
|
4
test/fixtures/github_repositories.yml
vendored
4
test/fixtures/github_repositories.yml
vendored
|
@ -3,3 +3,7 @@
|
|||
one:
|
||||
name: rails/rails
|
||||
software: two
|
||||
|
||||
two:
|
||||
name: ruby/ruby
|
||||
software: three
|
||||
|
|
3
test/fixtures/softwares.yml
vendored
3
test/fixtures/softwares.yml
vendored
|
@ -7,3 +7,6 @@ one:
|
|||
two:
|
||||
name: Ruby on Rails
|
||||
website: https://rubyonrails.org
|
||||
|
||||
three:
|
||||
name: Ruby
|
||||
|
|
Loading…
Add table
Reference in a new issue