rspec-matchers-be_an_array_of 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7420195d1a9707e3f3c7346166d9f4220ea475e1
4
+ data.tar.gz: a78eb9ad3446c9835f5123bfab864b1cf1ae7ba4
5
+ SHA512:
6
+ metadata.gz: 7c269ee372834ac26083e4e2c2edcaf438f5156fdf599ecc29cf12a49805ebcdf1e5c6576b0d232f5da28bd1ab19441b06b6fd270c842e772d40bd9be086ad09
7
+ data.tar.gz: 2b6c03ec7b0c8f8ccc301975564c12fd2cc6e3db0381f1d923f700ec010dd2843d01b1bdc28c336b683f7aa0aba0438a474c00e2efeb27382ca82fd6da562e25
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2016 []().
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,85 @@
1
+ # RSpec Matcher `be_an_array_of`
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/rspec-matchers-be_an_array_of.svg)](http://badge.fury.io/rb/rspec-matchers-be_an_array_of)
4
+ [![Code Climate GPA](https://codeclimate.com/github/pekhee/rspec-matchers-be_an_array_of.svg)](https://codeclimate.com/github/pekhee/rspec-matchers-be_an_array_of)
5
+ [![Test Coverage](https://codeclimate.com/github/pekhee/rspec-matchers-be_an_array_of/badges/coverage.svg)](https://codeclimate.com/github/pekhee/rspec-matchers-be_an_array_of/coverage)
6
+ [![Gemnasium Status](https://gemnasium.com/pekhee/rspec-matchers-be_an_array_of.svg)](https://gemnasium.com/pekhee/rspec-matchers-be_an_array_of)
7
+ [![Travis CI Status](https://secure.travis-ci.org/pekhee/rspec-matchers-be_an_array_of.svg)](https://travis-ci.org/pekhee/rspec-matchers-be_an_array_of)
8
+
9
+ <!-- Tocer[start]: Auto-generated, don't remove. -->
10
+
11
+ # Table of Contents
12
+
13
+ - [Features](#features)
14
+ - [Requirements](#requirements)
15
+ - [Setup](#setup)
16
+ - [Usage](#usage)
17
+ - [Tests](#tests)
18
+ - [Versioning](#versioning)
19
+ - [Code of Conduct](#code-of-conduct)
20
+ - [Contributions](#contributions)
21
+ - [License](#license)
22
+ - [History](#history)
23
+ - [Credits](#credits)
24
+
25
+ <!-- Tocer[finish]: Auto-generated, don't remove. -->
26
+
27
+ # Features
28
+ Matches agains an array of specified type. Type is either class name or one of
29
+ class's ancestors.
30
+
31
+ # Requirements
32
+
33
+ 0. [MRI 2.x](https://www.ruby-lang.org)
34
+ 1. [RSpec 3.x](http://rspec.info/)
35
+
36
+ # Setup
37
+
38
+ To install, type the following:
39
+
40
+ gem install rspec-matchers-be_an_array_of
41
+
42
+ Add the following to your Gemfile:
43
+
44
+ gem "rspec-matchers-be_an_array_of"
45
+
46
+ # Usage
47
+
48
+ RSpec.describe ["an", "array", "of", "strings"] do
49
+ it { is_expected.to be_an_array_of String}
50
+ end
51
+
52
+ # Tests
53
+
54
+ rake spec
55
+
56
+ # Versioning
57
+
58
+ Read [Semantic Versioning](http://semver.org) for details. Briefly, it means:
59
+
60
+ - Patch (x.y.Z) - Incremented for small, backwards compatible bug fixes.
61
+ - Minor (x.Y.z) - Incremented for new, backwards compatible public API enhancements and/or bug fixes.
62
+ - Major (X.y.z) - Incremented for any backwards incompatible public API changes.
63
+
64
+ # Code of Conduct
65
+
66
+ Please note that this project is released with a [CODE OF CONDUCT](CODE_OF_CONDUCT.md). By participating in this project
67
+ you agree to abide by its terms.
68
+
69
+ # Contributions
70
+
71
+ Read [CONTRIBUTING](CONTRIBUTING.md) for details.
72
+
73
+ # License
74
+
75
+ Copyright (c) 2016 [Pooyan Khosravi]().
76
+ Read the [LICENSE](LICENSE.md) for details.
77
+
78
+ # History
79
+
80
+ Read the [CHANGELOG](CHANGELOG.md) for details.
81
+ Built with [Gemsmith](https://github.com/bkuhlmann/gemsmith).
82
+
83
+ # Credits
84
+
85
+ Developed by [Pooyan Khosravi]().
@@ -0,0 +1,13 @@
1
+ require "rspec/matchers/be_an_array_of/identity"
2
+ require "rspec/matcher"
3
+ require "rspec/matchers/be_an_array_of/matcher"
4
+
5
+ # Matches agains an array of specified type. Type is either class name or one of
6
+ # class's ancestors.
7
+ module RSpec
8
+ module Matchers
9
+ # Checks if all elements in an array are of specific type
10
+ module BeAnArrayOf
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,24 @@
1
+ module RSpec
2
+ module Matchers
3
+ module BeAnArrayOf
4
+ # Gem identity information.
5
+ module Identity
6
+ def self.name
7
+ "rspec-matchers-be_an_array_of"
8
+ end
9
+
10
+ def self.label
11
+ "RSpec::Matchers::BeAnArrayOf"
12
+ end
13
+
14
+ def self.version
15
+ "0.2.0"
16
+ end
17
+
18
+ def self.version_label
19
+ "#{label} #{version}"
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,25 @@
1
+ module RSpec
2
+ module Matchers
3
+ # Checks if all elements in an array are of specific type
4
+ module BeAnArrayOf
5
+ # Actual matcher
6
+ class Matcher
7
+ include RSpec::Matcher
8
+ register_as :be_an_array_of
9
+
10
+ def match
11
+ return false unless actual.is_a? Array
12
+
13
+ actual.map { |e| e.is_a? expected }.reduce(&:&)
14
+ end
15
+
16
+ def failure_message
17
+ <<-MSG.gsub(/^\s+/, " ")
18
+ expected object to be an array#{" of " + type.name unless type.nil?} but it was
19
+ #{actual}
20
+ MSG
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,6 @@
1
+ begin
2
+ require "rspec/core/rake_task"
3
+ RSpec::Core::RakeTask.new(:spec)
4
+ rescue LoadError => error
5
+ puts error.message
6
+ end
@@ -0,0 +1,6 @@
1
+ begin
2
+ require "rubocop/rake_task"
3
+ RuboCop::RakeTask.new
4
+ rescue LoadError => error
5
+ puts error.message
6
+ end
metadata ADDED
@@ -0,0 +1,279 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rspec-matchers-be_an_array_of
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ platform: ruby
6
+ authors:
7
+ - Pooyan Khosravi
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-03-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
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: rspec-matcher
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
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: gemsmith
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: pry
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: pry-byebug
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: pry-remote
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
+ - !ruby/object:Gem::Dependency
112
+ name: pry-state
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: pry-rescue
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: pry-stack_explorer
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: rb-fsevent
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: guard-rspec
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: terminal-notifier
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - ">="
193
+ - !ruby/object:Gem::Version
194
+ version: '0'
195
+ - !ruby/object:Gem::Dependency
196
+ name: terminal-notifier-guard
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - ">="
200
+ - !ruby/object:Gem::Version
201
+ version: '0'
202
+ type: :development
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - ">="
207
+ - !ruby/object:Gem::Version
208
+ version: '0'
209
+ - !ruby/object:Gem::Dependency
210
+ name: rubocop
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - ">="
214
+ - !ruby/object:Gem::Version
215
+ version: '0'
216
+ type: :development
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - ">="
221
+ - !ruby/object:Gem::Version
222
+ version: '0'
223
+ - !ruby/object:Gem::Dependency
224
+ name: codeclimate-test-reporter
225
+ requirement: !ruby/object:Gem::Requirement
226
+ requirements:
227
+ - - ">="
228
+ - !ruby/object:Gem::Version
229
+ version: '0'
230
+ type: :development
231
+ prerelease: false
232
+ version_requirements: !ruby/object:Gem::Requirement
233
+ requirements:
234
+ - - ">="
235
+ - !ruby/object:Gem::Version
236
+ version: '0'
237
+ description: An RSpec matcher that ensures expected is an array and each element is
238
+ of specified type.
239
+ email:
240
+ - pekhee@gmail.com
241
+ executables: []
242
+ extensions: []
243
+ extra_rdoc_files:
244
+ - README.md
245
+ - LICENSE.md
246
+ files:
247
+ - LICENSE.md
248
+ - README.md
249
+ - lib/rspec/matchers/be_an_array_of.rb
250
+ - lib/rspec/matchers/be_an_array_of/identity.rb
251
+ - lib/rspec/matchers/be_an_array_of/matcher.rb
252
+ - lib/tasks/rspec.rake
253
+ - lib/tasks/rubocop.rake
254
+ homepage: https://github.com/pekhee/rspec-matchers-be_an_array_of
255
+ licenses:
256
+ - MIT
257
+ metadata: {}
258
+ post_install_message:
259
+ rdoc_options: []
260
+ require_paths:
261
+ - lib
262
+ required_ruby_version: !ruby/object:Gem::Requirement
263
+ requirements:
264
+ - - ">="
265
+ - !ruby/object:Gem::Version
266
+ version: '0'
267
+ required_rubygems_version: !ruby/object:Gem::Requirement
268
+ requirements:
269
+ - - ">="
270
+ - !ruby/object:Gem::Version
271
+ version: '0'
272
+ requirements: []
273
+ rubyforge_project:
274
+ rubygems_version: 2.4.5.1
275
+ signing_key:
276
+ specification_version: 4
277
+ summary: rspec matcher be_an_array_of type
278
+ test_files: []
279
+ has_rdoc: