Skip to content

Commit

Permalink
added a test for Cell::Base.render_cell_for.
Browse files Browse the repository at this point in the history
  • Loading branch information
apotonick committed Dec 21, 2011
1 parent 3f2406c commit bc58e3b
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 15 deletions.
1 change: 1 addition & 0 deletions test/app/cells/shouter/sing.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
AAAaaargh!
47 changes: 32 additions & 15 deletions test/cell_module_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,43 @@ class PianistCell < MusicianCell
class SingerCell < MusicianCell
end

# Used in CellBaseTest.
class ShouterCell < Cell::Base
def sing
render
end
end

class CellModuleTest < ActiveSupport::TestCase
include Cell::TestCase::TestMethods

context "Cell::Rails" do
context "cell without controller" do
should "still have a working #url_for" do
cell = Cell::Base.new
cell.instance_eval do
# You can use #default_url_options.
def default_url_options
{:host => "cells-project.org"}
end


class CellBaseTest < MiniTest::Spec
describe "Cell::Base" do
it "still have a working #url_for" do
cell = Cell::Base.new
cell.instance_eval do
# You can use #default_url_options.
def default_url_options
{:host => "cells-project.org"}
end
# You could also use a *_url or *_path helper method here.
assert_equal "http://cells-project.org/dashboard/show", cell.url_for(:action => :show, :controller => :dashboard)

end
# You could also use a *_url or *_path helper method here.
assert_equal "http://cells-project.org/dashboard/show", cell.url_for(:action => :show, :controller => :dashboard)
end

describe ".render_cell_for" do
it "invokes controller-less cell" do
Cell::Base.view_paths= ["test/app/cells"]
assert_equal "AAAaaargh!\n", Cell::Base.render_cell_for(:shouter, :sing)
end
end
end
end



class CellModuleTest < ActiveSupport::TestCase
include Cell::TestCase::TestMethods
context "Cell::Rails" do
# FUNCTIONAL:
context "render_cell_for" do
should "render the actual cell" do
Expand Down

0 comments on commit bc58e3b

Please sign in to comment.