public
Description: rails plugin that enables inheritance of views along a controller class heirachy
Homepage: http://ianwhite.github.com/inherit_views
Clone URL: git://github.com/ianwhite/inherit_views.git
inherit_views / spec / controllers / b_controller_spec.rb
100644 57 lines (45 sloc) 1.667 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
require File.expand_path(File.join(File.dirname(__FILE__), '../spec_helper'))
require File.expand_path(File.join(File.dirname(__FILE__), '../app'))
 
describe BController, " < TestController; inherit_views 'a'" do
  describe "(the class)" do
    it { BController.should be_inherit_views }
 
    it "should have inherit view paths == ['b', 'a']" do
      BController.inherit_view_paths.should == ['b', 'a']
    end
  end
  
  describe "(an instance)" do
    integrate_views
  
    it { @controller.should be_inherit_views }
 
    it "should have inherit view paths == ['b', 'a']" do
      @controller.inherit_view_paths.should == ['b', 'a']
    end
  
    it "GET :in_first should render a/in_a" do
      get :in_a
      response.body.should == 'a:in_a'
    end
  
    it "GET :in_ab should render b/in_ab" do
      get :in_ab
      response.body.should == 'b:in_ab'
    end
  
    it "GET :in_b should render b/in_b" do
      get :in_b
      response.body.should == 'b:in_b'
    end
 
    it "GET :in_abc should render b/in_abc" do
      get :in_abc
      response.body.should == 'b:in_abc'
    end
  
    it "GET :partial_in_bc should render b/partial_in_bc & b/_partial_in_bc" do
      get :partial_in_bc
      response.body.should == "b:partial_in_bc => b:_partial_in_bc"
    end
  
    it "GET :partial_in_b should render b/partial_in_b & b/_partial_in_b" do
      get :partial_in_b
      response.body.should == "b:partial_in_b => b:_partial_in_b"
    end
    
    it "GET :collection_in_bc should render b/collection_in_bc then b/_partial_in_bc" do
      get :collection_in_bc
      response.body.should == 'b:collection_in_bc => b:_partial_in_bc'
    end
  end
end