neogit/spec/spec_helper.rb
2024-09-02 22:38:54 +02:00

49 lines
1.2 KiB
Ruby

# frozen_string_literal: true
require "tmpdir"
require "git"
require "neovim"
require "debug"
require "active_support/all"
ENV["GIT_CONFIG_GLOBAL"] = ""
PROJECT_DIR = File.expand_path(File.join(__dir__, ".."))
Dir[File.join(File.expand_path("."), "spec", "support", "**", "*.rb")].each { |f| require f }
RSpec.configure do |config|
config.expect_with :rspec do |expectations|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end
config.mock_with :rspec do |mocks|
mocks.verify_partial_doubles = true
end
config.shared_context_metadata_behavior = :apply_to_host_groups
config.filter_run_when_matching :focus
config.example_status_persistence_file_path = "spec/examples.txt"
config.disable_monkey_patching!
config.warnings = true
config.profile_examples = 10
config.order = :random
config.include Helpers
config.around do |example|
with_remote = example.metadata.fetch(:with_remote_origin, false)
Dir.mktmpdir do |local|
Dir.mktmpdir do |remote|
Git.init(remote, { bare: true }) if with_remote
Dir.chdir(local) do
local_repo = Git.init
local_repo.add_remote("origin", remote) if with_remote
example.run
end
end
end
end
end