gabrielg-oughta 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Gabriel Gironda
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,7 @@
1
+ = oughta
2
+
3
+ Description goes here.
4
+
5
+ == Copyright
6
+
7
+ Copyright (c) 2009 Gabriel Gironda. See LICENSE for details.
data/lib/oughta.rb ADDED
@@ -0,0 +1,2 @@
1
+ require 'shoulda'
2
+ require 'thumblemonks/oughta/macro_macros'
@@ -0,0 +1,27 @@
1
+ module Thumblemonks
2
+ module Oughta
3
+ module MacroMacros
4
+ module ClassMethods
5
+
6
+ def macro(name, &block)
7
+ (class << self; self; end).instance_eval do
8
+ define_method(:"Macro: #{name}") { |context| context.instance_eval(&block) }
9
+ end
10
+ end
11
+
12
+ def use_macro(name)
13
+ send(:"Macro: #{name}", Shoulda.current_context || self)
14
+ end
15
+ end
16
+ end # MacroMacros
17
+ end # Oughta
18
+ end # Thumblemonks
19
+
20
+ module Test # :nodoc: all
21
+ module Unit
22
+ class TestCase
23
+ extend Thumblemonks::Oughta::MacroMacros::ClassMethods
24
+ end
25
+ end
26
+ end
27
+
@@ -0,0 +1,38 @@
1
+ require 'test_helper'
2
+
3
+ class MacroMacrosTest < Test::Unit::TestCase
4
+ test_variable = []
5
+
6
+ define_method(:setup) do
7
+ test_variable.clear
8
+ meta_test = Class.new(Test::Unit::TestCase) do
9
+ macro :should_work_as_expected do
10
+ should("jam something into test one") { test_variable << @test_variable }
11
+ end
12
+
13
+ def setup
14
+ @test_variable = :half_day_closing
15
+ end
16
+ use_macro :should_work_as_expected
17
+
18
+ context "in a context" do
19
+ setup { @test_variable = :portishead }
20
+ use_macro :should_work_as_expected
21
+ end
22
+ end # meta_test
23
+ meta_test.suite.run(Test::Unit::TestResult.new) {}
24
+ end
25
+
26
+ should "have run the macro in the top level test context" do
27
+ assert test_variable.include?(:half_day_closing)
28
+ end
29
+
30
+ should "have run the macro in the defined context" do
31
+ assert test_variable.include?(:portishead)
32
+ end
33
+
34
+ should "have run the macro in both contexts" do
35
+ assert_same_elements [:portishead, :half_day_closing], test_variable
36
+ end
37
+
38
+ end
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'shoulda'
4
+
5
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
7
+ require 'oughta'
8
+
9
+ class Test::Unit::TestCase
10
+ end
metadata ADDED
@@ -0,0 +1,62 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gabrielg-oughta
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Gabriel Gironda
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-04-01 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description:
17
+ email: gabriel.gironda@gmail.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - README.rdoc
24
+ - LICENSE
25
+ files:
26
+ - README.rdoc
27
+ - lib/oughta.rb
28
+ - lib/thumblemonks
29
+ - lib/thumblemonks/oughta
30
+ - lib/thumblemonks/oughta/macro_macros.rb
31
+ - test/macro_macros_test.rb
32
+ - test/test_helper.rb
33
+ - LICENSE
34
+ has_rdoc: true
35
+ homepage: http://github.com/gabrielg/oughta
36
+ post_install_message:
37
+ rdoc_options:
38
+ - --inline-source
39
+ - --charset=UTF-8
40
+ require_paths:
41
+ - lib
42
+ required_ruby_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: "0"
47
+ version:
48
+ required_rubygems_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: "0"
53
+ version:
54
+ requirements: []
55
+
56
+ rubyforge_project:
57
+ rubygems_version: 1.2.0
58
+ signing_key:
59
+ specification_version: 2
60
+ summary: TODO
61
+ test_files: []
62
+