Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run RSpec specs and features as part of build (#133)
* Import things from personal boilerplate * Add some very simple initial specs
- Loading branch information
Showing
17 changed files
with
173 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,6 @@ | |
/Gemfile.lock | ||
*~ | ||
/pkg | ||
/coverage/.resultset.json | ||
/coverage/assets/ | ||
/coverage/index.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'open3' | ||
|
||
# Add the bin directory, to allow testing of gem executables as if the gem is | ||
# already installed. | ||
root_dir = RSpec::Core::RubyProject.root | ||
exec_dir = File.join(File::SEPARATOR, root_dir, 'bin') | ||
ENV['PATH'] = [exec_dir, ENV['PATH']].join(File::PATH_SEPARATOR) | ||
|
||
# Courtesy of: | ||
# https://raw.github.com/cupakromer/tao-of-tdd/master/adder/spec/support/ | ||
# capture_exec.rb | ||
def exec_io(*cmd) | ||
cmd = cmd.flatten | ||
env = { | ||
# Avoid spurious deprecation warnings in things which are out of | ||
# our control | ||
'RUBYOPT' => '-W0', | ||
} | ||
all_out, _exit_code = Open3.capture2e(env, *cmd) | ||
|
||
all_out | ||
end | ||
|
||
RSpec.configure do |config| | ||
config.filter_run_excluding :wip | ||
config.run_all_when_everything_filtered = true | ||
config.order = 'random' | ||
config.alias_it_should_behave_like_to :has_behavior | ||
config.alias_it_should_behave_like_to :it_has_behavior, 'has behavior:' | ||
end | ||
|
||
def let_double(*doubles) | ||
doubles.each do |double_sym| | ||
let(double_sym) { double(double_sym.to_s) } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# frozen_string_literal: true | ||
|
||
require_relative '../feature_helper' | ||
require 'quality/quality_checker' | ||
|
||
describe Quality::QualityChecker do | ||
it 'has an example feature spec' do | ||
expect(exec_io('echo test')).to eq("test\n") | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
6 | ||
10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# frozen_string_literal: true | ||
|
||
desc 'Run tasks to be done during a continuous integration (CI) build' | ||
task ci: :localtest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# frozen_string_literal: true | ||
|
||
desc 'Standard build' | ||
task default: [:localtest] | ||
task default: :localtest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rspec/core/rake_task' | ||
|
||
desc 'Run features' | ||
RSpec::Core::RakeTask.new(:feature) do |task| | ||
task.pattern = 'feature/**/*_spec.rb' | ||
task.rspec_opts = '--format doc --default-path feature' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# frozen_string_literal: true | ||
|
||
desc 'Standard build when running on a workstation' | ||
task localtest: %i[clear_metrics test quality] | ||
task localtest: %i[clear_metrics spec test feature quality] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rspec/core/rake_task' | ||
|
||
desc 'Run specs' | ||
RSpec::Core::RakeTask.new(:spec) do |task| | ||
task.pattern = 'spec/**/*_spec.rb' | ||
task.rspec_opts = '--format doc' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# frozen_string_literal: true | ||
|
||
require_relative '../../spec_helper' | ||
require 'quality/tools/bigfiles' | ||
require 'quality/runner' | ||
|
||
describe Quality::Tools::Bigfiles do | ||
let(:runner) { instance_double(Quality::Runner) } | ||
let(:bigfiles) { described_class.new(runner) } | ||
|
||
it 'can be created' do | ||
expect(bigfiles).not_to be(nil) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'simplecov' | ||
|
||
SimpleCov.start do | ||
# this dir used by TravisCI | ||
add_filter 'vendor' | ||
end | ||
|
||
RSpec.configure do |config| | ||
config.order = 'random' | ||
config.expect_with :rspec do |c| | ||
c.syntax = :expect | ||
end | ||
end |