saharspec 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rubocop_todo.yml +28 -0
- data/.yardopts +2 -0
- data/LICENSE.txt +22 -0
- data/README.md +134 -0
- data/lib/saharspec/its/call.rb +56 -0
- data/lib/saharspec/its/map.rb +74 -0
- data/lib/saharspec/its.rb +10 -0
- data/lib/saharspec/matchers/eq_multiline.rb +48 -0
- data/lib/saharspec/matchers/send_message.rb +138 -0
- data/lib/saharspec/matchers.rb +11 -0
- data/lib/saharspec.rb +9 -0
- data/saharspec.gemspec +34 -0
- metadata +153 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8ae684897f535577827bd53f103f7841c0925501
|
4
|
+
data.tar.gz: 83ab9127597f72ad1aabc84d2eda3847f022f93a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a69593a2bb4261748e2b2e14027109aa3926d9f5caa4780970a6808c34fab6d95093c57fc250fc315235af5cc75d25194f52ddf3c85dc0b9867732aed3093ef4
|
7
|
+
data.tar.gz: 73d4d55c8b53c45640cf2dd1f1847396c03b1b1d40a8268762f7a0eaec49cddbf2dc723f41c9a0194d8d3f47a67ba83e69a123a229aa2b13b90bec03857346e4
|
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2017-08-11 18:02:13 +0300 using RuboCop version 0.49.1.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 2
|
10
|
+
# Cop supports --auto-correct.
|
11
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
|
12
|
+
# SupportedStyles: aligned, indented, indented_relative_to_receiver
|
13
|
+
Layout/MultilineMethodCallIndentation:
|
14
|
+
Exclude:
|
15
|
+
- 'lib/saharspec/get_webmock.rb'
|
16
|
+
|
17
|
+
# Offense count: 2
|
18
|
+
Lint/ShadowingOuterLocalVariable:
|
19
|
+
Exclude:
|
20
|
+
- 'lib/saharspec/get_webmock.rb'
|
21
|
+
|
22
|
+
# Offense count: 1
|
23
|
+
# Cop supports --auto-correct.
|
24
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
25
|
+
# SupportedStyles: only_raise, only_fail, semantic
|
26
|
+
Style/SignalException:
|
27
|
+
Exclude:
|
28
|
+
- 'lib/saharspec/get_webmock.rb'
|
data/.yardopts
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014-15 Victor 'Zverok' Shepelev
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
# Saharspec: Specs DRY as Sahara
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/saharspec.svg)](http://badge.fury.io/rb/saharspec)
|
4
|
+
[![Build Status](https://travis-ci.org/zverok/saharspec.svg?branch=master)](https://travis-ci.org/zverok/saharspec)
|
5
|
+
|
6
|
+
**saharspec** is a set of additions to RSpec. It's name is a pun on Russian word "сахар"
|
7
|
+
("sahar", means "sugar") and Sahara desert. So, it is a set of RSpec sugar, to make your
|
8
|
+
specs dry as a desert.
|
9
|
+
|
10
|
+
## Usage
|
11
|
+
|
12
|
+
Install it as a usual gem `saharspec`.
|
13
|
+
|
14
|
+
Then, probably in your `spec_helper.rb`
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
require 'saharspec'
|
18
|
+
# or feature-by-feature
|
19
|
+
require 'saharspec/its/map'
|
20
|
+
# or some part of a library
|
21
|
+
require 'saharspec/its'
|
22
|
+
```
|
23
|
+
|
24
|
+
## Parts
|
25
|
+
|
26
|
+
### Matchers
|
27
|
+
|
28
|
+
Just a random matchers I've found useful in my studies.
|
29
|
+
|
30
|
+
#### `send_message(object, method)` matcher
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
# before
|
34
|
+
it {
|
35
|
+
expect(Net::HTTP).to receive(:get).with('http://google.com').and_return('not this time')
|
36
|
+
fetcher
|
37
|
+
}
|
38
|
+
|
39
|
+
# after
|
40
|
+
require 'saharspec/matchers/send_message'
|
41
|
+
|
42
|
+
it {
|
43
|
+
expect { fetcher }.to send_message(Net::HTTP, :get).with('http://google.com').returning('not this time')
|
44
|
+
}
|
45
|
+
# after + its_call
|
46
|
+
subject { fetcher }
|
47
|
+
its_call { is_expected.to send_message(Net::HTTP, :get).with('http://google.com').returning('not this time') }
|
48
|
+
```
|
49
|
+
|
50
|
+
Note: there is [reasons](https://github.com/rspec/rspec-expectations/issues/934) why it is not in rspec-mocks, though, not very persuative for
|
51
|
+
me.
|
52
|
+
|
53
|
+
#### `eq_multiline(text)` matcher
|
54
|
+
|
55
|
+
Dedicated to checking some multiline text generators.
|
56
|
+
|
57
|
+
```ruby
|
58
|
+
# before: one option
|
59
|
+
|
60
|
+
it { expect(generated_code).to eq("def method\n a = @b**2\n return a + @b\nend") }
|
61
|
+
|
62
|
+
# before: another option
|
63
|
+
it {
|
64
|
+
expect(generated_code).to eq(%{def method
|
65
|
+
a = @b**2
|
66
|
+
return a + @b
|
67
|
+
end})
|
68
|
+
}
|
69
|
+
|
70
|
+
# after
|
71
|
+
require 'saharspec/matchers/eq_multiline'
|
72
|
+
|
73
|
+
it {
|
74
|
+
expect(generated_code).to eq_multiline(%{
|
75
|
+
|def method
|
76
|
+
| a = @b**2
|
77
|
+
| return a + @b
|
78
|
+
|end
|
79
|
+
})
|
80
|
+
}
|
81
|
+
```
|
82
|
+
(empty lines before/after are removed, text deindented up to `|` sign)
|
83
|
+
|
84
|
+
### `its`-addons
|
85
|
+
|
86
|
+
**Notice**: There are different opinions on usability/reasonability of `its(:attribute)` syntax,
|
87
|
+
extracted from RSpec core and currently provided by [rspec-its](https://github.com/rspec/rspec-its)
|
88
|
+
gem. Some find it (and a notion of description-less examples) bad practice. But if you are like me
|
89
|
+
and love DRY-ness of it, probably you'll love those two ideas, taking `its`-syntax a bit further.
|
90
|
+
|
91
|
+
#### `its_map`
|
92
|
+
|
93
|
+
Like `rspec/its`, but for processing arrays:
|
94
|
+
|
95
|
+
```ruby
|
96
|
+
subject { html_document.search('ul#menu > li') }
|
97
|
+
|
98
|
+
# before
|
99
|
+
it { expect(subject.map(&:text)).to all not_be_empty }
|
100
|
+
|
101
|
+
# after
|
102
|
+
require 'saharspec/its/map'
|
103
|
+
|
104
|
+
its_map(:text) { are_expected.to all not_be_empty }
|
105
|
+
```
|
106
|
+
|
107
|
+
#### `its_call`
|
108
|
+
|
109
|
+
```ruby
|
110
|
+
subject { some_operation_that_may_fail }
|
111
|
+
|
112
|
+
# before
|
113
|
+
it { expect { subject }.to raise_error(...) }
|
114
|
+
|
115
|
+
# after
|
116
|
+
require 'saharspec/its/call'
|
117
|
+
|
118
|
+
its_call { is_expected.to raise_error(...) }
|
119
|
+
```
|
120
|
+
|
121
|
+
## State & future
|
122
|
+
|
123
|
+
I use all of the components of the library on daily basis. Probably, I will extend it with other
|
124
|
+
ideas and findings from time to time (next thing that needs gemification is WebMock DRY-er, allowing
|
125
|
+
code like `expect { code }.to request_webmock(url, params)` instead of preparing stubs and then
|
126
|
+
checking them). Stay tuned.
|
127
|
+
|
128
|
+
## Author
|
129
|
+
|
130
|
+
[Victor Shepelev](http://zverok.github.io/)
|
131
|
+
|
132
|
+
## License
|
133
|
+
|
134
|
+
[MIT](https://github.com/zverok/time_math2/blob/master/LICENSE.txt).
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module Saharspec
|
2
|
+
module Its
|
3
|
+
module Call
|
4
|
+
# Creates nested example which converts current subject to a block-subject.
|
5
|
+
#
|
6
|
+
# @example
|
7
|
+
#
|
8
|
+
# subject { calc_something(params) }
|
9
|
+
#
|
10
|
+
# # without its_call
|
11
|
+
# context 'with this params'
|
12
|
+
# it { expect { subject }.to change(some, :value).by(1) }
|
13
|
+
# end
|
14
|
+
#
|
15
|
+
# context 'with that params'
|
16
|
+
# it { expect { subject }.to raise_error(SomeError) }
|
17
|
+
# end
|
18
|
+
#
|
19
|
+
# # with its_call
|
20
|
+
# context 'with this params'
|
21
|
+
# its_call { is_expected.to change(some, :value).by(1) }
|
22
|
+
# end
|
23
|
+
#
|
24
|
+
# context 'with that params'
|
25
|
+
# its_call { is_expected.to raise_error(SomeError) }
|
26
|
+
# end
|
27
|
+
#
|
28
|
+
# @param options Other options that can be passed to usual RSpec example.
|
29
|
+
# @param block [Proc] The test itself. Inside it, `is_expected` (or `are_expected`) is analog of
|
30
|
+
# `expect { subject }`.
|
31
|
+
#
|
32
|
+
def its_call(*options, &block)
|
33
|
+
# rubocop:disable Lint/NestedMethodDefinition
|
34
|
+
describe('call') do
|
35
|
+
let(:__call_subject) do
|
36
|
+
-> { subject }
|
37
|
+
end
|
38
|
+
|
39
|
+
def is_expected
|
40
|
+
expect(__call_subject)
|
41
|
+
end
|
42
|
+
|
43
|
+
example(nil, *options, &block)
|
44
|
+
end
|
45
|
+
# rubocop:enable Lint/NestedMethodDefinition
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
RSpec.configure do |rspec|
|
52
|
+
rspec.extend Saharspec::Its::Call
|
53
|
+
rspec.backtrace_exclusion_patterns << %r{/lib/saharspec/its/call}
|
54
|
+
end
|
55
|
+
|
56
|
+
RSpec::SharedContext.send(:include, Saharspec::Its::Call)
|
@@ -0,0 +1,74 @@
|
|
1
|
+
module Saharspec
|
2
|
+
module Its
|
3
|
+
module Map
|
4
|
+
# Creates nested example which has current subject mapped
|
5
|
+
# by specified attribute as its subject.
|
6
|
+
#
|
7
|
+
# @example
|
8
|
+
#
|
9
|
+
# # with attribute
|
10
|
+
# subject { %w[test me please] }
|
11
|
+
# its_map(:length) { is_expected.to eq [4, 2, 6] }
|
12
|
+
#
|
13
|
+
# # with attribute chain
|
14
|
+
# its_map(:'reverse.upcase') { is_expected.to eq %w[TSET EM ESAELP] }
|
15
|
+
#
|
16
|
+
# # with Hash (or any other object re sponding to `#[]`)
|
17
|
+
# subject {
|
18
|
+
# [
|
19
|
+
# {title: 'Slaughterhouse Five', author: {first: 'Kurt', last: 'Vonnegut'}},
|
20
|
+
# {title: 'Hitchhickers Guide To The Galaxy', author: {first: 'Duglas', last: 'Adams'}}
|
21
|
+
# ]
|
22
|
+
# }
|
23
|
+
# its_map([:title]) { are_expected.to eq ['Slaughterhouse Five', 'Hitchhickers Guide To The Galaxy'] }
|
24
|
+
# # multiple attributes for nested hashes
|
25
|
+
# its_map([:author, :last]) { are_expected.to eq ['Vonnegut', 'Adams'] }
|
26
|
+
#
|
27
|
+
# @param attribute [String, Symbol, Array<String, Symbol>] Attribute name (String or Symbol), attribute chain
|
28
|
+
# (string separated with dots) or arguments to `#[]` method (Array)
|
29
|
+
# @param options Other options that can be passed to usual RSpec example.
|
30
|
+
# @param block [Proc] The test itself. Inside it, `is_expected` (or `are_expected`) is related to result
|
31
|
+
# of `map`ping the subject.
|
32
|
+
#
|
33
|
+
def its_map(attribute, *options, &block) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
34
|
+
# rubocop:disable Lint/NestedMethodDefinition
|
35
|
+
describe("map(&:#{attribute})") do
|
36
|
+
let(:__its_map_subject) do
|
37
|
+
if Array === attribute # rubocop:disable Style/CaseEquality
|
38
|
+
if subject.all? { |s| Hash === s } # rubocop:disable Style/CaseEquality
|
39
|
+
subject.map do |s|
|
40
|
+
attribute.inject(s) { |inner, attr| inner[attr] }
|
41
|
+
end
|
42
|
+
else
|
43
|
+
subject.map { |inner| inner[*attribute] }
|
44
|
+
end
|
45
|
+
else
|
46
|
+
attribute_chain = attribute.to_s.split('.').map(&:to_sym)
|
47
|
+
attribute_chain.inject(subject) do |inner_subject, attr|
|
48
|
+
inner_subject.map(&attr)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def is_expected
|
54
|
+
expect(__its_map_subject)
|
55
|
+
end
|
56
|
+
|
57
|
+
alias_method :are_expected, :is_expected
|
58
|
+
|
59
|
+
options << {} unless options.last.is_a?(Hash)
|
60
|
+
|
61
|
+
example(nil, *options, &block)
|
62
|
+
end
|
63
|
+
# rubocop:enable Lint/NestedMethodDefinition
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
RSpec.configure do |rspec|
|
70
|
+
rspec.extend Saharspec::Its::Map
|
71
|
+
rspec.backtrace_exclusion_patterns << %r{/lib/saharspec/its/map}
|
72
|
+
end
|
73
|
+
|
74
|
+
RSpec::SharedContext.send(:include, Saharspec::Its::Map)
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module Saharspec
|
2
|
+
module Matchers
|
3
|
+
# @private
|
4
|
+
class EqMultiline < RSpec::Matchers::BuiltIn::Eq
|
5
|
+
def initialize(expected)
|
6
|
+
# 1. for all lines looking like "<spaces>|" -- remove this.
|
7
|
+
# 2. remove trailing spaces
|
8
|
+
# 3. preserve trailing spaces ending with "|", but remove the pipe
|
9
|
+
# 4. remove one empty line before & after, allows prettier %Q{}
|
10
|
+
# TODO: check if all lines start with "|"?
|
11
|
+
super(
|
12
|
+
expected
|
13
|
+
.gsub(/^ *\|/, '')
|
14
|
+
.gsub(/ +$/, '')
|
15
|
+
.gsub(/\|$/, '')
|
16
|
+
.gsub(/(\A *\n|\n *\z)/, '')
|
17
|
+
)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
module RSpec
|
24
|
+
module Matchers
|
25
|
+
# Allows to pretty test multiline strings with complex indentation (for example, results of
|
26
|
+
# code generation).
|
27
|
+
#
|
28
|
+
# In provided string, removes first and last empty line, trailing spaces and leading spaces up
|
29
|
+
# to `|` character.
|
30
|
+
#
|
31
|
+
# If you need to preserve trailing spaces, end them with another `|`.
|
32
|
+
#
|
33
|
+
# @example
|
34
|
+
# require 'saharspec/matchers/eq_multiline'
|
35
|
+
#
|
36
|
+
# expect(some_code_gen).to eq_multiline(%{
|
37
|
+
# |def something
|
38
|
+
# | a = 5
|
39
|
+
# | a**2
|
40
|
+
# |end
|
41
|
+
# })
|
42
|
+
#
|
43
|
+
# @param [String]
|
44
|
+
def eq_multiline(expected)
|
45
|
+
Saharspec::Matchers::EqMultiline.new(expected)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,138 @@
|
|
1
|
+
module Saharspec
|
2
|
+
module Matchers
|
3
|
+
# @private
|
4
|
+
class SendMessage
|
5
|
+
include RSpec::Mocks::ExampleMethods
|
6
|
+
|
7
|
+
def initialize(target, method)
|
8
|
+
@target = target
|
9
|
+
@method = method
|
10
|
+
end
|
11
|
+
|
12
|
+
# DSL
|
13
|
+
def with(*arguments)
|
14
|
+
@arguments = arguments
|
15
|
+
self
|
16
|
+
end
|
17
|
+
|
18
|
+
def returning(res)
|
19
|
+
@res = res
|
20
|
+
self
|
21
|
+
end
|
22
|
+
|
23
|
+
def calling_original
|
24
|
+
@call_original = true
|
25
|
+
self
|
26
|
+
end
|
27
|
+
|
28
|
+
def exactly(n)
|
29
|
+
@times = n
|
30
|
+
self
|
31
|
+
end
|
32
|
+
|
33
|
+
def times
|
34
|
+
raise NoMethodError unless @times
|
35
|
+
self
|
36
|
+
end
|
37
|
+
|
38
|
+
def once
|
39
|
+
exactly(1)
|
40
|
+
end
|
41
|
+
|
42
|
+
def twice
|
43
|
+
exactly(2)
|
44
|
+
end
|
45
|
+
|
46
|
+
# Matching
|
47
|
+
def matches?(subject)
|
48
|
+
run(subject)
|
49
|
+
expect(@target).to expectation
|
50
|
+
true
|
51
|
+
end
|
52
|
+
|
53
|
+
def does_not_match?(subject)
|
54
|
+
run(subject)
|
55
|
+
expect(@target).not_to expectation
|
56
|
+
true
|
57
|
+
end
|
58
|
+
|
59
|
+
# Static properties
|
60
|
+
def supports_block_expectations?
|
61
|
+
true
|
62
|
+
end
|
63
|
+
|
64
|
+
def description
|
65
|
+
format('to send %p.%s', @target, @method)
|
66
|
+
end
|
67
|
+
|
68
|
+
def failure_message
|
69
|
+
"expected #{description}, but sent nothing"
|
70
|
+
end
|
71
|
+
|
72
|
+
def failure_message_when_negated
|
73
|
+
"expected not #{description}, but sent it"
|
74
|
+
end
|
75
|
+
|
76
|
+
private
|
77
|
+
|
78
|
+
def run(subject)
|
79
|
+
@target.respond_to?(@method) or
|
80
|
+
raise NoMethodError,
|
81
|
+
"undefined method `#{@method}' for#{@target.inspect}:#{@target.class}"
|
82
|
+
allow(@target).to allower
|
83
|
+
subject.call
|
84
|
+
end
|
85
|
+
|
86
|
+
def allower
|
87
|
+
receive(@method).tap do |a|
|
88
|
+
a.and_return(@res) if @res
|
89
|
+
a.and_call_original if @call_original
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
def expectation
|
94
|
+
have_received(@method).tap do |e|
|
95
|
+
e.with(*@arguments) if @arguments
|
96
|
+
e.exactly(@times).times if @times
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
module RSpec
|
104
|
+
module Matchers
|
105
|
+
# Checks if the (block) subject sends specified message to specified object.
|
106
|
+
#
|
107
|
+
# @example
|
108
|
+
# # before:
|
109
|
+
# specify {
|
110
|
+
# allow(double).to receive(:fetch)
|
111
|
+
# code_being_tested
|
112
|
+
# expect(double).to have_received(:fetch).with(something)
|
113
|
+
# }
|
114
|
+
#
|
115
|
+
# # after:
|
116
|
+
# require 'saharspec/matchers/send_message'
|
117
|
+
# it { expect { code_being_tested }.to send_message(double, :fetch).with(something) }
|
118
|
+
# # after + its_call
|
119
|
+
# require 'saharspec/its/call'
|
120
|
+
# subject { code_being_tested }
|
121
|
+
# its_call { is_expected.to send_message(double, :fetch).with(something) }
|
122
|
+
#
|
123
|
+
#
|
124
|
+
# @param target Object which expects message, double or real object
|
125
|
+
# @param method [Symbol] Message being expected
|
126
|
+
#
|
127
|
+
# @return Instance of a matcher, allowing the following additional methods:
|
128
|
+
#
|
129
|
+
# * `once`, `twice`, `exactly(n).times`;
|
130
|
+
# * `with(arguments)`;
|
131
|
+
# * `calling_original`;
|
132
|
+
# * `returning(response)`.
|
133
|
+
#
|
134
|
+
def send_message(target, method)
|
135
|
+
Saharspec::Matchers::SendMessage.new(target, method)
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Saharspec
|
2
|
+
# All Saharspec matchers, when required, included into `RSpec::Matchers` namespace.
|
3
|
+
#
|
4
|
+
# See {RSpec::Matchers#send_message #send_message} and {RSpec::Matchers#eq_multiline #eq_multiline}.
|
5
|
+
#
|
6
|
+
module Matchers
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
require_relative 'matchers/eq_multiline'
|
11
|
+
require_relative 'matchers/send_message'
|
data/lib/saharspec.rb
ADDED
data/saharspec.gemspec
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = 'saharspec'
|
3
|
+
s.version = '0.0.1'
|
4
|
+
s.authors = ['Victor Shepelev']
|
5
|
+
s.email = 'zverok.offline@gmail.com'
|
6
|
+
s.homepage = 'https://github.com/zverok/saharspec'
|
7
|
+
|
8
|
+
s.summary = 'Several additions for DRYer RSpec code'
|
9
|
+
s.licenses = ['MIT']
|
10
|
+
|
11
|
+
s.files = `git ls-files`.split($RS).reject do |file|
|
12
|
+
file =~ /^(?:
|
13
|
+
spec\/.*
|
14
|
+
|Gemfile
|
15
|
+
|Rakefile
|
16
|
+
|\.rspec
|
17
|
+
|\.gitignore
|
18
|
+
|\.rubocop.yml
|
19
|
+
|\.travis.yml
|
20
|
+
)$/x
|
21
|
+
end
|
22
|
+
s.require_paths = ["lib"]
|
23
|
+
|
24
|
+
s.required_ruby_version = '>= 2.1.0'
|
25
|
+
|
26
|
+
s.add_development_dependency 'rubocop', '>= 0.40'
|
27
|
+
s.add_development_dependency 'rspec'
|
28
|
+
s.add_development_dependency 'rspec-its'
|
29
|
+
s.add_development_dependency 'simplecov', '~> 0.9'
|
30
|
+
s.add_development_dependency 'rake'
|
31
|
+
s.add_development_dependency 'rubygems-tasks'
|
32
|
+
s.add_development_dependency 'yard'
|
33
|
+
#s.add_development_dependency 'coveralls'
|
34
|
+
end
|
metadata
ADDED
@@ -0,0 +1,153 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: saharspec
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Victor Shepelev
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-08-14 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rubocop
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.40'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.40'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
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: rspec-its
|
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: simplecov
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.9'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.9'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
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: rubygems-tasks
|
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: yard
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description:
|
112
|
+
email: zverok.offline@gmail.com
|
113
|
+
executables: []
|
114
|
+
extensions: []
|
115
|
+
extra_rdoc_files: []
|
116
|
+
files:
|
117
|
+
- ".rubocop_todo.yml"
|
118
|
+
- ".yardopts"
|
119
|
+
- LICENSE.txt
|
120
|
+
- README.md
|
121
|
+
- lib/saharspec.rb
|
122
|
+
- lib/saharspec/its.rb
|
123
|
+
- lib/saharspec/its/call.rb
|
124
|
+
- lib/saharspec/its/map.rb
|
125
|
+
- lib/saharspec/matchers.rb
|
126
|
+
- lib/saharspec/matchers/eq_multiline.rb
|
127
|
+
- lib/saharspec/matchers/send_message.rb
|
128
|
+
- saharspec.gemspec
|
129
|
+
homepage: https://github.com/zverok/saharspec
|
130
|
+
licenses:
|
131
|
+
- MIT
|
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: 2.1.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.10
|
150
|
+
signing_key:
|
151
|
+
specification_version: 4
|
152
|
+
summary: Several additions for DRYer RSpec code
|
153
|
+
test_files: []
|