Skip to content

Commit f68d659

Browse files
committed
Update RSpec setup and gitignores
1 parent 3dcc9e3 commit f68d659

13 files changed

+125
-35
lines changed

.gitignore

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
1-
*.gem
2-
.bundle
3-
.ruby-version
4-
Gemfile.lock
5-
coverage
6-
bin/rspec
7-
bin/rake
8-
doc/
9-
lib/bundler/man
10-
/git-tracker
11-
pkg
12-
rdoc
13-
tmp
14-
tags
1+
# Ignore all log/temp/etc... files
2+
/log/
3+
/tmp/
4+
/tags
5+
6+
# Package and dependency caches
7+
/.ruby-version
8+
/.bundle
9+
/Gemfile.lock
10+
/pkg/
11+
12+
# Generated documentation
13+
/.yardoc
14+
/_yardoc/
15+
16+
# Spec reports and failure tracking
17+
/coverage/
18+
/spec/rspec-status.txt
19+
/spec/reports/

.rspec

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
--colour
2-
-I spec/support
3-
-r pry
2+
--require spec_helper

bin/rake

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
#
5+
# This file was generated by Bundler.
6+
#
7+
# The application 'rake' is installed as part of a gem, and
8+
# this file is here to facilitate running it.
9+
#
10+
11+
require "pathname"
12+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13+
Pathname.new(__FILE__).realpath)
14+
15+
bundle_binstub = File.expand_path("../bundle", __FILE__)
16+
17+
if File.file?(bundle_binstub)
18+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19+
load(bundle_binstub)
20+
else
21+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23+
end
24+
end
25+
26+
require "rubygems"
27+
require "bundler/setup"
28+
29+
load Gem.bin_path("rake", "rake")

bin/rspec

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
#
5+
# This file was generated by Bundler.
6+
#
7+
# The application 'rspec' is installed as part of a gem, and
8+
# this file is here to facilitate running it.
9+
#
10+
11+
require "pathname"
12+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13+
Pathname.new(__FILE__).realpath)
14+
15+
bundle_binstub = File.expand_path("../bundle", __FILE__)
16+
17+
if File.file?(bundle_binstub)
18+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19+
load(bundle_binstub)
20+
else
21+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23+
end
24+
end
25+
26+
require "rubygems"
27+
require "bundler/setup"
28+
29+
load Gem.bin_path("rspec-core", "rspec")

git_tracker.gemspec

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,17 @@ Gem::Specification.new do |spec|
2525
# Specify which files should be added to the gem when it is released.
2626
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
2727
spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
28-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
28+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(\.gitignore|\.rspec|\.travis\.yml|bin/|spec/|features/)}) }
2929
end
3030
spec.bindir = "exe"
3131
spec.executables = %w[git-tracker]
3232
spec.require_paths = ["lib"]
3333
spec.platform = Gem::Platform::RUBY
3434

3535
spec.add_development_dependency "activesupport", "~> 6.0"
36-
spec.add_development_dependency "pry", "~> 0.12"
37-
spec.add_development_dependency "rake", "~> 12.0"
38-
spec.add_development_dependency "rspec", "~> 3.8"
36+
spec.add_development_dependency "pry-byebug", "~> 3.9"
37+
spec.add_development_dependency "rake", "~> 13.0"
38+
spec.add_development_dependency "rspec", "~> 3.9"
3939
# Simplecov 0.18+ is currently broken for the cc-test-reporter.
4040
# Until it's fixed, we need to stick to something pre-0.18
4141
# see: https://github.com/codeclimate/test-reporter/issues/413

spec/git_tracker/branch_spec.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
require "spec_helper"
21
require "git_tracker/branch"
32

4-
describe GitTracker::Branch do
3+
RSpec.describe GitTracker::Branch do
54
subject(:branch) { described_class }
65

76
def stub_branch(ref, exit_status = 0)

spec/git_tracker/commit_message_spec.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
require "spec_helper"
21
require "git_tracker/commit_message"
32
require "active_support/core_ext/string/strip"
43

5-
describe GitTracker::CommitMessage do
4+
RSpec.describe GitTracker::CommitMessage do
65
include CommitMessageHelper
76

87
subject(:commit_message) { described_class.new(file) }

spec/git_tracker/hook_spec.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
require "spec_helper"
21
require "git_tracker/hook"
32
require "active_support/core_ext/string/strip"
43

5-
describe GitTracker::Hook do
4+
RSpec.describe GitTracker::Hook do
65
subject(:hook) { described_class }
76
let(:root) { "/path/to/git/repo/toplevel" }
87
let(:hook_path) { File.join(root, ".git", "hooks", "prepare-commit-msg") }

spec/git_tracker/prepare_commit_message_spec.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
require "spec_helper"
21
require "git_tracker/prepare_commit_message"
32

4-
describe GitTracker::PrepareCommitMessage do
3+
RSpec.describe GitTracker::PrepareCommitMessage do
54
subject(:prepare_commit_message) { GitTracker::PrepareCommitMessage }
65

76
describe ".run" do

spec/git_tracker/repository_spec.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
require "spec_helper"
21
require "git_tracker/repository"
32

4-
describe GitTracker::Repository do
3+
RSpec.describe GitTracker::Repository do
54
subject(:repository) { described_class }
65
let(:git_command) { "git rev-parse --show-toplevel" }
76
before do

0 commit comments

Comments
 (0)