be_an_existing_path-matcher 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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b3ffc893d6dbfea9055dc6373b8594d2528ddd24
4
+ data.tar.gz: f6d28505b046cb760f56e3d4c0e7e92d54f7d800
5
+ SHA512:
6
+ metadata.gz: 697e30c11820153023b220ab327102ce475454e12da86cc45c8699708dae3e89fe320c1d979cb5b1d957b86d72646e4603de0b0109414855e1d6888ef16c0cfd
7
+ data.tar.gz: 698ffdff7bfa06f8ad7c8c61bb19291f8e54f4395a491d8c569d8386a9b4bc44cbc8ec8a840fd68eb6a3f5394bf38ac201ece63c49cfd244ea2618298302ccd6
data/.gitignore ADDED
@@ -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,2 @@
1
+ --color
2
+ --require spec_helper
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in be_an_existing_path-matcher.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Bruno Pedro
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.
data/README.md ADDED
@@ -0,0 +1,56 @@
1
+ # `be_an_existing_path` [RSpec](http://rspec.info/) matcher
2
+
3
+ An RSpec matcher that checks if a given path exists.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'be_an_existing_path-matcher'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install be_an_existing_path-matcher
20
+
21
+ ## Usage
22
+
23
+ `require` this gem on your `spec_helper.rb`:
24
+
25
+ ```ruby
26
+ require 'be_an_existing_path'
27
+ ```
28
+
29
+ Use it on any tests to check if a path exists, e.g.:
30
+
31
+ ```ruby
32
+ RSpec.describe YourClass do
33
+ let(:existing_path) { 'EXISTING_PATH' }
34
+ let(:non_existing_path) { 'NON_EXISTING_PATH' }
35
+
36
+ describe '#initialize' do
37
+ context 'when the path exists' do
38
+ subject { existing_path }
39
+ it { is_expected.to be_an_existing_path }
40
+ end
41
+
42
+ context 'when the path doesn\'t exist' do
43
+ subject { non_existing_path }
44
+ it { is_expected.not_to be_an_existing_path }
45
+ end
46
+ end
47
+ end
48
+ ```
49
+
50
+ ## Contributing
51
+
52
+ 1. Fork it ( https://github.com/[my-github-username]/be_an_existing_path-matcher/fork )
53
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
54
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
55
+ 4. Push to the branch (`git push origin my-new-feature`)
56
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'be_an_existing_path/matcher/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'be_an_existing_path-matcher'
8
+ spec.version = BeAnExistingPath::Matcher::VERSION
9
+ spec.authors = ['Bruno Pedro']
10
+ spec.email = ['bpedro@brunopedro.com']
11
+ spec.summary = 'RSpec matchers that checks if a path exists.'
12
+ spec.description = 'An RSpec matcher that checks if a given path exists.'
13
+ spec.homepage = 'https://github.com/bpedro/be_an_existing_path-matcher'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(/^bin\//) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(/^(test|spec|features)\//)
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_development_dependency 'bundler', '~> 1.7'
22
+ spec.add_development_dependency 'rake', '~> 10.0'
23
+
24
+ spec.add_dependency 'rspec', '~> 3.2.0'
25
+
26
+ puts spec.files
27
+ end
@@ -0,0 +1,33 @@
1
+ # Check if a given path exists.
2
+ #
3
+ # `be_an_existing_path` is a matcher that verifies
4
+ # if the subject path exists on the filesystem.
5
+ #
6
+ # It provides two failure messages:
7
+ # * when expecting a positive result
8
+ # * when expecting a negative result
9
+ #
10
+ # Example usage:
11
+ #
12
+ # ```ruby
13
+ # context 'when the path exists' do
14
+ # subject { '/some/path' }
15
+ # it { is_expected.to be_an_existing_path }
16
+ # end
17
+ #
18
+ # context 'when the path does not exist' do
19
+ # subject { '/some/other/path' }
20
+ # it { is_expected.not_to be_an_existing_path }
21
+ # end
22
+ # ```
23
+ RSpec::Matchers.define :be_an_existing_path do
24
+ match do |path|
25
+ File.exist?(path)
26
+ end
27
+ failure_message do |path|
28
+ "expected that #{path} would exist"
29
+ end
30
+ failure_message_when_negated do |path|
31
+ "expected that #{path} would not exist"
32
+ end
33
+ end
@@ -0,0 +1,10 @@
1
+ require 'be_an_existing_path/matcher/version'
2
+
3
+ # Base namespace
4
+ module BeAnExistingPath
5
+ # Main module
6
+ module Matcher
7
+ def initialize
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,7 @@
1
+ # Base namespace
2
+ module BeAnExistingPath
3
+ # Main module
4
+ module Matcher
5
+ VERSION = '0.0.1'
6
+ end
7
+ end
@@ -0,0 +1,16 @@
1
+ RSpec.describe BeAnExistingPath::Matcher do
2
+ let(:existing_path) { 'Gemfile' }
3
+ let(:non_existing_path) { 'elifemG' }
4
+
5
+ describe '#initialize' do
6
+ context 'when the path exists' do
7
+ subject { existing_path }
8
+ it { is_expected.to be_an_existing_path }
9
+ end
10
+
11
+ context 'when the path doesn\'t exist' do
12
+ subject { non_existing_path }
13
+ it { is_expected.not_to be_an_existing_path }
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,35 @@
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
4
+ # this file to always be loaded, without a need to explicitly require it in any
5
+ # files.
6
+ #
7
+ # Given that it is always loaded, you are encouraged to keep this file as
8
+ # light-weight as possible. Requiring heavyweight dependencies from this file
9
+ # will add to the boot time of your test suite on EVERY test run, even for an
10
+ # individual file that may not need all of that loaded. Instead, consider making
11
+ # a separate helper file that requires the additional dependencies and performs
12
+ # the additional setup, and require it from the spec files that actually need
13
+ # it.
14
+ #
15
+ # The `.rspec` file also contains a few flags that are not defaults but that
16
+ # users commonly want.
17
+ #
18
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
19
+ RSpec.configure do |config|
20
+ # rspec-expectations config goes here. You can use an alternate
21
+ # assertion/expectation library such as wrong or the stdlib/minitest
22
+ # assertions if you prefer.
23
+ config.expect_with :rspec do |expectations|
24
+ # This option will default to `true` in RSpec 4. It makes the `description`
25
+ # and `failure_message` of custom matchers include text for helper methods
26
+ # defined using `chain`, e.g.:
27
+ # be_bigger_than(2).and_smaller_than(4).description
28
+ # # => "be bigger than 2 and smaller than 4"
29
+ # ...rather than:
30
+ # # => "be bigger than 2"
31
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
32
+ end
33
+ end
34
+
35
+ require 'be_an_existing_path.rb'
metadata ADDED
@@ -0,0 +1,101 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: be_an_existing_path-matcher
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Bruno Pedro
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-03-13 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 3.2.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 3.2.0
55
+ description: An RSpec matcher that checks if a given path exists.
56
+ email:
57
+ - bpedro@brunopedro.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".rspec"
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - be_an_existing_path-matcher.gemspec
69
+ - lib/be_an_existing_path.rb
70
+ - lib/be_an_existing_path/matcher.rb
71
+ - lib/be_an_existing_path/matcher/version.rb
72
+ - spec/lib/be_an_existing_path_spec.rb
73
+ - spec/spec_helper.rb
74
+ homepage: https://github.com/bpedro/be_an_existing_path-matcher
75
+ licenses:
76
+ - MIT
77
+ metadata: {}
78
+ post_install_message:
79
+ rdoc_options: []
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ requirements: []
93
+ rubyforge_project:
94
+ rubygems_version: 2.4.1
95
+ signing_key:
96
+ specification_version: 4
97
+ summary: RSpec matchers that checks if a path exists.
98
+ test_files:
99
+ - spec/lib/be_an_existing_path_spec.rb
100
+ - spec/spec_helper.rb
101
+ has_rdoc: