rspec-every_item 0.0.1

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: 085c9344cea6dd2c4ef62f5dd66ebf2537d7e028
4
+ data.tar.gz: 2e447ed3e19a429edec5e9fb54a8d2cc1e85aea7
5
+ SHA512:
6
+ metadata.gz: 39f88fef8c65a693c2524ced2aa977e86d6acdfcedd905df55ffa07d24e7f5f535c2383abc90a49615da6cce9459b0520dd69242262649b46cd6a363adc20230
7
+ data.tar.gz: 4dc4a8112d3dd5ae6669d2d4d3945df40c53738b66dd63325dfbee5e9b898e07d74e2cc5b079b9d7708920b13ba1ab839d785152f03946e3943af703a62e8f09
@@ -0,0 +1 @@
1
+ repo_token: P4e5k0FTtMET1iEc437mz0KQeODwWCHxP
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ --warnings
3
+ --require spec_helper
@@ -0,0 +1,15 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ - 2.1.2
6
+ gemfile:
7
+ - gemfiles/rspec2.gemfile
8
+ - gemfiles/rspec3.gemfile
9
+ bundler_args: --jobs=2
10
+ script: CODECLIMATE_REPO_TOKEN=1668749a82fc09ff7729ac0b020f9c7106b6a9899f7b6f3f94fbe9e02f5f076c bundle exec rspec
11
+ branches:
12
+ only:
13
+ - master
14
+ notifications:
15
+ email: false
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rspec-every_item.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 sue445
2
+
3
+ MIT License
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.
@@ -0,0 +1,60 @@
1
+ # RSpec::EveryItem
2
+
3
+ Evaluate matcher in each array element
4
+
5
+ This is inspired by Junit [everyItem](http://junit.sourceforge.net/javadoc/org/junit/matchers/JUnitMatchers.html#everyItem(org.hamcrest.Matcher))
6
+
7
+ [![Build Status](https://travis-ci.org/sue445/rspec-every_item.svg)](https://travis-ci.org/sue445/rspec-every_item)
8
+ [![Code Climate](https://codeclimate.com/github/sue445/rspec-temp_dir.png)](https://codeclimate.com/github/sue445/rspec-temp_dir)
9
+ [![Coverage Status](https://img.shields.io/coveralls/sue445/rspec-every_item.svg)](https://coveralls.io/r/sue445/rspec-every_item)
10
+ [![Dependency Status](https://gemnasium.com/sue445/rspec-every_item.svg)](https://gemnasium.com/sue445/rspec-every_item)
11
+
12
+ ## Requirements
13
+
14
+ * ruby 1.9.3, 2.x
15
+ * rspec 2.x, 3.0.0
16
+
17
+ ## Installation
18
+
19
+ Add this line to your application's Gemfile:
20
+
21
+ ```ruby
22
+ gem 'rspec-every_item'
23
+ ```
24
+
25
+ And then execute:
26
+
27
+ $ bundle
28
+
29
+ Or install it yourself as:
30
+
31
+ $ gem install rspec-every_item
32
+
33
+ ## Usage
34
+
35
+ ```ruby
36
+ require "rspec/every_item"
37
+
38
+ describe "All elements" do
39
+ it "should start with 'cure_'" do
40
+ names = %w(
41
+ cure_happy
42
+ cure_sunny
43
+ cure_peace
44
+ cure_march
45
+ cure_beauty
46
+ )
47
+
48
+ expect(names).to every_item( start_with("cure_") )
49
+ end
50
+ end
51
+ ```
52
+
53
+
54
+ ## Contributing
55
+
56
+ 1. Fork it ( https://github.com/sue445/rspec-every_item/fork )
57
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
58
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
59
+ 4. Push to the branch (`git push origin my-new-feature`)
60
+ 5. Create a new Pull Request
@@ -0,0 +1,7 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
7
+
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem 'rspec', "~> 2.14.1"
4
+
5
+ gemspec path: '../'
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem 'rspec', "~> 3.0.0"
4
+
5
+ gemspec path: '../'
@@ -0,0 +1,8 @@
1
+ require "rspec/every_item/version"
2
+ require "rspec/every_item/matchers"
3
+
4
+ module RSpec
5
+ module EveryItem
6
+ # Your code goes here...
7
+ end
8
+ end
@@ -0,0 +1,11 @@
1
+ module RSpec
2
+ module EveryItem
3
+ module Matchers
4
+ RSpec::Matchers.define :every_item do |expected_matcher|
5
+ match do |actuals|
6
+ actuals.all?{|actual| expected_matcher.matches?(actual) }
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,5 @@
1
+ module RSpec
2
+ module EveryItem
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'rspec/every_item/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "rspec-every_item"
8
+ spec.version = RSpec::EveryItem::VERSION
9
+ spec.authors = ["sue445"]
10
+ spec.email = ["sue445@sue445.net"]
11
+ spec.summary = %q{Evaluate matcher in each array element}
12
+ spec.description = %q{Evaluate matcher in each array element}
13
+ spec.homepage = "https://github.com/sue445/rspec-every_item"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "rspec"
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.6"
24
+ spec.add_development_dependency "rake", "~> 10.0"
25
+
26
+ spec.add_development_dependency "codeclimate-test-reporter"
27
+ spec.add_development_dependency "coveralls"
28
+ end
@@ -0,0 +1,51 @@
1
+ describe RSpec::EveryItem do
2
+ describe "#every_item" do
3
+ context "When build-in matcher" do
4
+ describe "to every_item" do
5
+ let(:names) do
6
+ %w(
7
+ cure_happy
8
+ cure_sunny
9
+ cure_peace
10
+ cure_march
11
+ cure_beauty
12
+ )
13
+ end
14
+
15
+ it { expect(names).to every_item( start_with("cure_") ) }
16
+ end
17
+
18
+ context "not_to every_item" do
19
+ let(:names) do
20
+ %w(
21
+ cure_black
22
+ cure_white
23
+ shiny_luminous
24
+ )
25
+ end
26
+
27
+ it { expect(names).not_to every_item( start_with("cure_") ) }
28
+ end
29
+ end
30
+
31
+ context "When custom matcher" do
32
+ RSpec::Matchers.define :even_number do
33
+ match do |actual|
34
+ actual % 2 == 0
35
+ end
36
+ end
37
+
38
+ describe "to every_item" do
39
+ let(:numbers) { [0, 2, 4, 6, 8] }
40
+
41
+ it { expect(numbers).to every_item( even_number ) }
42
+ end
43
+
44
+ context "not_to every_item" do
45
+ let(:numbers) { [0, 2, 4, 6, 7, 8] }
46
+
47
+ it { expect(numbers).not_to every_item( even_number ) }
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,88 @@
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 this
4
+ # file to always be loaded, without a need to explicitly require it in any files.
5
+ #
6
+ # Given that it is always loaded, you are encouraged to keep this file as
7
+ # light-weight as possible. Requiring heavyweight dependencies from this file
8
+ # will add to the boot time of your test suite on EVERY test run, even for an
9
+ # individual file that may not need all of that loaded. Instead, make a
10
+ # separate helper file that requires this one and then use it only in the specs
11
+ # that actually need it.
12
+ #
13
+ # The `.rspec` file also contains a few flags that are not defaults but that
14
+ # users commonly want.
15
+ #
16
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
17
+
18
+ require "codeclimate-test-reporter"
19
+ CodeClimate::TestReporter.start
20
+
21
+ require 'coveralls'
22
+ Coveralls.wear!
23
+
24
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
25
+ require "rspec/every_item"
26
+
27
+ RSpec.configure do |config|
28
+ # The settings below are suggested to provide a good initial experience
29
+ # with RSpec, but feel free to customize to your heart's content.
30
+ =begin
31
+ # These two settings work together to allow you to limit a spec run
32
+ # to individual examples or groups you care about by tagging them with
33
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
34
+ # get run.
35
+ config.filter_run :focus
36
+ config.run_all_when_everything_filtered = true
37
+
38
+ # Many RSpec users commonly either run the entire suite or an individual
39
+ # file, and it's useful to allow more verbose output when running an
40
+ # individual spec file.
41
+ if config.files_to_run.one?
42
+ # Use the documentation formatter for detailed output,
43
+ # unless a formatter has already been configured
44
+ # (e.g. via a command-line flag).
45
+ config.default_formatter = 'doc'
46
+ end
47
+
48
+ # Print the 10 slowest examples and example groups at the
49
+ # end of the spec run, to help surface which specs are running
50
+ # particularly slow.
51
+ config.profile_examples = 10
52
+
53
+ # Run specs in random order to surface order dependencies. If you find an
54
+ # order dependency and want to debug it, you can fix the order by providing
55
+ # the seed, which is printed after each run.
56
+ # --seed 1234
57
+ config.order = :random
58
+
59
+ # Seed global randomization in this process using the `--seed` CLI option.
60
+ # Setting this allows you to use `--seed` to deterministically reproduce
61
+ # test failures related to randomization by passing the same `--seed` value
62
+ # as the one that triggered the failure.
63
+ Kernel.srand config.seed
64
+
65
+ # rspec-expectations config goes here. You can use an alternate
66
+ # assertion/expectation library such as wrong or the stdlib/minitest
67
+ # assertions if you prefer.
68
+ config.expect_with :rspec do |expectations|
69
+ # Enable only the newer, non-monkey-patching expect syntax.
70
+ # For more details, see:
71
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
72
+ expectations.syntax = :expect
73
+ end
74
+
75
+ # rspec-mocks config goes here. You can use an alternate test double
76
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
77
+ config.mock_with :rspec do |mocks|
78
+ # Enable only the newer, non-monkey-patching expect syntax.
79
+ # For more details, see:
80
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
81
+ mocks.syntax = :expect
82
+
83
+ # Prevents you from mocking or stubbing a method that does not exist on
84
+ # a real object. This is generally recommended.
85
+ mocks.verify_partial_doubles = true
86
+ end
87
+ =end
88
+ end
metadata ADDED
@@ -0,0 +1,132 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rspec-every_item
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - sue445
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-07-27 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: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.6'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.6'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: codeclimate-test-reporter
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: coveralls
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
+ description: Evaluate matcher in each array element
84
+ email:
85
+ - sue445@sue445.net
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".coveralls.yml"
91
+ - ".gitignore"
92
+ - ".rspec"
93
+ - ".travis.yml"
94
+ - Gemfile
95
+ - LICENSE.txt
96
+ - README.md
97
+ - Rakefile
98
+ - gemfiles/rspec2.gemfile
99
+ - gemfiles/rspec3.gemfile
100
+ - lib/rspec/every_item.rb
101
+ - lib/rspec/every_item/matchers.rb
102
+ - lib/rspec/every_item/version.rb
103
+ - rspec-every_item.gemspec
104
+ - spec/rspec/every_item_spec.rb
105
+ - spec/spec_helper.rb
106
+ homepage: https://github.com/sue445/rspec-every_item
107
+ licenses:
108
+ - MIT
109
+ metadata: {}
110
+ post_install_message:
111
+ rdoc_options: []
112
+ require_paths:
113
+ - lib
114
+ required_ruby_version: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ required_rubygems_version: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ requirements: []
125
+ rubyforge_project:
126
+ rubygems_version: 2.2.2
127
+ signing_key:
128
+ specification_version: 4
129
+ summary: Evaluate matcher in each array element
130
+ test_files:
131
+ - spec/rspec/every_item_spec.rb
132
+ - spec/spec_helper.rb