Sha256: 7fd5dffb2e3ea1ff5942bf3951ff26747a75fec1728a17d0a2a8dfad4a7e1b9f
Contents?: true
Size: 1.34 KB
Versions: 4
Compression:
Stored size: 1.34 KB
Contents
require 'indonesian_stemmer' def should_stem(word, expected_word) word.stem.should == expected_word end def should_transform(method_name, word, transformed_word) IndonesianStemmer.send(method_name, word).should == transformed_word end def should_not_transform(method_name, word) IndonesianStemmer.send(method_name, word).should == word end def should_set_flags_to(method_name, word, expected_constant) should_set_instance_variable_to(method_name, word, 'flags', get_constant(expected_constant) ) end def should_not_set_flags(method_name, word) should_not_set_instance_variable(method_name, word, 'flags') end def should_set_instance_variable_to(method_name, word, variable_name, expected_value) expect { IndonesianStemmer.send(method_name, word) }.to change { IndonesianStemmer.instance_variable_get("@#{variable_name}") }.to expected_value end def should_not_set_instance_variable(method_name, word, variable_name) expect { IndonesianStemmer.send(method_name, word) }.to_not change { IndonesianStemmer.instance_variable_get("@#{variable_name}") } end def get_constant(name, klass = IndonesianStemmer) klass.const_get name end def unset_flags IndonesianStemmer.instance_variable_set("@flags", nil) end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
indonesian_stemmer-0.2.0 | spec/spec_helper.rb |
indonesian_stemmer-0.1.1 | spec/spec_helper.rb |
indonesian_stemmer-0.1.0 | spec/spec_helper.rb |
indonesian_stemmer-0.0.1 | spec/spec_helper.rb |