Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
big refactoring in view tests; rewrite most of them in much nicer way…
… to test/view_test.rb
- Loading branch information
Showing
7 changed files
with
321 additions
and
244 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
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 was deleted.
Oops, something went wrong.
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,67 @@ | ||
require 'action_controller' | ||
require 'action_controller/test_process' | ||
|
||
require 'will_paginate' | ||
WillPaginate.enable_actionpack | ||
|
||
ActionController::Routing::Routes.draw do |map| | ||
map.connect ':controller/:action/:id' | ||
end | ||
|
||
ActionController::Base.perform_caching = false | ||
|
||
class DummyRequest | ||
def initialize | ||
@get = true | ||
end | ||
|
||
def get? | ||
@get | ||
end | ||
|
||
def post | ||
@get = false | ||
end | ||
|
||
def symbolized_path_parameters | ||
{ :controller => 'foo', :action => 'bar' } | ||
end | ||
|
||
def relative_url_root | ||
'' | ||
end | ||
end | ||
|
||
class DummyController | ||
attr_reader :request | ||
attr_accessor :controller_name | ||
|
||
def initialize | ||
@request = DummyRequest.new | ||
@url = ActionController::UrlRewriter.new(@request, {}) | ||
end | ||
|
||
def url_for(params) | ||
@url.rewrite(params) | ||
end | ||
end | ||
|
||
module HTML | ||
Node.class_eval do | ||
def inner_text | ||
children.map(&:inner_text).join('') | ||
end | ||
end | ||
|
||
Text.class_eval do | ||
def inner_text | ||
self.to_s | ||
end | ||
end | ||
|
||
Tag.class_eval do | ||
def inner_text | ||
childless?? '' : super | ||
end | ||
end | ||
end |
Oops, something went wrong.