rspec_typeof 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 +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/README.md +26 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/lib/rspec_typeof/typeof.rb +15 -0
- data/lib/rspec_typeof/version.rb +3 -0
- data/lib/rspec_typeof.rb +5 -0
- data/rspec_typeof.gemspec +25 -0
- metadata +96 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8cbffd9c82697572f78a5d030baded69a49b11aa
|
4
|
+
data.tar.gz: ebdba4717f5e937e37d60bf25126c843eb8326e7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: cee2aab648915d0f62c8fd0ee4a6c1594dca8b59baf59ecfa96e828a292f1f6c2d3bc0934e8bbcd2685a8eed0b68f53786ab5aac55e640bd536cc449df84f06b
|
7
|
+
data.tar.gz: d4e60e2796b8079099100d81ef940f1854ba71caaa93f0357d93351b26beffc876d57b7c8c41b714fc15c5fbb6b8127be5c649ca656dced4c628ac5cb14ca36e
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# RspecTypeof
|
2
|
+
|
3
|
+
Welcome to rspec_typeof, with this gem you can use "typeof" expectation to your tests
|
4
|
+
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile in the group :development, :test:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'rspec_typeof'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
$ bundle
|
17
|
+
|
18
|
+
## Usage
|
19
|
+
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
expect(true).to typeof(:string_or_nil_or_true)
|
23
|
+
```
|
24
|
+
|
25
|
+
## Contributing
|
26
|
+
Send improvement propositions, bug reports and pull requests on GitHub at https://github.com/Somiel/rspec_typeof.
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "rspec_typeof"
|
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,15 @@
|
|
1
|
+
require "rspec"
|
2
|
+
RSpec::Matchers.define :typeof do |expected_types|
|
3
|
+
matching_map = { 'nil' => 'NilClass', 'false' => 'FalseClass', 'true' => 'TrueClass' }
|
4
|
+
types = expected_types.to_s.split('_or_').uniq.map{ |v| matching_map.include?(v) ? matching_map[v] : v.capitalize }
|
5
|
+
|
6
|
+
match do |actual|
|
7
|
+
expect(actual).to satisfy do |x|
|
8
|
+
types.include?(x.class.name)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
failure_message do |actual|
|
13
|
+
"expected that #{actual} would be an instance of"
|
14
|
+
end
|
15
|
+
end
|
data/lib/rspec_typeof.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'rspec_typeof/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "rspec_typeof"
|
8
|
+
spec.version = RspecTypeof::VERSION
|
9
|
+
spec.authors = ["Vovchuk Max"]
|
10
|
+
spec.email = ["vovchuk.max@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Add be_typeof to Rspec}
|
13
|
+
spec.description = %q{Add be_typeof to Rspec}
|
14
|
+
spec.homepage = "https://github.com/Somiel/rspec_typeof"
|
15
|
+
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
spec.add_dependency 'rspec', '~> 3.3'
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.12"
|
24
|
+
spec.add_development_dependency "rake", "~> 11.2"
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rspec_typeof
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.1'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Vovchuk Max
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-11-07 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: '3.3'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.3'
|
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.12'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.12'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '11.2'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '11.2'
|
55
|
+
description: Add be_typeof to Rspec
|
56
|
+
email:
|
57
|
+
- vovchuk.max@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- ".rspec"
|
64
|
+
- Gemfile
|
65
|
+
- README.md
|
66
|
+
- Rakefile
|
67
|
+
- bin/console
|
68
|
+
- bin/setup
|
69
|
+
- lib/rspec_typeof.rb
|
70
|
+
- lib/rspec_typeof/typeof.rb
|
71
|
+
- lib/rspec_typeof/version.rb
|
72
|
+
- rspec_typeof.gemspec
|
73
|
+
homepage: https://github.com/Somiel/rspec_typeof
|
74
|
+
licenses: []
|
75
|
+
metadata: {}
|
76
|
+
post_install_message:
|
77
|
+
rdoc_options: []
|
78
|
+
require_paths:
|
79
|
+
- lib
|
80
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
85
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
requirements: []
|
91
|
+
rubyforge_project:
|
92
|
+
rubygems_version: 2.5.1
|
93
|
+
signing_key:
|
94
|
+
specification_version: 4
|
95
|
+
summary: Add be_typeof to Rspec
|
96
|
+
test_files: []
|