Sha256: 5299f70338d82b93c1a439a00e758e4425253ef803791e06bc2df29f62ae3b15
Contents?: true
Size: 1.22 KB
Versions: 3
Compression:
Stored size: 1.22 KB
Contents
require 'helper' class TestRyguy < Test::Unit::TestCase class Ryguy attr_accessor :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.3 | test/test_ryguy.rb |
rulebook-0.3.2 | test/test_ryguy.rb |
rulebook-0.3.1 | test/test_ryguy.rb |