test_suite 0.1.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 +11 -0
- data/.rspec +3 -0
- data/.travis.yml +7 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +35 -0
- data/README.md +75 -0
- data/Rakefile +6 -0
- data/lib/test_suite.rb +75 -0
- data/lib/test_suite/version.rb +3 -0
- data/test_suite.gemspec +35 -0
- metadata +97 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: fe9e1a99368480cfe054823027967cd9e7d8fe9c7a446dcd0cf43627944ec506
|
4
|
+
data.tar.gz: 6050fc56d70ad3c8e39f85cbc4434e9371511638f249975019c69f99e803ea57
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8d26d5c0a1113f33eb578ef287c7dac1f2a4a9fb8db848b2c7da1a71bd30e7d101c0e7a2d0ae034ad6f6bdbd8dded5ccf09b48d93789e7d92b9d76ffaed27f3a
|
7
|
+
data.tar.gz: b73a7a74c26c59746d9ae18ba9bac0162daf1d370c5e42557c12d044c9541309fc7e6996fcf3da9b6a56284240bce0632d87cff8794aef3b24fc0acc6e7a8712
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
test_suite (0.1.1)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
diff-lcs (1.3)
|
10
|
+
rake (10.5.0)
|
11
|
+
rspec (3.8.0)
|
12
|
+
rspec-core (~> 3.8.0)
|
13
|
+
rspec-expectations (~> 3.8.0)
|
14
|
+
rspec-mocks (~> 3.8.0)
|
15
|
+
rspec-core (3.8.0)
|
16
|
+
rspec-support (~> 3.8.0)
|
17
|
+
rspec-expectations (3.8.2)
|
18
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
19
|
+
rspec-support (~> 3.8.0)
|
20
|
+
rspec-mocks (3.8.0)
|
21
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
22
|
+
rspec-support (~> 3.8.0)
|
23
|
+
rspec-support (3.8.0)
|
24
|
+
|
25
|
+
PLATFORMS
|
26
|
+
ruby
|
27
|
+
|
28
|
+
DEPENDENCIES
|
29
|
+
bundler (~> 1.16)
|
30
|
+
rake (~> 10.0)
|
31
|
+
rspec (~> 3.0)
|
32
|
+
test_suite!
|
33
|
+
|
34
|
+
BUNDLED WITH
|
35
|
+
1.16.6
|
data/README.md
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
# TestSuite
|
2
|
+
|
3
|
+
This Test suite represents a several methods, that allows you to do next things with your objects - check the type, make a conversions and work with hashes.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'test_suite'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install test_suite
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
For using test_suite gem in your application you have to require it and call it (where you want) with next command - TestSuite.name _of _method(parameter). You can use this methods:
|
24
|
+
|
25
|
+
- hash?
|
26
|
+
|
27
|
+
- array?
|
28
|
+
|
29
|
+
- number?
|
30
|
+
|
31
|
+
- string?
|
32
|
+
|
33
|
+
- symbol?
|
34
|
+
|
35
|
+
- hash_empty?
|
36
|
+
|
37
|
+
- hash_value_greater_nil?
|
38
|
+
|
39
|
+
- hash_has_two_keys?
|
40
|
+
|
41
|
+
- to_s
|
42
|
+
|
43
|
+
- to_i
|
44
|
+
|
45
|
+
- to_sym
|
46
|
+
|
47
|
+
- str_ to_arr
|
48
|
+
|
49
|
+
In parameter you can use whatever you want.
|
50
|
+
|
51
|
+
## Example
|
52
|
+
|
53
|
+
module Tasks
|
54
|
+
def self.math2(x, y)
|
55
|
+
s = ((x.abs - y.abs) / (1 + (x * y).abs)).round(4)
|
56
|
+
{ result: s }
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
TestSuite.hash_has_two_keys?(Tasks.math2(-6.0, -2))
|
61
|
+
|
62
|
+
Сonsole output:
|
63
|
+
|
64
|
+
Hash has one key
|
65
|
+
Hash key(s): [:result]
|
66
|
+
|
67
|
+
## Development
|
68
|
+
|
69
|
+
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.
|
70
|
+
|
71
|
+
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).
|
72
|
+
|
73
|
+
## Contributing
|
74
|
+
|
75
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/test_suite.
|
data/Rakefile
ADDED
data/lib/test_suite.rb
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
require "test_suite/version"
|
2
|
+
|
3
|
+
module TestSuite
|
4
|
+
class << self
|
5
|
+
# object type
|
6
|
+
def hash?(actual)
|
7
|
+
puts actual.is_a?(Hash) ? "Object is a hash" : "Object is not a hash"
|
8
|
+
puts "Object: #{actual}"
|
9
|
+
end
|
10
|
+
|
11
|
+
def array?(actual)
|
12
|
+
puts actual.is_a?(Array) ? "Object is an array" : "Object is not an array"
|
13
|
+
puts "Object: #{actual}"
|
14
|
+
end
|
15
|
+
|
16
|
+
def number?(actual)
|
17
|
+
puts actual.is_a?(Numeric) ? "Object is a number" : "Object is not a number"
|
18
|
+
puts "Object: #{actual}"
|
19
|
+
end
|
20
|
+
|
21
|
+
def string?(actual)
|
22
|
+
puts actual.is_a?(String) ? "Object is a string" : "Object is not a string"
|
23
|
+
puts "Object: #{actual}"
|
24
|
+
end
|
25
|
+
|
26
|
+
def symbol?(actual)
|
27
|
+
puts actual.is_a?(Symbol) ? "Object is a symbol" : "Object is not a symbol"
|
28
|
+
puts "Object: #{actual}"
|
29
|
+
end
|
30
|
+
|
31
|
+
# work with hashes
|
32
|
+
def hash_empty?(actual)
|
33
|
+
puts actual.empty? ? "Hash is empty" : "Hash is not empty"
|
34
|
+
puts "Hash: #{actual}"
|
35
|
+
end
|
36
|
+
|
37
|
+
def hash_value_greater_nil?(actual)
|
38
|
+
arr = []
|
39
|
+
actual.each_value { |val| arr << val if val > 0 }
|
40
|
+
puts arr.size == actual.size ? "All hash values are greater than 0" : "Hash has value(s) equal/less than nil"
|
41
|
+
puts "Hash value(s): #{actual.values}"
|
42
|
+
end
|
43
|
+
|
44
|
+
def hash_has_two_keys?(actual)
|
45
|
+
if actual.empty?
|
46
|
+
puts "Hash is empty"
|
47
|
+
else
|
48
|
+
puts actual.size > 1 ? "Hash has 2 or more keys" : "Hash has one key"
|
49
|
+
puts "Hash key(s): #{actual.keys}"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# object conversion
|
54
|
+
def to_s(actual)
|
55
|
+
puts "Object was converted to string type"
|
56
|
+
puts "It is #{actual.to_s.inspect} now"
|
57
|
+
end
|
58
|
+
|
59
|
+
def to_i(actual)
|
60
|
+
puts "Object was converted to numeric type"
|
61
|
+
puts "It is #{actual.to_i} now"
|
62
|
+
end
|
63
|
+
|
64
|
+
def to_sym(actual)
|
65
|
+
actual = actual.to_s if actual.is_a?(Numeric)
|
66
|
+
puts "Object was converted to symbol type"
|
67
|
+
puts "It is #{actual.to_sym.inspect} now"
|
68
|
+
end
|
69
|
+
|
70
|
+
def str_to_arr(actual)
|
71
|
+
puts "Object was converted to an array"
|
72
|
+
puts "It is #{actual.split.inspect} now"
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
data/test_suite.gemspec
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "test_suite/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "test_suite"
|
8
|
+
spec.version = TestSuite::VERSION
|
9
|
+
spec.authors = ["SangVinya"]
|
10
|
+
spec.email = ["vano1861@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Test suite with methods for testing}
|
13
|
+
spec.description = %q{Gem helps to do next things with your objects - check the type, make a conversions and work with hashes}
|
14
|
+
spec.homepage = "https://github.com/SangVinya/gem_test_suite"
|
15
|
+
|
16
|
+
if spec.respond_to?(:metadata)
|
17
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
18
|
+
else
|
19
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
20
|
+
"public gem pushes."
|
21
|
+
end
|
22
|
+
|
23
|
+
# Specify which files should be added to the gem when it is released.
|
24
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
25
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
26
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
27
|
+
end
|
28
|
+
spec.bindir = "exe"
|
29
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
30
|
+
spec.require_paths = ["lib"]
|
31
|
+
|
32
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
33
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
34
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
35
|
+
end
|
metadata
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: test_suite
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- SangVinya
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-11-05 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.16'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.16'
|
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.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
description: Gem helps to do next things with your objects - check the type, make
|
56
|
+
a conversions and work with hashes
|
57
|
+
email:
|
58
|
+
- vano1861@gmail.com
|
59
|
+
executables: []
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- ".gitignore"
|
64
|
+
- ".rspec"
|
65
|
+
- ".travis.yml"
|
66
|
+
- Gemfile
|
67
|
+
- Gemfile.lock
|
68
|
+
- README.md
|
69
|
+
- Rakefile
|
70
|
+
- lib/test_suite.rb
|
71
|
+
- lib/test_suite/version.rb
|
72
|
+
- test_suite.gemspec
|
73
|
+
homepage: https://github.com/SangVinya/gem_test_suite
|
74
|
+
licenses: []
|
75
|
+
metadata:
|
76
|
+
allowed_push_host: https://rubygems.org
|
77
|
+
post_install_message:
|
78
|
+
rdoc_options: []
|
79
|
+
require_paths:
|
80
|
+
- lib
|
81
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
requirements: []
|
92
|
+
rubyforge_project:
|
93
|
+
rubygems_version: 2.7.8
|
94
|
+
signing_key:
|
95
|
+
specification_version: 4
|
96
|
+
summary: Test suite with methods for testing
|
97
|
+
test_files: []
|