feat: add test for github_repository update method

This commit is contained in:
Adrien Waksberg 2018-08-02 23:13:41 +02:00
parent 4e62cb6593
commit 4e0478429c
3 changed files with 26 additions and 1 deletions

View file

@ -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

View file

@ -3,3 +3,7 @@
one:
name: rails/rails
software: two
two:
name: ruby/ruby
software: three

View file

@ -7,3 +7,6 @@ one:
two:
name: Ruby on Rails
website: https://rubyonrails.org
three:
name: Ruby