Sha256: e4d60df5f498dded6a0de73c2ff5e6025a29cc293c6d86ff3e791809d5c20de9
Contents?: true
Size: 1.02 KB
Versions: 1
Compression:
Stored size: 1.02 KB
Contents
require 'test_helper' module MyPlugin extend ActiveSupport::Concern def self.configure(model) model.class_eval { attr_accessor :from_configure } end module ClassMethods def class_foo 'class_foo' end end module InstanceMethods def instance_foo 'instance_foo' end end end class PluginsTest < Test::Unit::TestCase context "plugin" do setup do @document = Class.new do extend MongoMapper::Plugins plugin MyPlugin end end should "include instance methods" do @document.new.instance_foo.should == 'instance_foo' end should "extend class methods" do @document.class_foo.should == 'class_foo' end should "pass model to configure" do @document.new.should respond_to(:from_configure) end should "default plugins to empty array" do Class.new { extend MongoMapper::Plugins }.plugins.should == [] end should "add plugin to plugins" do @document.plugins.should include(MyPlugin) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mongo_mapper-rails3-0.7.0.1 | test/unit/test_plugins.rb |