fear-rspec 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e127f0f76045f679472da9204c9d48290f1dadfb
4
+ data.tar.gz: 6bb25ff219b1501efe54a88fbb977cc2bedc6a11
5
+ SHA512:
6
+ metadata.gz: aa8b47f6e12227a3a0e36a7518a0c77c01e2f01b07572babdac3ef36d50198c1baf2f03dd1ea9a2f7d1a00cdaec267028e894538ccfa03d55cd8f5a9266a60e0
7
+ data.tar.gz: f48275d23dfb4472ec0164ca4d4c902c2ebafedb81731265e76b834960e43744214f3368c0b9ed805845ba3db3d9ee263c6e46e75ec74bf1f3372cc090a815d1
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ spec/examples.txt
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --require spec_helper
2
+ --format documentation
3
+ --color
data/.rubocop.yml ADDED
@@ -0,0 +1,8 @@
1
+ inherit_gem:
2
+ spbtv_code_style: .strict_rubocop.yml
3
+
4
+ Style/MethodName:
5
+ Enabled: false
6
+
7
+ Style/Documentation:
8
+ Enabled: false
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.5
4
+ script:
5
+ - rubocop -D
6
+ - bundle exec rspec spec
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in fear-rspec.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Artem Bolshakov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,67 @@
1
+ # Fear::Rspec
2
+
3
+ `fear-rspec` is a set of rspec matchers for [Fear](https://github.com/bolshakov/fear).
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'fear-rspec'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install fear-rspec
20
+
21
+ ## Usage
22
+
23
+ Load matchers:
24
+
25
+ ```ruby
26
+ require 'fear/rspec'
27
+ ```
28
+
29
+ ### Either matchers
30
+
31
+ To match against a `Left`, use `be_left_of` matcher.
32
+
33
+ ```ruby
34
+ expect(5).not_to be_left_of(5) # passes
35
+ expect(Left(5)).to be_left_of(5) # passes
36
+ expect(Left(1)).to be_left_of(5) # fails
37
+ expect(Right(5)).to be_left_of(5) # fails
38
+ ```
39
+
40
+ To match against a `Right`, use `be_right_of` matcher.
41
+
42
+ ```ruby
43
+ expect(5).not_to be_right_of(5) # passes
44
+ expect(Right(5)).to be_right_of(5) # passes
45
+ expect(Right(1)).to be_right_of(5) # fails
46
+ expect(Left(5)).to be_right_of(5) # fails
47
+ ```
48
+
49
+ ## Development
50
+
51
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
52
+
53
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
54
+
55
+ ## Contributing
56
+
57
+ 1. Fork it ( https://github.com/bolshakov/fear-rspec/fork )
58
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
59
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
60
+ 4. Push to the branch (`git push origin my-new-feature`)
61
+ 5. Create a new Pull Request
62
+
63
+
64
+ ## License
65
+
66
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
67
+
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'fear/rspec'
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require 'irb'
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,31 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'fear/rspec/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'fear-rspec'
8
+ spec.version = Fear::Rspec::VERSION
9
+ spec.authors = ['Tema Bolshakov']
10
+ spec.email = ['abolshakov@spbtv.com']
11
+
12
+ spec.summary = 'RSpec matchers for Fear gem'
13
+ spec.description = 'RSpec matchers for Fear gem'
14
+ spec.homepage = 'https://github.com/bolshakov/fear-rspec'
15
+ spec.license = 'MIT'
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ f.match(%r{^(test|spec|features)/})
19
+ end
20
+ spec.bindir = 'exe'
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ['lib']
23
+
24
+ spec.add_development_dependency 'bundler', '~> 1.13'
25
+ spec.add_development_dependency 'rake', '~> 10.0'
26
+ spec.add_development_dependency 'spbtv_code_style'
27
+ spec.add_development_dependency 'rubocop-rspec'
28
+
29
+ spec.add_runtime_dependency 'rspec', '~> 3.0'
30
+ spec.add_runtime_dependency 'fear', '>= 0.1.0'
31
+ end
@@ -0,0 +1,41 @@
1
+ module Fear
2
+ module RSpec
3
+ # Passes if `actual` is Left and matches `expected`.
4
+ #
5
+ # @example
6
+ # expect(5).not_to be_left_of(5)
7
+ # expect(Left(5)).to be_left_of(5)
8
+ #
9
+ ::RSpec::Matchers.define :be_left_of do |expected|
10
+ match do |actual|
11
+ actual.is_a?(Fear::Either) &&
12
+ actual.swap.any? do |value|
13
+ expected = with_matchers_cloned(expected)
14
+ ::RSpec::Support::FuzzyMatcher.values_match?(expected, value)
15
+ end
16
+ end
17
+
18
+ failure_message_when_negated do |actual|
19
+ format(
20
+ "\nexpected: not Left of %<expected>s\n got: %<actual>s\n",
21
+ expected: ::RSpec::Support::ObjectFormatter.format(expected),
22
+ actual: ::RSpec::Support::ObjectFormatter.format(actual),
23
+ )
24
+ end
25
+
26
+ failure_message do |actual|
27
+ format(
28
+ "\nexpected: Left of %<expected>s\n got: %<actual>s\n",
29
+ expected: ::RSpec::Support::ObjectFormatter.format(expected),
30
+ actual: ::RSpec::Support::ObjectFormatter.format(actual),
31
+ )
32
+ end
33
+
34
+ description do
35
+ "be Left of #{expected}"
36
+ end
37
+
38
+ diffable
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,41 @@
1
+ module Fear
2
+ module RSpec
3
+ # Passes if `actual` is Right and matches `expected`.
4
+ #
5
+ # @example
6
+ # expect(5).not_to be_right_of(5)
7
+ # expect(Right(5)).to be_right_of(5)
8
+ #
9
+ ::RSpec::Matchers.define :be_right_of do |expected|
10
+ match do |actual|
11
+ actual.is_a?(Fear::Either) &&
12
+ actual.any? do |value|
13
+ expected = with_matchers_cloned(expected)
14
+ ::RSpec::Support::FuzzyMatcher.values_match?(expected, value)
15
+ end
16
+ end
17
+
18
+ failure_message_when_negated do |actual|
19
+ format(
20
+ "\nexpected: not Right of %<expected>s\n got: %<actual>s\n",
21
+ expected: ::RSpec::Support::ObjectFormatter.format(expected),
22
+ actual: ::RSpec::Support::ObjectFormatter.format(actual),
23
+ )
24
+ end
25
+
26
+ failure_message do |actual|
27
+ format(
28
+ "\nexpected: Right of %<expected>s\n got: %<actual>s\n",
29
+ expected: ::RSpec::Support::ObjectFormatter.format(expected),
30
+ actual: ::RSpec::Support::ObjectFormatter.format(actual),
31
+ )
32
+ end
33
+
34
+ description do
35
+ "be Right of #{expected}"
36
+ end
37
+
38
+ diffable
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,5 @@
1
+ module Fear
2
+ module Rspec
3
+ VERSION = '0.1.0'.freeze
4
+ end
5
+ end
data/lib/fear/rspec.rb ADDED
@@ -0,0 +1,10 @@
1
+ require 'fear/rspec/version'
2
+ require 'fear'
3
+ require 'rspec/matchers'
4
+
5
+ module Fear
6
+ module RSpec
7
+ require 'fear/rspec/be_left_of'
8
+ require 'fear/rspec/be_right_of'
9
+ end
10
+ end
metadata ADDED
@@ -0,0 +1,143 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fear-rspec
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Tema Bolshakov
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-12-12 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.13'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.13'
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: spbtv_code_style
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: rubocop-rspec
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: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: fear
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: 0.1.0
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: 0.1.0
97
+ description: RSpec matchers for Fear gem
98
+ email:
99
+ - abolshakov@spbtv.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".gitignore"
105
+ - ".rspec"
106
+ - ".rubocop.yml"
107
+ - ".travis.yml"
108
+ - Gemfile
109
+ - LICENSE.txt
110
+ - README.md
111
+ - Rakefile
112
+ - bin/console
113
+ - bin/setup
114
+ - fear-rspec.gemspec
115
+ - lib/fear/rspec.rb
116
+ - lib/fear/rspec/be_left_of.rb
117
+ - lib/fear/rspec/be_right_of.rb
118
+ - lib/fear/rspec/version.rb
119
+ homepage: https://github.com/bolshakov/fear-rspec
120
+ licenses:
121
+ - MIT
122
+ metadata: {}
123
+ post_install_message:
124
+ rdoc_options: []
125
+ require_paths:
126
+ - lib
127
+ required_ruby_version: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ required_rubygems_version: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ requirements: []
138
+ rubyforge_project:
139
+ rubygems_version: 2.5.1
140
+ signing_key:
141
+ specification_version: 4
142
+ summary: RSpec matchers for Fear gem
143
+ test_files: []