Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

As usual, I misused the term 'mock' when in fact I meant 'fake' - htt…

  • Loading branch information...
commit fada8688e8634f7465b1eb65f01299a6ad88d897 1 parent cb6718d
Fabio Akita authored November 07, 2009
20  spec/dynamic_liquid_templates_spec.rb
@@ -3,7 +3,7 @@
3 3
 describe DynamicLiquidTemplates do
4 4
   describe "simple page resource with default layout" do
5 5
     it "should return the composed index action template" do
6  
-      @controller = KontrollerMock.new("pages", "index")
  6
+      @controller = FakeController.new("pages", "index")
7 7
       @controller.set(:pages, pages_collection)
8 8
       output = @controller.render_with_dynamic_liquid
9 9
 
@@ -24,7 +24,7 @@
24 24
 
25 25
   describe "simple post resource" do
26 26
     it "should return the composed index action template" do
27  
-      @controller = KontrollerMock.new("posts", "index")
  27
+      @controller = FakeController.new("posts", "index")
28 28
       @controller.set(:posts, posts_collection)
29 29
       output = @controller.render_with_dynamic_liquid
30 30
       
@@ -41,7 +41,7 @@
41 41
     end
42 42
   
43 43
     it "should return the composed show action template" do
44  
-      @controller = KontrollerMock.new("posts", "show")
  44
+      @controller = FakeController.new("posts", "show")
45 45
       @controller.set(:post, post_object)
46 46
       output = @controller.render_with_dynamic_liquid
47 47
       
@@ -53,7 +53,7 @@
53 53
     end
54 54
     
55 55
     it "should return the composed edit action template" do
56  
-      @controller = KontrollerMock.new("posts", "edit")
  56
+      @controller = FakeController.new("posts", "edit")
57 57
       @controller.set(:post, post_object)
58 58
       output = @controller.render_with_dynamic_liquid
59 59
       
@@ -66,7 +66,7 @@
66 66
     end
67 67
     
68 68
     it "should return the composed new action template" do
69  
-      @controller = KontrollerMock.new("posts", "new")
  69
+      @controller = FakeController.new("posts", "new")
70 70
       @controller.set(:post, post_object)
71 71
       output = @controller.render_with_dynamic_liquid
72 72
 
@@ -78,7 +78,7 @@
78 78
 
79 79
   describe "nested post/comment resource" do
80 80
     before(:each) do
81  
-      @controller = KontrollerMock.new("comments", "index")
  81
+      @controller = FakeController.new("comments", "index")
82 82
       @controller.class_eval do
83 83
         def parent
84 84
           post_object
@@ -132,7 +132,7 @@ def parent
132 132
 
133 133
   describe "namespaced post resource" do
134 134
     it "should return composed index action template" do
135  
-      @controller = KontrollerMock.new("posts", "index")
  135
+      @controller = FakeController.new("posts", "index")
136 136
       @controller.set(:posts, posts_collection)
137 137
       output = @controller.render_with_dynamic_liquid(:namespace => "admin")
138 138
       
@@ -148,7 +148,7 @@ def parent
148 148
       output.should include('<a href="/admin/post/new">New Post</a><')
149 149
     end
150 150
     it "should return composed show action template" do
151  
-      @controller = KontrollerMock.new("posts", "show")
  151
+      @controller = FakeController.new("posts", "show")
152 152
       @controller.set(:post, post_object)
153 153
       output = @controller.render_with_dynamic_liquid(:namespace => "admin")
154 154
       
@@ -158,7 +158,7 @@ def parent
158 158
       output.should include('<a href="/admin/posts">Back</a>')
159 159
     end
160 160
     it "should return composed edit action template" do
161  
-      @controller = KontrollerMock.new("posts", "edit")
  161
+      @controller = FakeController.new("posts", "edit")
162 162
       @controller.set(:post, post_object)
163 163
       output = @controller.render_with_dynamic_liquid(:namespace => "admin")
164 164
       
@@ -170,7 +170,7 @@ def parent
170 170
       output.should include('<a href="/admin/posts">Back</a>')
171 171
     end
172 172
     it "should return composed new action template" do
173  
-      @controller = KontrollerMock.new("posts", "new")
  173
+      @controller = FakeController.new("posts", "new")
174 174
       @controller.set(:post, post_object)
175 175
       output = @controller.render_with_dynamic_liquid(:namespace => "admin")
176 176
 
4  spec/mocks.rb → spec/fakes.rb
... ...
@@ -1,7 +1,7 @@
1 1
 class DynamicTemplate
2 2
   attr_accessor :path, :body
3 3
 
4  
-  # mock to return static fixtures instead of hitting the database
  4
+  # fake to return static fixtures instead of hitting the database
5 5
   def self.find_by_path(path)
6 6
     model = DynamicTemplate.new
7 7
     # replace the admin subdir just so we don't need to duplicate the posts template
@@ -16,7 +16,7 @@ def self.find_by_path(path)
16 16
   end
17 17
 end
18 18
 
19  
-class KontrollerMock
  19
+class FakeController
20 20
   include DynamicLiquidTemplates
21 21
   attr_accessor :controller_name, :action_name, :form_authenticity_token
22 22
   
2  spec/spec_helper.rb
@@ -8,7 +8,7 @@
8 8
 require 'ruby-debug'
9 9
 require File.dirname(__FILE__) + '/../lib/dynamic_liquid_templates.rb'
10 10
 require File.dirname(__FILE__) + '/../lib/database_file_system.rb'
11  
-require File.dirname(__FILE__) + '/mocks.rb'
  11
+require File.dirname(__FILE__) + '/fakes.rb'
12 12
 
13 13
 Spec::Runner.configure do |config|
14 14
 

0 notes on commit fada868

Please sign in to comment.
Something went wrong with that request. Please try again.