rspec_support_methods 0.0.1

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: e16c8b720fddd458eb5b194ba31631b958739a40
4
+ data.tar.gz: d485630721cfdc8ab7e1b47c79b747c2a52b18af
5
+ SHA512:
6
+ metadata.gz: 87e7e65ab23451a5ee68f93b30088e1e84bbf370ae5c64319bdac4884d98c13f30bdd9470c5296b51ecacd8a6aeaa23d9650f3a752658bea187f5027ea92dcb8
7
+ data.tar.gz: dccffe0795a144ee2c3e1e7e37f92a961991ed2ca3363a4e1cc7627b89d37c15adfeadbeb0f7b2fdf58ae815db227fa6467698a084f060c994f7047c3cfe8525
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/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ rspec_support_methods
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.2.0
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rspec_support_methods.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Agnieszka Matysek
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,74 @@
1
+ # RspecSupportMethods
2
+
3
+ This is gem with helpers methods for RSpec
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'rspec_support_methods'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install rspec_support_methods
20
+
21
+ ## Setup
22
+
23
+ In your `spec_helper.rb` or `rails_helper.rb` add this:
24
+
25
+ ```ruby
26
+ require 'rspec_support_methods'
27
+ ```
28
+
29
+ For include all helpers methods add to `RSpec` configutation:
30
+
31
+ ```ruby
32
+ RSpec.configure do |config|
33
+ config.include RspecSupportMethods
34
+ end
35
+ ```
36
+
37
+ or you can use only specific module:
38
+
39
+ ```ruby
40
+ RSpec.configure do |config|
41
+ config.include RspecSupportMethods::Randomizer
42
+ config.include RspecSupportMethods::TemporaryFile
43
+ end
44
+
45
+ ```
46
+
47
+ ## Usage
48
+
49
+ You can use helpers methods:
50
+
51
+ ```ruby
52
+ rand_email(size) # default 5
53
+ # => "hckjy@example.com"
54
+
55
+ rand_text(size) # default 5
56
+ # => "lgdbf"
57
+
58
+ rand_fixnum(min, max)
59
+ # => 2
60
+
61
+ rand_date
62
+ # => "24-12-2007"
63
+
64
+ temp_file(content_of_file)
65
+ # => #<File:/tmp/tmp20150225-10087-8o38oh (closed)>
66
+ ```
67
+
68
+ ## Contributing
69
+
70
+ 1. Fork it ( https://github.com/fractalsoft/rspec_support_methods/fork )
71
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
72
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
73
+ 4. Push to the branch (`git push origin my-new-feature`)
74
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
@@ -0,0 +1,6 @@
1
+ Dir["#{__dir__}/rspec_support_methods/*.rb"].each { |file| require file }
2
+
3
+ module RspecSupportMethods
4
+ include Randomizer
5
+ include TemporaryFile
6
+ end
@@ -0,0 +1,21 @@
1
+ module RspecSupportMethods
2
+ # Helper methods for ramdom data
3
+ module Randomizer
4
+ def rand_email(size = 5)
5
+ "#{rand_text(size)}@example.com"
6
+ end
7
+
8
+ def rand_text(size = 5)
9
+ ('a'..'z').to_a.sample(size).join
10
+ end
11
+
12
+ def rand_fixnum(minimum, maximum)
13
+ (minimum..maximum).to_a.sample
14
+ end
15
+
16
+ def rand_date
17
+ year = Time.now.year - 1
18
+ "#{rand_fixnum(1, 28)}-#{rand_fixnum(1, 12)}-#{rand_fixnum(1960, year)}"
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,11 @@
1
+ module RspecSupportMethods
2
+ # Helper method for temporary file
3
+ module TemporaryFile
4
+ def temp_file(text)
5
+ file = Tempfile.new('tmp')
6
+ file.write(text)
7
+ file.close
8
+ file
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,3 @@
1
+ module RspecSupportMethods
2
+ VERSION = '0.0.1'
3
+ end
@@ -0,0 +1,21 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'rspec_support_methods/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'rspec_support_methods'
8
+ spec.version = RspecSupportMethods::VERSION
9
+ spec.authors = ['Agnieszka Matysek']
10
+ spec.email = ['amatysek@fractalsoft.org']
11
+ spec.summary = 'Helpers methods for RSpec'
12
+ spec.license = 'MIT'
13
+
14
+ spec.files = `git ls-files -z`.split("\x0")
15
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
16
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
17
+ spec.require_paths = ['lib']
18
+
19
+ spec.add_development_dependency 'bundler', '~> 1.7'
20
+ spec.add_development_dependency 'rake', '~> 10.0'
21
+ end
metadata ADDED
@@ -0,0 +1,84 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rspec_support_methods
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Agnieszka Matysek
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-02-25 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
+ description:
42
+ email:
43
+ - amatysek@fractalsoft.org
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - ".ruby-gemset"
50
+ - ".ruby-version"
51
+ - Gemfile
52
+ - LICENSE.txt
53
+ - README.md
54
+ - Rakefile
55
+ - lib/rspec_support_methods.rb
56
+ - lib/rspec_support_methods/randomizer.rb
57
+ - lib/rspec_support_methods/temporary_file.rb
58
+ - lib/rspec_support_methods/version.rb
59
+ - rspec_support_methods.gemspec
60
+ homepage:
61
+ licenses:
62
+ - MIT
63
+ metadata: {}
64
+ post_install_message:
65
+ rdoc_options: []
66
+ require_paths:
67
+ - lib
68
+ required_ruby_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ required_rubygems_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ requirements: []
79
+ rubyforge_project:
80
+ rubygems_version: 2.4.5
81
+ signing_key:
82
+ specification_version: 4
83
+ summary: Helpers methods for RSpec
84
+ test_files: []