meszaros 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in meszaros.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Bala Paranj
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,31 @@
1
+ # Meszaros
2
+
3
+ TODO: Mixin the utility without using the prefix Meszaros::Loop
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'meszaros'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install meszaros
18
+
19
+ ## Usage
20
+
21
+ Look at the specs for usage instructions. Run specs by :
22
+
23
+ rspec spec/meszaros/loop_spec.rb --format doc
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork it
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -0,0 +1,14 @@
1
+
2
+ module Meszaros
3
+ class Loop
4
+ def self.data_driven_spec(container)
5
+ container.each do |element|
6
+ yield element
7
+ end
8
+ end
9
+
10
+ def self.repeat(n)
11
+ n.times { yield }
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,3 @@
1
+ module Meszaros
2
+ VERSION = "0.0.1"
3
+ end
data/lib/meszaros.rb ADDED
@@ -0,0 +1,5 @@
1
+ require "meszaros/version"
2
+
3
+ module Meszaros
4
+ # Your code goes here...
5
+ end
data/meszaros.gemspec ADDED
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/meszaros/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Bala Paranj"]
6
+ gem.email = ["bparanj@gmail.com"]
7
+ gem.description = %q{xUnit Test Patterns related utilities for RSpec}
8
+ gem.summary = %q{xUnit Test Patterns related utilities for RSpec}
9
+ gem.homepage = ""
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "meszaros"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = Meszaros::VERSION
17
+
18
+ gem.add_development_dependency "rspec"
19
+ end
@@ -0,0 +1,97 @@
1
+ require 'spec_helper'
2
+ require 'meszaros/loop'
3
+
4
+ module Meszaros
5
+ describe Loop do
6
+ it "should allow data driven spec : 0" do
7
+ x = []
8
+ Loop.data_driven_spec([]) do |element|
9
+ x << element
10
+ end
11
+
12
+ x.should == []
13
+ end
14
+
15
+ it "should allow data driven spec : 1" do
16
+ x = []
17
+ Loop.data_driven_spec([4]) do |element|
18
+ x << element
19
+ end
20
+
21
+ x.should == [4]
22
+ end
23
+
24
+ it "should allow data driven spec : n" do
25
+ x = []
26
+ Loop.data_driven_spec([1,2,3,4]) do |element|
27
+ x << element
28
+ end
29
+
30
+ x.should == [1,2,3,4]
31
+ end
32
+
33
+ it "should raise exception when nil is passed as the parameter to data driven spec" do
34
+ expect do
35
+ Loop.data_driven_spec(nil) do |element|
36
+ true.should be_true
37
+ end
38
+ end.to raise_error
39
+
40
+ end
41
+
42
+ it "should allow execution of a chunk of code for 0 number of times" do
43
+ x = 0
44
+
45
+ Loop.repeat(0) do
46
+ x += 1
47
+ end
48
+
49
+ x.should == 0
50
+ end
51
+
52
+ it "should allow execution of a chunk of code for 1 number of times" do
53
+ x = 0
54
+
55
+ Loop.repeat(1) do
56
+ x += 1
57
+ end
58
+
59
+ x.should == 1
60
+ end
61
+
62
+ it "should raise exception when nil is passed for the parameter to repeat" do
63
+ expect do
64
+ Loop.repeat(nil) do
65
+ true.should be_true
66
+ end
67
+ end.to raise_error
68
+
69
+ end
70
+
71
+ it "should raise exception when string is passed for the parameter to repeat" do
72
+ expect do
73
+ Loop.repeat("dumb") do
74
+ true.should be_true
75
+ end
76
+ end.to raise_error
77
+ end
78
+
79
+ it "should raise exception when float is passed for the parameter to repeat" do
80
+ expect do
81
+ Loop.repeat(2.2) do
82
+ true.should be_true
83
+ end
84
+ end.to raise_error
85
+ end
86
+
87
+ it "should allow execution of a chunk of code for n number of times" do
88
+ x = 0
89
+
90
+ Loop.repeat(3) do
91
+ x += 1
92
+ end
93
+
94
+ x.should == 3
95
+ end
96
+ end
97
+ end
@@ -0,0 +1,11 @@
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
+ # Require this file using `require "spec_helper.rb"` to ensure that it is only
4
+ # loaded once.
5
+ #
6
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7
+ RSpec.configure do |config|
8
+ config.treat_symbols_as_metadata_keys_with_true_values = true
9
+ config.run_all_when_everything_filtered = true
10
+ config.filter_run :focus
11
+ end
metadata ADDED
@@ -0,0 +1,77 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: meszaros
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.1
6
+ platform: ruby
7
+ authors:
8
+ - Bala Paranj
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2012-05-17 00:00:00 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rspec
17
+ prerelease: false
18
+ requirement: &id001 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ type: :development
25
+ version_requirements: *id001
26
+ description: xUnit Test Patterns related utilities for RSpec
27
+ email:
28
+ - bparanj@gmail.com
29
+ executables: []
30
+
31
+ extensions: []
32
+
33
+ extra_rdoc_files: []
34
+
35
+ files:
36
+ - .gitignore
37
+ - .rspec
38
+ - Gemfile
39
+ - LICENSE
40
+ - README.md
41
+ - Rakefile
42
+ - lib/meszaros.rb
43
+ - lib/meszaros/loop.rb
44
+ - lib/meszaros/version.rb
45
+ - meszaros.gemspec
46
+ - spec/meszaros/loop_spec.rb
47
+ - spec/spec_helper.rb
48
+ homepage: ""
49
+ licenses: []
50
+
51
+ post_install_message:
52
+ rdoc_options: []
53
+
54
+ require_paths:
55
+ - lib
56
+ required_ruby_version: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: "0"
62
+ required_rubygems_version: !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: "0"
68
+ requirements: []
69
+
70
+ rubyforge_project:
71
+ rubygems_version: 1.8.15
72
+ signing_key:
73
+ specification_version: 3
74
+ summary: xUnit Test Patterns related utilities for RSpec
75
+ test_files:
76
+ - spec/meszaros/loop_spec.rb
77
+ - spec/spec_helper.rb