Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
basic implementation of getting page by controller
- Loading branch information
Paul Campbell
authored and
Paul Campbell
committed
Dec 30, 2009
1 parent
ffdca2a
commit 46cd9ec
Showing
5 changed files
with
30 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module ShakespeareHelper | ||
|
||
def page_content | ||
@page_content = Page.find_by_url("#{controller_name}/#{action_name}") | ||
end | ||
|
||
end |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
# Shakespeare | ||
require 'helpers/shakespeare_helper' |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
# Include hook code here | ||
require 'shakespeare' |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
require 'spec/spec_helper.rb' | ||
|
||
describe ShakespeareHelper do | ||
|
||
class TestController < ApplicationController | ||
include ShakespeareHelper | ||
end | ||
|
||
describe "#page_content" do | ||
before do | ||
@page = mock_model(Page) | ||
Page.stub!(:find_by_url).and_return(@page) | ||
end | ||
|
||
it "should pull the page" do | ||
@controller = TestController.new | ||
@controller.page_content.should == @page | ||
end | ||
end | ||
end |
This file contains 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