GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Fork of halorgium/mephisto
Description: A mirror of the mephisto code-base
Homepage: http://mephistoblog.com/
Clone URL: git://github.com/zmack/mephisto.git
svenfuchs (author)
Wed Feb 20 11:11:20 -0800 2008
commit  1ad1b56b4a6c9284534b0afbb9d5d87715ae4312
tree    adc435b61f05728a991fd314188bc3e75cfb6038
parent  2772ec18227b04b3cb618748a2900a7b93b84d94
mephisto / spec / models / plugin_spec.rb
100644 41 lines (32 sloc) 1.299 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# cant get this working with autotest for some reason
# invoking the spec manually will work though
 
require File.join(File.dirname(__FILE__), '/../../config/boot')
 
Rails::Configuration.send(:define_method, :plugin_paths) do
  ["#{RAILS_ROOT}/vendor/plugins", "#{RAILS_ROOT}/vendor/plugins/engines_config/test/plugins"]
end
 
require File.dirname(__FILE__) + '/../spec_helper'
 
describe Mephisto::Plugin do
  def plugin_alpha
    Engines.plugins['plugin_alpha']
  end
  
  it "should filter plugin list and return mephisto plugins" do
    Engines.plugins.size.should > Mephisto.plugins.size
  end
  
  it "should be a mephisto plugin when its name starts with 'mephisto_'" do
    Mephisto.plugins.each {|p| p.name.should =~ /^mephisto_/ }
  end
  
  it "should be configurable when at least one option is defined" do
    plugin_alpha.configurable?.should be_true
    Engines.plugins['engines'].configurable?.should be_false
  end
  
  it "should allow to add tabs" do
    Mephisto::Plugin.tabs.clear
    plugin_alpha.add_tab :something
    Mephisto::Plugin.tabs.first.first.should == :something
  end
  
  it "should allow to add admin tabs" do
    Mephisto::Plugin.admin_tabs.clear
    plugin_alpha.add_admin_tab :something
    Mephisto::Plugin.admin_tabs.first.first.should == :something
  end
end