1 require File.dirname(__FILE__) + '/spec_helper'
3 describe "MerbEMart (module)" do
5 it "should have proper specs"
7 # Feel free to remove the specs below
9 it "should be registered in Merb::Slices.slices" do
10 Merb::Slices.slices.should include(MerbEMart)
13 it "should have an :identifier property" do
14 MerbEMart.identifier.should == "merb-E-mart"
17 it "should have an :identifier_sym property" do
18 MerbEMart.identifier_sym.should == :merb_E_mart
21 it "should have a :root property" do
22 MerbEMart.root.should == current_slice_root
23 MerbEMart.root_path('app').should == current_slice_root / 'app'
26 it "should have metadata properties" do
27 MerbEMart.description.should == "MerbEMart is a chunky Merb slice!"
28 MerbEMart.version.should == "0.0.1"
29 MerbEMart.author.should == "YOUR NAME"
32 it "should have a config property (Hash)" do
33 MerbEMart.config.should be_kind_of(Hash)
36 it "should have a :layout config option set" do
37 MerbEMart.config[:layout].should == :merb_E_mart
40 it "should have a dir_for method" do
41 app_path = MerbEMart.dir_for(:application)
42 app_path.should == current_slice_root / 'app'
43 [:view, :model, :controller, :helper, :mailer, :part].each do |type|
44 MerbEMart.dir_for(type).should == app_path / "#{type}s"
46 public_path = MerbEMart.dir_for(:public)
47 public_path.should == current_slice_root / 'public'
48 [:stylesheet, :javascript, :image].each do |type|
49 MerbEMart.dir_for(type).should == public_path / "#{type}s"
53 it "should have a app_dir_for method" do
54 root_path = MerbEMart.app_dir_for(:root)
55 root_path.should == Merb.root / 'slices' / 'merb-E-mart'
56 app_path = MerbEMart.app_dir_for(:application)
57 app_path.should == root_path / 'app'
58 [:view, :model, :controller, :helper, :mailer, :part].each do |type|
59 MerbEMart.app_dir_for(type).should == app_path / "#{type}s"
61 public_path = MerbEMart.app_dir_for(:public)
62 public_path.should == Merb.dir_for(:public) / 'slices' / 'merb-E-mart'
63 [:stylesheet, :javascript, :image].each do |type|
64 MerbEMart.app_dir_for(type).should == public_path / "#{type}s"
68 it "should have a public_dir_for method" do
69 public_path = MerbEMart.public_dir_for(:public)
70 public_path.should == '/slices' / 'merb-E-mart'
71 [:stylesheet, :javascript, :image].each do |type|
72 MerbEMart.public_dir_for(type).should == public_path / "#{type}s"
76 it "should keep a list of path component types to use when copying files" do
77 (MerbEMart.mirrored_components & MerbEMart.slice_paths.keys).length.should == MerbEMart.mirrored_components.length