Created
October 11, 2011 05:22
-
-
Save bandito/1277344 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Decorators | |
module Test | |
def foo | |
"foo" | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MoufesController < ApplicationController | |
def bar | |
@moufa = Moufa.first | |
@moufa.extend(Decorators::Test) | |
render :text => @moufa.foo | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'test_helper' | |
class MoufesControllerTest < ActionController::TestCase | |
# Replace this with your real tests. | |
test "bar" do | |
m = Moufa.first | |
Moufa.expects(:find).returns(m) | |
m.expects(:foo).returns("foobar") | |
get :bar, {:id => 32} | |
assert_equal @response.body, "foobar" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment