freeman 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +71 -0
- data/Rakefile +1 -0
- data/freeman.gemspec +23 -0
- data/lib/freeman.rb +30 -0
- metadata +79 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 821d64fc1bb0846fd1c6f63cf8d540aad84e4594
|
4
|
+
data.tar.gz: bef39006e31f3402f63f090d036bde5a420818f9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 71ce899f7348d0d790df5d731675062c5115b535689e215c1b1ceb8e808c8b3a1197ea026638983116cb5b0cac8eec24577b27b40387304e6c070091538bc79a
|
7
|
+
data.tar.gz: 649a877506a56dd74fe1b3b95d5302b950ccd3dbebd7f20b0d93edaf4f68e2c8d3099a12987af1e2a0e51fe69b33923c461fe4e4304e0680d05fd2c1e6425f97
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Kristian Freeman
|
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,71 @@
|
|
1
|
+
# Freeman
|
2
|
+
|
3
|
+
A simple (experimental) test gem for Ruby.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'freeman'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install freeman
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
require "freeman"
|
23
|
+
require "./core_exts"
|
24
|
+
|
25
|
+
test "A string is indeed a string" do
|
26
|
+
'This is a string'.class.is String
|
27
|
+
end
|
28
|
+
|
29
|
+
test "Numbers can be divisible by" do
|
30
|
+
10.divisible_by(5).is true
|
31
|
+
end
|
32
|
+
|
33
|
+
# Example of a failing test
|
34
|
+
test "True is false" do
|
35
|
+
true.is false
|
36
|
+
end
|
37
|
+
|
38
|
+
# Example of the 'isnt' on the same test
|
39
|
+
test "True isn't false" do
|
40
|
+
true.isnt false
|
41
|
+
end
|
42
|
+
|
43
|
+
# ./core_exts.rb
|
44
|
+
class Fixnum
|
45
|
+
def divisible_by(num)
|
46
|
+
self % num == 0
|
47
|
+
end
|
48
|
+
end
|
49
|
+
```
|
50
|
+
|
51
|
+
Returns:
|
52
|
+
|
53
|
+
```shell
|
54
|
+
A string is indeed a string: true
|
55
|
+
Numbers can be divisible by: true
|
56
|
+
True is false: false
|
57
|
+
from test.rb: 12
|
58
|
+
True isn't false: true
|
59
|
+
```
|
60
|
+
|
61
|
+
## Misc
|
62
|
+
|
63
|
+
I've been reading Metaprogramming Ruby and thought it'd be fun to try this. Turns out it only took a couple minutes to write, and it's fast, to boot! Normally I would just drop the single library file into a project to avoid running through Bundler as a dependency, but it only adds .1ms to my run-time as a gem. I can live with that.
|
64
|
+
|
65
|
+
## Contributing
|
66
|
+
|
67
|
+
1. Fork it
|
68
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
69
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
70
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
71
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/freeman.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'freeman'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "freeman"
|
8
|
+
spec.version = Freeman::VERSION
|
9
|
+
spec.authors = ["Kristian Freeman"]
|
10
|
+
spec.email = ["kristian@kristianfreeman.com"]
|
11
|
+
spec.description = %q{A very simple test gem}
|
12
|
+
spec.summary = %q{An experimental Ruby test gem for simple testing. Long live Ruby!}
|
13
|
+
spec.homepage = "https://github.com/imkmf/freeman"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
end
|
data/lib/freeman.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
module Freeman
|
2
|
+
VERSION = "0.0.2"
|
3
|
+
end
|
4
|
+
|
5
|
+
module Kernel
|
6
|
+
def test(description, &block)
|
7
|
+
KFTest.new(description, block).run
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
class Object
|
12
|
+
def is(expected)
|
13
|
+
self == expected
|
14
|
+
end
|
15
|
+
|
16
|
+
def isnt(expected)
|
17
|
+
self != expected
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
KFTest = Struct.new(:description, :block) do
|
22
|
+
def run
|
23
|
+
status = block.call ? true : false
|
24
|
+
puts "#{ description }: #{ status }"
|
25
|
+
if status.is false
|
26
|
+
line = block.source_location.join(": ")
|
27
|
+
puts " from #{ line }"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
metadata
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: freeman
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kristian Freeman
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-11-23 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.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: A very simple test gem
|
42
|
+
email:
|
43
|
+
- kristian@kristianfreeman.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- .gitignore
|
49
|
+
- Gemfile
|
50
|
+
- LICENSE.txt
|
51
|
+
- README.md
|
52
|
+
- Rakefile
|
53
|
+
- freeman.gemspec
|
54
|
+
- lib/freeman.rb
|
55
|
+
homepage: https://github.com/imkmf/freeman
|
56
|
+
licenses:
|
57
|
+
- MIT
|
58
|
+
metadata: {}
|
59
|
+
post_install_message:
|
60
|
+
rdoc_options: []
|
61
|
+
require_paths:
|
62
|
+
- lib
|
63
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - '>='
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - '>='
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
requirements: []
|
74
|
+
rubyforge_project:
|
75
|
+
rubygems_version: 2.0.3
|
76
|
+
signing_key:
|
77
|
+
specification_version: 4
|
78
|
+
summary: An experimental Ruby test gem for simple testing. Long live Ruby!
|
79
|
+
test_files: []
|