Skip to content

Instantly share code, notes, and snippets.

@bandito
Created October 11, 2011 05:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bandito/1277344 to your computer and use it in GitHub Desktop.
Save bandito/1277344 to your computer and use it in GitHub Desktop.
module Decorators
module Test
def foo
"foo"
end
end
end
class MoufesController < ApplicationController
def bar
@moufa = Moufa.first
@moufa.extend(Decorators::Test)
render :text => @moufa.foo
end
end
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