Sha256: 602c546e6349e6a2ebc48efab41d795a7d5749270a00a31b4612c15d11e8d5af
Contents?: true
Size: 1.25 KB
Versions: 3
Compression:
Stored size: 1.25 KB
Contents
require 'helper' class TestRyguy < Test::Unit::TestCase class Ryguy attr :nouns, :adjectives 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 @ryguy = Ryguy.new @ryguy.is_awesome @ryguy.is_a_bear @ryguy.is_superfly @ryguy.is_a_programmer @ryguy.is_fantastic @ryguy.is_a_master_of_the_ancient_chinese_art_of_karate end should 'be awesome, superfly, and fantastic' do assert_same_elements( ['awesome', 'superfly', 'fantastic'], @ryguy.adjectives ) end should 'be a bear, a programmer, and a master of karate' do assert_same_elements( ['bear', 'programmer', 'master of the ancient chinese art of karate'], @ryguy.nouns ) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rulebook-0.3.0 | test/test_ryguy.rb |
rulebook-0.2.1 | test/test_ryguy.rb |
rulebook-0.2.0 | test/test_ryguy.rb |