yoda 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/.autotest +23 -0
- data/History.txt +6 -0
- data/Manifest.txt +7 -0
- data/README.txt +75 -0
- data/Rakefile +13 -0
- data/example.rb +22 -0
- data/lib/yoda.rb +65 -0
- metadata +97 -0
- metadata.gz.sig +0 -0
data.tar.gz.sig
ADDED
Binary file
|
data/.autotest
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
require 'autotest/restart'
|
4
|
+
|
5
|
+
# Autotest.add_hook :initialize do |at|
|
6
|
+
# at.extra_files << "../some/external/dependency.rb"
|
7
|
+
#
|
8
|
+
# at.libs << ":../some/external"
|
9
|
+
#
|
10
|
+
# at.add_exception 'vendor'
|
11
|
+
#
|
12
|
+
# at.add_mapping(/dependency.rb/) do |f, _|
|
13
|
+
# at.files_matching(/test_.*rb$/)
|
14
|
+
# end
|
15
|
+
#
|
16
|
+
# %w(TestA TestB).each do |klass|
|
17
|
+
# at.extra_class_map[klass] = "test/test_misc.rb"
|
18
|
+
# end
|
19
|
+
# end
|
20
|
+
|
21
|
+
# Autotest.add_hook :run_command do |at|
|
22
|
+
# system "rake build"
|
23
|
+
# end
|
data/History.txt
ADDED
data/Manifest.txt
ADDED
data/README.txt
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
= yoda
|
2
|
+
|
3
|
+
* http://rubyforge.org/seattlerb
|
4
|
+
|
5
|
+
== DESCRIPTION:
|
6
|
+
|
7
|
+
Spec yoda will, and spec you shall too.
|
8
|
+
|
9
|
+
== FAQ:
|
10
|
+
|
11
|
+
Q: Why are there no _____?
|
12
|
+
A: Use the force.
|
13
|
+
|
14
|
+
Patches... mmmm... yes.
|
15
|
+
|
16
|
+
Q: Where is the runner script?
|
17
|
+
A: ruby
|
18
|
+
|
19
|
+
== SYNOPSIS:
|
20
|
+
|
21
|
+
class Bowling
|
22
|
+
def hit(pins)
|
23
|
+
end
|
24
|
+
|
25
|
+
def score
|
26
|
+
0
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
require 'yoda'
|
31
|
+
|
32
|
+
Bowling.yoda {
|
33
|
+
"score 0 for gutter game".it_will {
|
34
|
+
bowling = Bowling.new
|
35
|
+
20.times { bowling.hit(0) }
|
36
|
+
|
37
|
+
bowling.score 0.it_is?
|
38
|
+
bowling.score 42.it_is_not!
|
39
|
+
}
|
40
|
+
}
|
41
|
+
|
42
|
+
== REQUIREMENTS:
|
43
|
+
|
44
|
+
* rubygems
|
45
|
+
* hoe (development)
|
46
|
+
* midichlorians
|
47
|
+
|
48
|
+
== INSTALL:
|
49
|
+
|
50
|
+
* sudo gem install spec_yoda_will
|
51
|
+
|
52
|
+
== LICENSE:
|
53
|
+
|
54
|
+
(The MIT License)
|
55
|
+
|
56
|
+
Copyright (c) 2009 Ryan Davis, Aaron Patterson, seattle.rb
|
57
|
+
|
58
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
59
|
+
a copy of this software and associated documentation files (the
|
60
|
+
'Software'), to deal in the Software without restriction, including
|
61
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
62
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
63
|
+
permit persons to whom the Software is furnished to do so, subject to
|
64
|
+
the following conditions:
|
65
|
+
|
66
|
+
The above copyright notice and this permission notice shall be
|
67
|
+
included in all copies or substantial portions of the Software.
|
68
|
+
|
69
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
70
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
71
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
72
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
73
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
74
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
75
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'hoe'
|
5
|
+
require './lib/yoda.rb'
|
6
|
+
|
7
|
+
Hoe.new('yoda', Yoda::VERSION) do |yoda|
|
8
|
+
yoda.rubyforge_name = 'seattlerb'
|
9
|
+
yoda.developer('Ryan Davis', 'ryand-ruby@zenspider.com')
|
10
|
+
yoda.developer('Aaron Patterson', 'aaronp@rubyforge.org')
|
11
|
+
end
|
12
|
+
|
13
|
+
# vim: syntax=Ruby
|
data/example.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# bowling_spec.rb
|
2
|
+
|
3
|
+
require 'yoda'
|
4
|
+
|
5
|
+
class Bowling
|
6
|
+
def hit(pins)
|
7
|
+
end
|
8
|
+
|
9
|
+
def score
|
10
|
+
0
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
Bowling.yoda {
|
15
|
+
"score 0 for gutter game".it_will {
|
16
|
+
bowling = Bowling.new
|
17
|
+
20.times { bowling.hit(0) }
|
18
|
+
|
19
|
+
bowling.score 1.it_is?
|
20
|
+
bowling.score 42.it_is_not!
|
21
|
+
}
|
22
|
+
}
|
data/lib/yoda.rb
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
class Yoda
|
2
|
+
VERSION = '1.0.0'
|
3
|
+
|
4
|
+
def self.fail_me x, op, y
|
5
|
+
raise Yoda::FailMe, "Fail me you did: #{x} #{op} #{y}"
|
6
|
+
end
|
7
|
+
|
8
|
+
class FailMe < RuntimeError; end
|
9
|
+
class Expectation; end
|
10
|
+
class ValueExpectation < Expectation
|
11
|
+
attr_accessor :value
|
12
|
+
def initialize value
|
13
|
+
self.value = value
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
class Equality < ValueExpectation
|
18
|
+
def matches value
|
19
|
+
Yoda.fail_me self.value, "!=", value unless self.value == value
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
class InEquality < ValueExpectation
|
24
|
+
def matches value
|
25
|
+
Yoda.fail_me self.value, "==", value unless self.value != value
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
class Object
|
31
|
+
def it_is
|
32
|
+
Yoda::Equality.new self
|
33
|
+
end
|
34
|
+
def it_is_not
|
35
|
+
Yoda::InEquality.new self
|
36
|
+
end
|
37
|
+
alias :it_is! :it_is
|
38
|
+
alias :it_is? :it_is
|
39
|
+
alias :it_is_not! :it_is_not
|
40
|
+
alias :it_is_not? :it_is_not
|
41
|
+
end
|
42
|
+
|
43
|
+
class String
|
44
|
+
def it_will
|
45
|
+
yield
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
class Module
|
50
|
+
def yoda
|
51
|
+
public_instance_methods(false).each do |method|
|
52
|
+
class_eval "
|
53
|
+
alias :darth_#{method} :#{method}
|
54
|
+
def #{method}(*args)
|
55
|
+
if Yoda::Expectation === args.first then
|
56
|
+
args.first.matches self.darth_#{method}
|
57
|
+
else
|
58
|
+
self.darth_#{method}(*args)
|
59
|
+
end
|
60
|
+
end"
|
61
|
+
end
|
62
|
+
|
63
|
+
yield
|
64
|
+
end
|
65
|
+
end
|
metadata
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: yoda
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ryan Davis
|
8
|
+
- Aaron Patterson
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain:
|
12
|
+
- |
|
13
|
+
-----BEGIN CERTIFICATE-----
|
14
|
+
MIIDPjCCAiagAwIBAgIBADANBgkqhkiG9w0BAQUFADBFMRM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6AFC/+trM0FQEB/jZkIS8SaNzn96Rl
|
30
|
+
n0sZEf77FLf5peR8TP/PtmIg7Cyqz23sLM4mCOoTGIy5OcZ8TdyiyINUHtb5ej/T
|
31
|
+
FBHgymkyj/AOSqKRIpXPhjC6
|
32
|
+
-----END CERTIFICATE-----
|
33
|
+
|
34
|
+
date: 2009-04-22 00:00:00 -07:00
|
35
|
+
default_executable:
|
36
|
+
dependencies:
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: hoe
|
39
|
+
type: :development
|
40
|
+
version_requirement:
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.12.2
|
46
|
+
version:
|
47
|
+
description: Spec yoda will, and spec you shall too.
|
48
|
+
email:
|
49
|
+
- ryand-ruby@zenspider.com
|
50
|
+
- aaronp@rubyforge.org
|
51
|
+
executables: []
|
52
|
+
|
53
|
+
extensions: []
|
54
|
+
|
55
|
+
extra_rdoc_files:
|
56
|
+
- History.txt
|
57
|
+
- Manifest.txt
|
58
|
+
- README.txt
|
59
|
+
files:
|
60
|
+
- .autotest
|
61
|
+
- History.txt
|
62
|
+
- Manifest.txt
|
63
|
+
- README.txt
|
64
|
+
- Rakefile
|
65
|
+
- example.rb
|
66
|
+
- lib/yoda.rb
|
67
|
+
has_rdoc: true
|
68
|
+
homepage: http://rubyforge.org/seattlerb
|
69
|
+
licenses: []
|
70
|
+
|
71
|
+
post_install_message:
|
72
|
+
rdoc_options:
|
73
|
+
- --main
|
74
|
+
- README.txt
|
75
|
+
require_paths:
|
76
|
+
- lib
|
77
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: "0"
|
82
|
+
version:
|
83
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: "0"
|
88
|
+
version:
|
89
|
+
requirements: []
|
90
|
+
|
91
|
+
rubyforge_project: seattlerb
|
92
|
+
rubygems_version: 1.3.2
|
93
|
+
signing_key:
|
94
|
+
specification_version: 3
|
95
|
+
summary: Spec yoda will, and spec you shall too.
|
96
|
+
test_files: []
|
97
|
+
|
metadata.gz.sig
ADDED
Binary file
|