Skip to content

Refactor test scripts and remove duplicate test #751

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions bin/test
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

# This script is used to run the tests for this project.
#
# bundle exec bin/test [test_file_name ...]
#
# If no test file names are provided, all tests in the `tests/units` directory will be run.

require 'bundler/setup'

`git config --global user.email "git@example.com"` if `git config --global user.email`.empty?
Expand Down
17 changes: 17 additions & 0 deletions bin/test-in-docker
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash -e

# This script is used to run the tests for this project in a Docker container.
#
# bin/test-in-docker [test_file_name ...]
#
# If no test file names are provided, all tests in the `tests/units` directory will be run.

cd "$( dirname "${BASH_SOURCE[0]}" )"/..

export COMPOSE_FILE=tests/docker-compose.yml
export COMPOSE_PROJECT_NAME=ruby-git_dev

docker-compose rm -svf
docker-compose build --force-rm

docker-compose run --rm tester "$@" && docker-compose rm -svf || ( docker-compose logs && exit 1 )
11 changes: 0 additions & 11 deletions bin/tests

This file was deleted.

3 changes: 1 addition & 2 deletions tests/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ RUN bundle install

ADD . .

ENTRYPOINT ["bundle", "exec"]
CMD ["bin/test"]
ENTRYPOINT ["bundle", "exec", "bin/test"]
18 changes: 0 additions & 18 deletions tests/units/test_stashes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,6 @@ def test_stash_unstash
end
end

def test_stashes_all
in_bare_repo_clone do |g|
assert_equal(0, g.branch.stashes.size)
new_file('test-file1', 'blahblahblah1')
new_file('test-file2', 'blahblahblah2')
assert(g.status.untracked.assoc('test-file1'))

g.add

assert(g.status.added.assoc('test-file1'))

g.branch.stashes.save('testing-stash-all')

stashes = g.branch.stashes.all

assert(stashes[0].include?('testing-stash-all'))
end
end
test 'Git::Lib#stashes_all' do
in_bare_repo_clone do |g|
assert_equal(0, g.branch.stashes.size)
Expand Down