specdiff 0.3.0.pre.rc1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +14 -0
- data/CHANGELOG.md +21 -1
- data/DEVELOPMENT.md +74 -0
- data/README.md +138 -98
- data/glossary.txt +4 -0
- data/lib/specdiff/compare.rb +2 -2
- data/lib/specdiff/diff.rb +10 -7
- data/lib/specdiff/differ/{hashdiff.rb → hash.rb} +53 -34
- data/lib/specdiff/differ.rb +1 -1
- data/lib/specdiff/hashprint.rb +82 -55
- data/lib/specdiff/inspect.rb +94 -1
- data/lib/specdiff/rspec.rb +8 -13
- data/lib/specdiff/version.rb +1 -1
- data/lib/specdiff/webmock.rb +5 -2
- data/lib/specdiff.rb +0 -5
- data/specdiff.gemspec +17 -10
- metadata +19 -29
- data/.rspec +0 -3
- data/.rubocop.yml +0 -203
- data/.tool-versions +0 -1
- data/Gemfile +0 -12
- data/Gemfile.lock +0 -76
- data/Rakefile +0 -12
- data/assets/webmock_json_with_specdiff.png +0 -0
- data/assets/webmock_text_with_specdiff.png +0 -0
- data/examples/rspec/.rspec +0 -2
- data/examples/rspec/Gemfile +0 -10
- data/examples/rspec/Gemfile.lock +0 -52
- data/examples/rspec/spec/example_spec.rb +0 -678
- data/examples/rspec/spec/spec_helper.rb +0 -68
- data/examples/webmock/Gemfile +0 -6
- data/examples/webmock/Gemfile.lock +0 -50
- data/examples/webmock/json.rb +0 -37
- data/examples/webmock/text.rb +0 -39
@@ -1,68 +0,0 @@
|
|
1
|
-
Bundler.require
|
2
|
-
require "specdiff/rspec"
|
3
|
-
|
4
|
-
RSpec.configure do |config|
|
5
|
-
# rspec-expectations config goes here. You can use an alternate
|
6
|
-
# assertion/expectation library such as wrong or the stdlib/minitest
|
7
|
-
# assertions if you prefer.
|
8
|
-
config.expect_with :rspec do |expectations|
|
9
|
-
# This option will default to `true` in RSpec 4. It makes the `description`
|
10
|
-
# and `failure_message` of custom matchers include text for helper methods
|
11
|
-
# defined using `chain`, e.g.:
|
12
|
-
# be_bigger_than(2).and_smaller_than(4).description
|
13
|
-
# # => "be bigger than 2 and smaller than 4"
|
14
|
-
# ...rather than:
|
15
|
-
# # => "be bigger than 2"
|
16
|
-
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
17
|
-
|
18
|
-
expectations.syntax = :expect
|
19
|
-
end
|
20
|
-
|
21
|
-
# rspec-mocks config goes here. You can use an alternate test double
|
22
|
-
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
23
|
-
config.mock_with :rspec do |mocks|
|
24
|
-
# Prevents you from mocking or stubbing a method that does not exist on
|
25
|
-
# a real object. This is generally recommended, and will default to
|
26
|
-
# `true` in RSpec 4.
|
27
|
-
mocks.verify_partial_doubles = true
|
28
|
-
end
|
29
|
-
|
30
|
-
# This option will default to `:apply_to_host_groups` in RSpec 4 (and will
|
31
|
-
# have no way to turn it off -- the option exists only for backwards
|
32
|
-
# compatibility in RSpec 3). It causes shared context metadata to be
|
33
|
-
# inherited by the metadata hash of host groups and examples, rather than
|
34
|
-
# triggering implicit auto-inclusion in groups with matching metadata.
|
35
|
-
config.shared_context_metadata_behavior = :apply_to_host_groups
|
36
|
-
|
37
|
-
# enable test focusing
|
38
|
-
config.filter_run_when_matching :focus
|
39
|
-
|
40
|
-
# Enable flags like --only-failures and --next-failure
|
41
|
-
config.example_status_persistence_file_path = ".rspec_status"
|
42
|
-
|
43
|
-
# Limits the available syntax to the non-monkey patched syntax that is
|
44
|
-
# recommended. For more details, see:
|
45
|
-
# https://rspec.info/features/3-12/rspec-core/configuration/zero-monkey-patching-mode/
|
46
|
-
config.disable_monkey_patching!
|
47
|
-
|
48
|
-
# This setting enables warnings. It's recommended, but in some cases may
|
49
|
-
# be too noisy due to issues in dependencies.
|
50
|
-
config.warnings = true
|
51
|
-
|
52
|
-
# Many RSpec users commonly either run the entire suite or an individual
|
53
|
-
# file, and it's useful to allow more verbose output when running an
|
54
|
-
# individual spec file.
|
55
|
-
if config.files_to_run.one?
|
56
|
-
# Use the documentation formatter for detailed output,
|
57
|
-
# unless a formatter has already been configured
|
58
|
-
# (e.g. via a command-line flag).
|
59
|
-
config.default_formatter = "doc"
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
class MyBasicObjectClass < BasicObject
|
64
|
-
end
|
65
|
-
|
66
|
-
class ConstantForTheSolePurposeOfUndefiningInspect
|
67
|
-
undef_method :inspect
|
68
|
-
end
|
data/examples/webmock/Gemfile
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: ../..
|
3
|
-
specs:
|
4
|
-
specdiff (0.3.0.pre.rc1)
|
5
|
-
diff-lcs (~> 1.5)
|
6
|
-
hashdiff (~> 1.0)
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: https://rubygems.org/
|
10
|
-
specs:
|
11
|
-
addressable (2.8.5)
|
12
|
-
public_suffix (>= 2.0.2, < 6.0)
|
13
|
-
crack (0.4.5)
|
14
|
-
rexml
|
15
|
-
diff-lcs (1.5.1)
|
16
|
-
domain_name (0.6.20231109)
|
17
|
-
ffi (1.16.3)
|
18
|
-
ffi-compiler (1.0.1)
|
19
|
-
ffi (>= 1.0.0)
|
20
|
-
rake
|
21
|
-
hashdiff (1.0.1)
|
22
|
-
http (5.1.1)
|
23
|
-
addressable (~> 2.8)
|
24
|
-
http-cookie (~> 1.0)
|
25
|
-
http-form_data (~> 2.2)
|
26
|
-
llhttp-ffi (~> 0.4.0)
|
27
|
-
http-cookie (1.0.5)
|
28
|
-
domain_name (~> 0.5)
|
29
|
-
http-form_data (2.3.0)
|
30
|
-
llhttp-ffi (0.4.0)
|
31
|
-
ffi-compiler (~> 1.0)
|
32
|
-
rake (~> 13.0)
|
33
|
-
public_suffix (5.0.4)
|
34
|
-
rake (13.1.0)
|
35
|
-
rexml (3.2.6)
|
36
|
-
webmock (3.19.1)
|
37
|
-
addressable (>= 2.8.0)
|
38
|
-
crack (>= 0.3.2)
|
39
|
-
hashdiff (>= 0.4.0, < 2.0.0)
|
40
|
-
|
41
|
-
PLATFORMS
|
42
|
-
x86_64-linux
|
43
|
-
|
44
|
-
DEPENDENCIES
|
45
|
-
http
|
46
|
-
specdiff!
|
47
|
-
webmock
|
48
|
-
|
49
|
-
BUNDLED WITH
|
50
|
-
2.3.5
|
data/examples/webmock/json.rb
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
require "webmock"
|
2
|
-
require "specdiff"
|
3
|
-
require "specdiff/webmock"
|
4
|
-
|
5
|
-
Specdiff.load!(:json)
|
6
|
-
|
7
|
-
include WebMock::API
|
8
|
-
|
9
|
-
WebMock.enable!
|
10
|
-
WebMock.show_body_diff! # on by default
|
11
|
-
|
12
|
-
stub_request(:post, "https://www.example.com")
|
13
|
-
.with(
|
14
|
-
body: JSON.generate({
|
15
|
-
my_hash: "is great",
|
16
|
-
the_hash: "is amazing",
|
17
|
-
})
|
18
|
-
)
|
19
|
-
.to_return(status: 400, body: "hello")
|
20
|
-
|
21
|
-
begin
|
22
|
-
HTTP.post(
|
23
|
-
"https://www.example.com",
|
24
|
-
body: JSON.generate({
|
25
|
-
i_had_to_go: "and post a different hash",
|
26
|
-
my_hash: "is different",
|
27
|
-
}),
|
28
|
-
)
|
29
|
-
rescue WebMock::NetConnectNotAllowedError => e
|
30
|
-
puts "success! webmock stopped the request"
|
31
|
-
puts "here is the error text:\n\n"
|
32
|
-
|
33
|
-
puts e.message
|
34
|
-
exit 0
|
35
|
-
end
|
36
|
-
|
37
|
-
puts "nothing was raised??"
|
data/examples/webmock/text.rb
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
require "webmock"
|
2
|
-
require "specdiff"
|
3
|
-
require "specdiff/webmock"
|
4
|
-
|
5
|
-
include WebMock::API
|
6
|
-
|
7
|
-
WebMock.enable!
|
8
|
-
WebMock.show_body_diff! # on by default
|
9
|
-
|
10
|
-
stub_request(:post, "https://www.example.com")
|
11
|
-
.with(
|
12
|
-
body: <<~TEXT1,
|
13
|
-
this is the expected body
|
14
|
-
that you should send
|
15
|
-
nothing less
|
16
|
-
nothing more
|
17
|
-
TEXT1
|
18
|
-
)
|
19
|
-
.to_return(status: 400, body: "hello")
|
20
|
-
|
21
|
-
begin
|
22
|
-
HTTP.post(
|
23
|
-
"https://www.example.com",
|
24
|
-
body: <<~TEXT2,
|
25
|
-
this is the unexpected body
|
26
|
-
that i should not have sent
|
27
|
-
nothing less
|
28
|
-
nothing more
|
29
|
-
TEXT2
|
30
|
-
)
|
31
|
-
rescue WebMock::NetConnectNotAllowedError => e
|
32
|
-
puts "success! webmock stopped the request"
|
33
|
-
puts "here is the error text:\n\n"
|
34
|
-
|
35
|
-
puts e.message
|
36
|
-
exit 0
|
37
|
-
end
|
38
|
-
|
39
|
-
puts "nothing was raised??"
|