mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-15 08:31:42 +00:00
38 lines
940 B
Ruby
38 lines
940 B
Ruby
|
# frozen_string_literal: true
|
||
|
|
||
|
class RepositoryTest < ActiveSupport::TestCase
|
||
|
setup do
|
||
|
@rol = create :rol
|
||
|
@site = @rol.site
|
||
|
@usuarie = @rol.usuarie
|
||
|
|
||
|
# Volver al principio para poder traer cambios
|
||
|
Dir.chdir(@site.path) do
|
||
|
`git reset --hard e0627e34c6ef6ae2592d7f289b82def20ba56685`
|
||
|
end
|
||
|
end
|
||
|
|
||
|
teardown do
|
||
|
@site.destroy
|
||
|
end
|
||
|
|
||
|
test 'se pueden traer cambios' do
|
||
|
assert @site.repository.fetch.is_a?(Integer)
|
||
|
end
|
||
|
|
||
|
test 'se pueden mergear los cambios' do
|
||
|
assert !@site.repository.commits.empty?
|
||
|
assert @site.repository.merge(@usuarie)
|
||
|
assert @site.repository.commits.empty?
|
||
|
|
||
|
assert_equal @usuarie.name,
|
||
|
@site.repository.rugged
|
||
|
.branches['master'].target.committer[:name]
|
||
|
|
||
|
Dir.chdir(@site.path) do
|
||
|
assert_equal 'nothing to commit, working tree clean',
|
||
|
`LC_ALL=C git status`.strip.split("\n").last
|
||
|
end
|
||
|
end
|
||
|
end
|