Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactored tests to work through helper accessor and implemented to_m…
…odel to feed form_for
- Loading branch information
Showing
7 changed files
with
61 additions
and
44 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
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,7 +1,7 @@ | ||
module Draper | ||
class System | ||
def self.setup | ||
ActionController::Base.send(:extend, Draper::AllHelpers) | ||
ActionController::Base.send(:extend, Draper::AllHelpers) if defined?(ActionController::Base) | ||
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
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,10 @@ | ||
class ApplicationController | ||
extend ActionView::Helpers | ||
extend ActionView::Helpers::TagHelper | ||
extend ActionView::Helpers::UrlHelper | ||
extend ApplicationHelper | ||
|
||
def self.all_helpers | ||
self | ||
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,5 +1,5 @@ | ||
module ApplicationHelper | ||
def hello | ||
def hello_world | ||
"Hello, World!" | ||
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
class DecoratorWithApplicationHelper < Draper::Base | ||
def uses_hello_world | ||
h.hello_world | ||
end | ||
|
||
def sample_content | ||
h.content_tag :span, "Hello, World!" | ||
end | ||
|
||
def sample_link | ||
h.link_to "Hello", "/World" | ||
end | ||
|
||
def sample_truncate | ||
h.truncate("Once upon a time", :length => 7) | ||
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,15 +1,3 @@ | ||
class DecoratorWithDenies < Draper::Base | ||
denies :upcase | ||
|
||
def sample_content | ||
content_tag :span, "Hello, World!" | ||
end | ||
|
||
def sample_link | ||
link_to "Hello", "/World" | ||
end | ||
|
||
def sample_truncate | ||
ActionView::Helpers::TextHelper.truncate("Once upon a time", :length => 7) | ||
end | ||
end |