rspec-xunit 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -2
- data/Rakefile +1 -1
- data/lib/rspec-xunit.rb +1 -1
- data/lib/rspec/xunit.rb +4 -4
- data/lib/rspec/xunit/assertions.rb +34 -20
- data/lib/rspec/xunit/syntax.rb +2 -2
- data/lib/rspec/xunit/version.rb +1 -1
- data/rspec-xunit.gemspec +18 -18
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 299943c479de4ea203b6feeedf989a0521f68e70fb577753d477dbceb022e59b
|
4
|
+
data.tar.gz: df306b202b8bf9c61ff1ad3c1426425565bd3e5742fe7be0891f37bcc2737401
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 25dbc4a0a9a5781deca309ab71bb8c1324c23aa3d1a04166efb520aebe8aadb1cd366db33cf5c31cd87eab0033159ebc11753211e72f9db12ac4e2d9664c9ab1
|
7
|
+
data.tar.gz: 242ee142fe42210f19d804ab55e946de5e924b19d529135fb7d492d8a159ac2dc3f8a23fb6635fc8459d14c94b7a6d8efe61c5576fc035f01293c7d9a86fa4e5
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
|
-
task :
|
2
|
+
task default: :spec
|
data/lib/rspec-xunit.rb
CHANGED
data/lib/rspec/xunit.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
3
|
+
require "rspec/core"
|
4
|
+
require "rspec/expectations"
|
5
|
+
require "rspec/xunit/assertions"
|
6
|
+
require "rspec/xunit/syntax"
|
@@ -15,19 +15,15 @@ module RSpec
|
|
15
15
|
# - `assert_not_eq` roughly `expect(action).to_not eq(expected)`
|
16
16
|
def assertion_match(matcher, suffix = matcher)
|
17
17
|
define_method "assert_#{suffix}" do |value, *args, &block|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
raise e, e.message, adjust_for_better_failure_message(e.backtrace), cause: nil
|
22
|
-
end
|
18
|
+
expect(value).to send(matcher, *args, &block)
|
19
|
+
rescue Expectations::ExpectationNotMetError => e
|
20
|
+
raise e, e.message, adjust_for_better_failure_message(e.backtrace), cause: nil
|
23
21
|
end
|
24
22
|
|
25
23
|
define_method "assert_not_#{suffix}" do |value, *args, &block|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
raise e, e.message, adjust_for_better_failure_message(e.backtrace), cause: nil
|
30
|
-
end
|
24
|
+
expect(value).to_not send(matcher, *args, &block)
|
25
|
+
rescue Expectations::ExpectationNotMetError => e
|
26
|
+
raise e, e.message, adjust_for_better_failure_message(e.backtrace), cause: nil
|
31
27
|
end
|
32
28
|
end
|
33
29
|
|
@@ -41,19 +37,15 @@ module RSpec
|
|
41
37
|
# - `assert_not_raises` roughly `expect { bloc }.to_not raise_error`
|
42
38
|
def assertion_match_block(matcher, suffix = matcher)
|
43
39
|
define_method "assert_#{suffix}" do |*args, &block|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
raise e, e.message, adjust_for_better_failure_message(e.backtrace), cause: nil
|
48
|
-
end
|
40
|
+
expect(&block).to send(matcher, *args)
|
41
|
+
rescue Expectations::ExpectationNotMetError => e
|
42
|
+
raise e, e.message, adjust_for_better_failure_message(e.backtrace), cause: nil
|
49
43
|
end
|
50
44
|
|
51
45
|
define_method "assert_not_#{suffix}" do |*args, &block|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
raise e, e.message, adjust_for_better_failure_message(e.backtrace), cause: nil
|
56
|
-
end
|
46
|
+
expect(&block).to_not send(matcher, *args)
|
47
|
+
rescue Expectations::ExpectationNotMetError => e
|
48
|
+
raise e, e.message, adjust_for_better_failure_message(e.backtrace), cause: nil
|
57
49
|
end
|
58
50
|
end
|
59
51
|
end
|
@@ -92,17 +84,39 @@ module RSpec
|
|
92
84
|
Expectations::ExpectationTarget.for(value, block)
|
93
85
|
end
|
94
86
|
|
87
|
+
# Mock any instance of is an XUnit alternative to the
|
88
|
+
# `expect_any_instance_of` based mocking syntax.
|
89
|
+
#
|
90
|
+
# `mock_any_instance_of(Post).to receive(:comments)`
|
91
|
+
def mock_any_instance_of(klass)
|
92
|
+
RSpec::Mocks::AnyInstanceExpectationTarget.new(klass)
|
93
|
+
end
|
94
|
+
|
95
95
|
# Stub is an XUnit alternative to the `allow` based mocking syntax.
|
96
96
|
def stub(target)
|
97
97
|
RSpec::Mocks::AllowanceTarget.new(target)
|
98
98
|
end
|
99
99
|
|
100
|
+
# Stub any instance of is an XUnit alternative to the `allow` based
|
101
|
+
# mocking syntax.
|
102
|
+
def stub_any_instance_of(klass)
|
103
|
+
RSpec::Mocks::AnyInstanceAllowanceTarget.new(klass)
|
104
|
+
end
|
105
|
+
|
100
106
|
private
|
101
107
|
|
102
108
|
ASSERTION_REGEX = /^assert_(.*)$/.freeze
|
103
109
|
ASSERTION_PREDICATE_REGEX = /^assert_(.*)\?$/.freeze
|
110
|
+
ASSERTION_NEGATIVE_PREDICATE_REGEX = /^assert_not_(.*)\?$/.freeze
|
104
111
|
|
105
112
|
def method_missing(method, *args, &block)
|
113
|
+
return if ASSERTION_NEGATIVE_PREDICATE_REGEX.match(method.to_s) do |match|
|
114
|
+
value = args.shift
|
115
|
+
matcher = "be_#{match[1]}"
|
116
|
+
|
117
|
+
expect(value).to_not Matchers::BuiltIn::BePredicate.new(matcher, *args, &block)
|
118
|
+
end
|
119
|
+
|
106
120
|
return if ASSERTION_PREDICATE_REGEX.match(method.to_s) do |match|
|
107
121
|
value = args.shift
|
108
122
|
matcher = "be_#{match[1]}"
|
data/lib/rspec/xunit/syntax.rb
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
RSpec::Core::ExampleGroup.define_example_group_method :case
|
4
4
|
RSpec::Core::ExampleGroup.define_example_group_method :fcase, focus: true
|
5
|
-
RSpec::Core::ExampleGroup.define_example_group_method :xcase, skip:
|
5
|
+
RSpec::Core::ExampleGroup.define_example_group_method :xcase, skip: "Temporarily skipped with xcase"
|
6
6
|
|
7
7
|
RSpec::Core::ExampleGroup.define_example_method :test
|
8
8
|
RSpec::Core::ExampleGroup.define_example_method :ftest, focus: true
|
9
|
-
RSpec::Core::ExampleGroup.define_example_method :xtest, skip:
|
9
|
+
RSpec::Core::ExampleGroup.define_example_method :xtest, skip: "Temporarily skipped with xtest"
|
10
10
|
|
11
11
|
RSpec::Core::Hooks.module_eval do
|
12
12
|
alias_method :setup, :before
|
data/lib/rspec/xunit/version.rb
CHANGED
data/rspec-xunit.gemspec
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
lib = File.expand_path(
|
3
|
+
lib = File.expand_path("lib", __dir__)
|
4
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
-
require
|
5
|
+
require "rspec/xunit/version"
|
6
6
|
|
7
7
|
Gem::Specification.new do |spec|
|
8
|
-
spec.name
|
9
|
-
spec.version
|
10
|
-
spec.authors
|
11
|
-
spec.email
|
12
|
-
spec.summary
|
13
|
-
spec.description
|
14
|
-
spec.homepage
|
15
|
-
spec.license
|
8
|
+
spec.name = "rspec-xunit"
|
9
|
+
spec.version = RSpec::XUnit::VERSION
|
10
|
+
spec.authors = ["Genadi Samokovarov"]
|
11
|
+
spec.email = ["gsamokovarov@gmail.com"]
|
12
|
+
spec.summary = "XUnit syntax for RSpec"
|
13
|
+
spec.description = "XUnit syntax for RSpec"
|
14
|
+
spec.homepage = "https://github.com/gsamokovarov/rspec-xunit"
|
15
|
+
spec.license = "MIT"
|
16
16
|
|
17
|
-
spec.files
|
17
|
+
spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
|
18
18
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
19
19
|
end
|
20
|
-
spec.bindir
|
21
|
-
spec.executables
|
22
|
-
spec.require_paths = [
|
20
|
+
spec.bindir = "exe"
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
+
spec.require_paths = ["lib"]
|
23
23
|
|
24
|
-
spec.add_dependency
|
25
|
-
spec.add_dependency
|
24
|
+
spec.add_dependency "rspec-core", ">= 3.0"
|
25
|
+
spec.add_dependency "rspec-expectations", ">= 3.0"
|
26
26
|
|
27
|
-
spec.add_development_dependency
|
28
|
-
spec.add_development_dependency
|
27
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
28
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
29
29
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-xunit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Genadi Samokovarov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-03-
|
11
|
+
date: 2020-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec-core
|