Sha256: b26d958982a5b0d8974e6abbd6aefc1e820722180f0ec0023ae617a9d65a3955
Contents?: true
Size: 1.7 KB
Versions: 1
Compression:
Stored size: 1.7 KB
Contents
require File.expand_path('../../../spec_helper', __FILE__) include Fathom module PluginDemoModule module InstanceMethods def special_instance_method :special_instance_method end end module ClassMethods def special_class_method :special_class_method end def special_configuration_method @especially_configured = true end attr_reader :especially_configured end def self.configure(mod) mod.special_configuration_method end end module PlainDemoModule def plain_instance_method :plain_instance_method end end describe Plugins do before do @class = Class.new do extend Plugins plugin PluginDemoModule end end after(:all) do Object.send(:remove_const, :PluginDemoModule) Object.send(:remove_const, :PlainDemoModule) end it "should have a plugins array" do @class.plugins.should eql([PluginDemoModule]) end it "should be able to add a new plugin" do @class.plugins.should eql([PluginDemoModule]) end it "should make the ClassMethods available to the class" do @class.special_class_method.should eql(:special_class_method) end it "should make the InstanceMethods available on an instance" do obj = @class.new obj.special_instance_method.should eql(:special_instance_method) end it "should include a plain module if it is not a Plugin (has InstanceMethods)" do @class = Class.new do extend Plugins plugin PlainDemoModule end obj = @class.new obj.plain_instance_method.should eql(:plain_instance_method) end it "should have called the configure method in the plugin" do @class.especially_configured.should be_true end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fathom-0.5.0 | spec/fathom/behaviors/plugins_spec.rb |