public
Description: DEVELOPMENT DISCONTINUED: Consider using Spree (repo: http://github.com/railsdog/spree) instead.
Homepage:
Clone URL: git://github.com/myabc/merb_mart.git
Click here to lend your support to: merb_mart and make a donation at www.pledgie.com !
merb_mart / spec / merb_mart_spec.rb
100644 89 lines (72 sloc) 2.908 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
require File.dirname(__FILE__) + '/spec_helper'
 
describe "MerbMart (module)" do
  
  it "should have proper specs"
 
  # To spec MerbMart you need to hook it up to the router like this:
  
  # before :all do
  # Merb::Router.prepare { add_slice(:MerbMart) } if standalone?
  # end
  #
  # after :all do
  # Merb::Router.reset! if standalone?
  # end
  
  it "should be registered in Merb::Slices.slices" do
    Merb::Slices.slices.should include(MerbMart)
  end
  
  it "should have an :identifier property" do
    MerbMart.identifier.should == "merb_mart"
  end
  
  it "should have an :identifier_sym property" do
    MerbMart.identifier_sym.should == :merb_E_mart
  end
  
  it "should have a :root property" do
    MerbMart.root.should == current_slice_root
    MerbMart.root_path('app').should == current_slice_root / 'app'
  end
  
  it "should have metadata properties" do
    MerbMart.description.should == "MerbMart is a chunky Merb slice!"
    MerbMart.version.should == "0.0.1"
    MerbMart.author.should == "YOUR NAME"
  end
  
  it "should have a config property (Hash)" do
    MerbMart.config.should be_kind_of(Hash)
  end
  
  it "should have a :layout config option set" do
    MerbMart.config[:layout].should == :merb_E_mart
  end
  
  it "should have a dir_for method" do
    app_path = MerbMart.dir_for(:application)
    app_path.should == current_slice_root / 'app'
    [:view, :model, :controller, :helper, :mailer, :part].each do |type|
      MerbMart.dir_for(type).should == app_path / "#{type}s"
    end
    public_path = MerbMart.dir_for(:public)
    public_path.should == current_slice_root / 'public'
    [:stylesheet, :javascript, :image].each do |type|
      MerbMart.dir_for(type).should == public_path / "#{type}s"
    end
  end
  
  it "should have a app_dir_for method" do
    root_path = MerbMart.app_dir_for(:root)
    root_path.should == Merb.root / 'slices' / 'merb_mart'
    app_path = MerbMart.app_dir_for(:application)
    app_path.should == root_path / 'app'
    [:view, :model, :controller, :helper, :mailer, :part].each do |type|
      MerbMart.app_dir_for(type).should == app_path / "#{type}s"
    end
    public_path = MerbMart.app_dir_for(:public)
    public_path.should == Merb.dir_for(:public) / 'slices' / 'merb_mart'
    [:stylesheet, :javascript, :image].each do |type|
      MerbMart.app_dir_for(type).should == public_path / "#{type}s"
    end
  end
  
  it "should have a public_dir_for method" do
    public_path = MerbMart.public_dir_for(:public)
    public_path.should == '/slices' / 'merb_mart'
    [:stylesheet, :javascript, :image].each do |type|
      MerbMart.public_dir_for(type).should == public_path / "#{type}s"
    end
  end
  
  it "should keep a list of path component types to use when copying files" do
    (MerbMart.mirrored_components & MerbMart.slice_paths.keys).length.should == MerbMart.mirrored_components.length
  end
  
end