test/armot_test.rb in armot-0.2.3 vs test/armot_test.rb in armot-0.2.4

- old
+ new

@@ -1,7 +1,16 @@ require 'test_helper' + +def to_method_name(name) + if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new("1.9") + name.to_sym + else + name.to_s + end +end + class ArmotTest < ActiveSupport::TestCase def setup setup_db I18n.locale = I18n.default_locale = :en Post.create(:title => 'English title') @@ -242,24 +251,24 @@ Post.where(:header => "2").find_by_title! "Hola" end end test "should not mix armotized class methods" do - foo = Comment.methods.include?(:find_by_title) + foo = Comment.methods.include?(to_method_name(:find_by_title)) assert_equal false, foo end test "should not mix armotized class methods in Post" do - foo = Post.methods.include?(:find_by_msg) + foo = Post.methods.include?(to_method_name(:find_by_msg)) assert_equal false, foo end test "should include the method in Comment" do - foo = Comment.methods.include?(:find_by_msg) + foo = Comment.methods.include?(to_method_name(:find_by_msg)) assert_equal true, foo end test "should include the method in Post" do - foo = Post.methods.include?(:find_by_title) + foo = Post.methods.include?(to_method_name(:find_by_title)) assert_equal true, foo end end