simple_approvals-rspec 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.editorconfig +15 -0
- data/.gitignore +29 -0
- data/.rubocop.yml +33 -0
- data/Gemfile +2 -0
- data/README.md +4 -0
- data/VERSION +1 -0
- data/rakefile.rb +27 -0
- data/simple_approvals-rspec.gemspec +26 -0
- data/spec/approvals_spec.rb +36 -0
- data/spec/fixtures/can_auto_approve_results +1 -0
- data/spec/fixtures/should_approve_results +1 -0
- data/spec/spec_helper.rb +101 -0
- metadata +157 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4e2e3a41c97872f37428ff9dc44e86becacd83ba
|
4
|
+
data.tar.gz: 15104883ac71a90c8670dc15f0d549b2178b92c7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 294ce8d01218ee94a413826da21af7470e75d4091cbb3edfb5f1c6171513aa3468353dc3555b7df2ac7b220d5d0b6340f8ddae0df3bc7cbc9a7b3622afc3304f
|
7
|
+
data.tar.gz: 5f63a3bf3474a88b1d98e9f45762dd9dd0b2b358aceb8273ee8f66c82f03715cb455d7d6eba4ed3dc3c0d5476d4fc69a33b089019a70f6c14231fed236abe206
|
data/.editorconfig
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# top-most EditorConfig file
|
2
|
+
root = true
|
3
|
+
|
4
|
+
# Unix-style newlines with a newline ending every file
|
5
|
+
[*]
|
6
|
+
end_of_line = lf
|
7
|
+
insert_final_newline = true
|
8
|
+
|
9
|
+
[*.rb]
|
10
|
+
indent_style = space
|
11
|
+
indent_size = 2
|
12
|
+
|
13
|
+
[*.json]
|
14
|
+
indent_style = space
|
15
|
+
indent_size = 2
|
data/.gitignore
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
InstalledFiles
|
7
|
+
_yardoc
|
8
|
+
coverage
|
9
|
+
doc/
|
10
|
+
lib/bundler/man
|
11
|
+
pkg
|
12
|
+
rdoc
|
13
|
+
spec/reports
|
14
|
+
test/tmp
|
15
|
+
test/version_tmp
|
16
|
+
tmp
|
17
|
+
.idea/*
|
18
|
+
*.swp
|
19
|
+
*Gemfile.lock
|
20
|
+
.DS_Store
|
21
|
+
.gradle/
|
22
|
+
archive*
|
23
|
+
build/*
|
24
|
+
*.pyc
|
25
|
+
node_modules/
|
26
|
+
rubocop.html
|
27
|
+
tags
|
28
|
+
.fingerprint
|
29
|
+
LOGFILE_*
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
AllCops:
|
3
|
+
Exclude:
|
4
|
+
- 'vendor/**/*'
|
5
|
+
- 'spec/fixtures/**/*'
|
6
|
+
- 'spec/spec_helper.rb'
|
7
|
+
- 'rakefile.rb'
|
8
|
+
# - 'simple_approvals.gemspec'
|
9
|
+
# - 'Gemfile'
|
10
|
+
# - 'example/rakefile.rb'
|
11
|
+
# - 'example/Gemfile'
|
12
|
+
# - 'example/**/*'
|
13
|
+
# - 'spec/**/*'
|
14
|
+
Style/Encoding:
|
15
|
+
Enabled: true
|
16
|
+
|
17
|
+
SignalException:
|
18
|
+
EnforcedStyle: only_raise
|
19
|
+
|
20
|
+
CaseIndentation:
|
21
|
+
EnforcedStyle: end
|
22
|
+
|
23
|
+
Metrics/ClassLength:
|
24
|
+
Enabled: false
|
25
|
+
|
26
|
+
Metrics/MethodLength:
|
27
|
+
Enabled: false
|
28
|
+
|
29
|
+
Metrics/LineLength:
|
30
|
+
Enabled: false
|
31
|
+
|
32
|
+
Metrics/ParameterLists:
|
33
|
+
Max: 6
|
data/Gemfile
ADDED
data/README.md
ADDED
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.0.0
|
data/rakefile.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
$: << './'
|
3
|
+
|
4
|
+
require 'rubygems'
|
5
|
+
require 'bundler/setup'
|
6
|
+
|
7
|
+
require 'version_bumper'
|
8
|
+
require 'bundler'
|
9
|
+
require 'bundler/gem_helper'
|
10
|
+
require 'geminabox_client'
|
11
|
+
|
12
|
+
module SimpleApprovals
|
13
|
+
# Helper for setting version
|
14
|
+
module RSpec
|
15
|
+
# Helper for setting version
|
16
|
+
class GemHelper < Bundler::GemHelper
|
17
|
+
def reload_version
|
18
|
+
@gemspec.version = SimpleApprovals::RSpec.gem_version
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# The current version of the gem
|
23
|
+
def self.gem_version
|
24
|
+
File.read('VERSION').strip
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
|
4
|
+
Gem::Specification.new do |spec|
|
5
|
+
spec.name = 'simple_approvals-rspec'
|
6
|
+
spec.version = File.exist?('VERSION') ? File.read('VERSION').strip : ''
|
7
|
+
spec.authors = ['David Alpert']
|
8
|
+
spec.email = ['david@spinthemoose.com']
|
9
|
+
spec.description = 'a simple rspec-based implementation of the ApprovalTests pattern'
|
10
|
+
spec.summary = ''
|
11
|
+
spec.homepage = 'https://github.com/davidalpert/simple_approvals-rspec/'
|
12
|
+
|
13
|
+
spec.files = `git ls-files -z`.split("\x0").delete_if { |value| value.include?('lib') }
|
14
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
15
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
16
|
+
spec.require_paths = ['lib']
|
17
|
+
|
18
|
+
spec.add_development_dependency 'bundler'
|
19
|
+
spec.add_development_dependency 'geminabox'
|
20
|
+
# spec.add_development_dependency "gemspec"
|
21
|
+
spec.add_development_dependency 'rake'
|
22
|
+
spec.add_development_dependency 'rspec'
|
23
|
+
spec.add_development_dependency 'rubocop'
|
24
|
+
spec.add_development_dependency 'version_bumper'
|
25
|
+
spec.add_dependency 'json', '= 2.1.0' # 2.2.0 fails on windows - requires more investigation
|
26
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'simple_approvals/rspec'
|
2
|
+
|
3
|
+
describe 'simple_approvals/rspec' do
|
4
|
+
# if 'spec/fixtures/should_approve_results' does not exist
|
5
|
+
# you will see something like:
|
6
|
+
# Failures:
|
7
|
+
#
|
8
|
+
# 1) simple_approvals/rspec should approve results
|
9
|
+
# Failure/Error: ::RSpec::Expectations.fail_with message, expected_content, received_content
|
10
|
+
#
|
11
|
+
# Approval failed to match "spec/fixtures/should_approve_results"
|
12
|
+
# - writing received content to: "spec/fixtures/should_approve_results.received"
|
13
|
+
# ./lib/simple_approvals/rspec/approvals.rb:65:in `raise_verify_error_with_diff'
|
14
|
+
# ./lib/simple_approvals/rspec/approvals.rb:16:in `verify'
|
15
|
+
# ./spec/approvals_spec.rb:6:in `block (2 levels) in <top (required)>'
|
16
|
+
#
|
17
|
+
# rename the generated 'spec/fixtures/should_approve_results.received'
|
18
|
+
# to the expected path 'spec/fixtures/should_approve_results'
|
19
|
+
# to represent that this is the "approved" version and the test will pass.
|
20
|
+
#
|
21
|
+
it 'should approve results' do
|
22
|
+
some_test_output = "Shiny, cap'n!"
|
23
|
+
Approvals.verify(some_test_output, 'spec/fixtures/should_approve_results')
|
24
|
+
end
|
25
|
+
|
26
|
+
# if you don't have the expected 'spec/fixtures/can_auto_approve_results' file
|
27
|
+
# or you have it but with different content and you know that you want to
|
28
|
+
# approve the new content you can add an "approve_all: true" argument and the
|
29
|
+
# content being verified will be pre-written to the approved path so that the
|
30
|
+
# compare will come out positive.
|
31
|
+
#
|
32
|
+
it 'can auto-approve results' do
|
33
|
+
some_test_output = "who's flying this thing?"
|
34
|
+
Approvals.verify(some_test_output, 'spec/fixtures/can_auto_approve_results', approve_all: true)
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
who's flying this thing?
|
@@ -0,0 +1 @@
|
|
1
|
+
Shiny, cap'n!
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
4
|
+
# this file to always be loaded, without a need to explicitly require it in any
|
5
|
+
# files.
|
6
|
+
#
|
7
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
8
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
9
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
10
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
11
|
+
# a separate helper file that requires the additional dependencies and performs
|
12
|
+
# the additional setup, and require it from the spec files that actually need
|
13
|
+
# it.
|
14
|
+
#
|
15
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
16
|
+
# users commonly want.
|
17
|
+
#
|
18
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
19
|
+
SimpleCov.start do
|
20
|
+
add_filter '/spec/'
|
21
|
+
end
|
22
|
+
SimpleCov.minimum_coverage 80
|
23
|
+
|
24
|
+
RSpec.configure do |config|
|
25
|
+
# rspec-expectations config goes here. You can use an alternate
|
26
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
27
|
+
# assertions if you prefer.
|
28
|
+
config.expect_with :rspec do |expectations|
|
29
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
30
|
+
# and `failure_message` of custom matchers include text for helper methods
|
31
|
+
# defined using `chain`, e.g.:
|
32
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
33
|
+
# # => "be bigger than 2 and smaller than 4"
|
34
|
+
# ...rather than:
|
35
|
+
# # => "be bigger than 2"
|
36
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
37
|
+
end
|
38
|
+
|
39
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
40
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
41
|
+
config.mock_with :rspec do |mocks|
|
42
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
43
|
+
# a real object. This is generally recommended, and will default to
|
44
|
+
# `true` in RSpec 4.
|
45
|
+
mocks.verify_partial_doubles = true
|
46
|
+
end
|
47
|
+
|
48
|
+
# The settings below are suggested to provide a good initial experience
|
49
|
+
# with RSpec, but feel free to customize to your heart's content.
|
50
|
+
=begin
|
51
|
+
# These two settings work together to allow you to limit a spec run
|
52
|
+
# to individual examples or groups you care about by tagging them with
|
53
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
54
|
+
# get run.
|
55
|
+
config.filter_run :focus
|
56
|
+
config.run_all_when_everything_filtered = true
|
57
|
+
|
58
|
+
# Allows RSpec to persist some state between runs in order to support
|
59
|
+
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
60
|
+
# you configure your source control system to ignore this file.
|
61
|
+
config.example_status_persistence_file_path = "spec/examples.txt"
|
62
|
+
|
63
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
64
|
+
# recommended. For more details, see:
|
65
|
+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
66
|
+
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
67
|
+
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
|
68
|
+
config.disable_monkey_patching!
|
69
|
+
|
70
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
71
|
+
# be too noisy due to issues in dependencies.
|
72
|
+
config.warnings = true
|
73
|
+
|
74
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
75
|
+
# file, and it's useful to allow more verbose output when running an
|
76
|
+
# individual spec file.
|
77
|
+
if config.files_to_run.one?
|
78
|
+
# Use the documentation formatter for detailed output,
|
79
|
+
# unless a formatter has already been configured
|
80
|
+
# (e.g. via a command-line flag).
|
81
|
+
config.default_formatter = 'doc'
|
82
|
+
end
|
83
|
+
|
84
|
+
# Print the 10 slowest examples and example groups at the
|
85
|
+
# end of the spec run, to help surface which specs are running
|
86
|
+
# particularly slow.
|
87
|
+
config.profile_examples = 10
|
88
|
+
|
89
|
+
# Run specs in random order to surface order dependencies. If you find an
|
90
|
+
# order dependency and want to debug it, you can fix the order by providing
|
91
|
+
# the seed, which is printed after each run.
|
92
|
+
# --seed 1234
|
93
|
+
config.order = :random
|
94
|
+
|
95
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
96
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
97
|
+
# test failures related to randomization by passing the same `--seed` value
|
98
|
+
# as the one that triggered the failure.
|
99
|
+
Kernel.srand config.seed
|
100
|
+
=end
|
101
|
+
end
|
metadata
ADDED
@@ -0,0 +1,157 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: simple_approvals-rspec
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- David Alpert
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-03-18 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: geminabox
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: version_bumper
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: json
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 2.1.0
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 2.1.0
|
111
|
+
description: a simple rspec-based implementation of the ApprovalTests pattern
|
112
|
+
email:
|
113
|
+
- david@spinthemoose.com
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- ".editorconfig"
|
119
|
+
- ".gitignore"
|
120
|
+
- ".rubocop.yml"
|
121
|
+
- Gemfile
|
122
|
+
- README.md
|
123
|
+
- VERSION
|
124
|
+
- rakefile.rb
|
125
|
+
- simple_approvals-rspec.gemspec
|
126
|
+
- spec/approvals_spec.rb
|
127
|
+
- spec/fixtures/can_auto_approve_results
|
128
|
+
- spec/fixtures/should_approve_results
|
129
|
+
- spec/spec_helper.rb
|
130
|
+
homepage: https://github.com/davidalpert/simple_approvals-rspec/
|
131
|
+
licenses: []
|
132
|
+
metadata: {}
|
133
|
+
post_install_message:
|
134
|
+
rdoc_options: []
|
135
|
+
require_paths:
|
136
|
+
- lib
|
137
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
138
|
+
requirements:
|
139
|
+
- - ">="
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
142
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - ">="
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: '0'
|
147
|
+
requirements: []
|
148
|
+
rubyforge_project:
|
149
|
+
rubygems_version: 2.6.11
|
150
|
+
signing_key:
|
151
|
+
specification_version: 4
|
152
|
+
summary: ''
|
153
|
+
test_files:
|
154
|
+
- spec/approvals_spec.rb
|
155
|
+
- spec/fixtures/can_auto_approve_results
|
156
|
+
- spec/fixtures/should_approve_results
|
157
|
+
- spec/spec_helper.rb
|