test/test_ryguy.rb in rulebook-0.1.1 vs test/test_ryguy.rb in rulebook-0.2.0
- old
+ new
@@ -1,19 +1,20 @@
require 'helper'
class TestRyguy < Test::Unit::TestCase
class Ryguy
- follows_rules
attr :nouns, :adjectives
- rule(/is_a_(.*)/) do |noun|
- @nouns ||= []
- @nouns << noun.gsub(/_/, ' ')
- end
-
- rule(/is_(.*)/) do |adjective|
- @adjectives ||= []
- @adjectives << adjective.gsub(/_/, ' ')
+ rules do
+ rule(/is_a_(.*)/) do |noun|
+ @nouns ||= []
+ @nouns << noun.gsub(/_/, ' ')
+ end
+
+ rule(/is_(.*)/) do |adjective|
+ @adjectives ||= []
+ @adjectives << adjective.gsub(/_/, ' ')
+ end
end
end
context 'Ryguy' do
setup do
\ No newline at end of file