提交 018b79dd 编写于 作者: J Joshua Peek

File extra test folders into controller, dispatch, or template

上级 84e94551
......@@ -34,7 +34,7 @@ end
desc "Run all unit tests"
task :test => [:test_action_pack, :test_active_record_integration]
TESTS_GLOB = "test/{abstract,controller,dispatch,new_base,template,html-scanner,view}/**/*_test.rb"
TESTS_GLOB = "test/{abstract,controller,dispatch,template}/**/*_test.rb"
Rake::TestTask.new(:test_action_pack) do |t|
t.libs << 'test'
......
......@@ -6,45 +6,45 @@ class BasicController < ActionController::Base
self.view_paths = File.dirname(__FILE__)
def index
render :file => File.join(File.dirname(__FILE__), *%w[.. fixtures test hello_world])
render :file => File.join(File.dirname(__FILE__), *%w[.. .. fixtures test hello_world])
end
def with_instance_variables
@secret = 'in the sauce'
render :file => File.join(File.dirname(__FILE__), '../fixtures/test/render_file_with_ivar.erb')
render :file => File.join(File.dirname(__FILE__), '../../fixtures/test/render_file_with_ivar.erb')
end
def without_file_key
render File.join(File.dirname(__FILE__), *%w[.. fixtures test hello_world])
render File.join(File.dirname(__FILE__), *%w[.. .. fixtures test hello_world])
end
def without_file_key_with_instance_variable
@secret = 'in the sauce'
render File.join(File.dirname(__FILE__), '../fixtures/test/render_file_with_ivar.erb')
render File.join(File.dirname(__FILE__), '../../fixtures/test/render_file_with_ivar.erb')
end
def relative_path
@secret = 'in the sauce'
render :file => '../fixtures/test/render_file_with_ivar'
render :file => '../../fixtures/test/render_file_with_ivar'
end
def relative_path_with_dot
@secret = 'in the sauce'
render :file => '../fixtures/test/dot.directory/render_file_with_ivar'
render :file => '../../fixtures/test/dot.directory/render_file_with_ivar'
end
def pathname
@secret = 'in the sauce'
render :file => Pathname.new(File.dirname(__FILE__)).join(*%w[.. fixtures test dot.directory render_file_with_ivar.erb])
render :file => Pathname.new(File.dirname(__FILE__)).join(*%w[.. .. fixtures test dot.directory render_file_with_ivar.erb])
end
def with_locals
path = File.join(File.dirname(__FILE__), '../fixtures/test/render_file_with_locals.erb')
path = File.join(File.dirname(__FILE__), '../../fixtures/test/render_file_with_locals.erb')
render :file => path, :locals => {:secret => 'in the sauce'}
end
def without_file_key_with_locals
path = File.expand_path('../fixtures/test/render_file_with_locals.erb')
path = File.expand_path('../../fixtures/test/render_file_with_locals.erb')
render path, :locals => {:secret => 'in the sauce'}
end
end
......
......@@ -32,7 +32,7 @@ def link(options = {})
end
test "with no update" do
assert_html link, %w(href="/blog/destroy/3" Delete\ this\ post data-remote="true")
assert_html link, %w(href="/blog/destroy/4" Delete\ this\ post data-remote="true")
end
test "basic" do
......@@ -46,7 +46,7 @@ def link(options = {})
end
test "with :html options" do
expected = %{<a href="/blog/destroy/3" data-custom="me" data-update-success="#posts">Delete this post</a>}
expected = %{<a href="/blog/destroy/4" data-custom="me" data-remote="true" data-update-success="#posts">Delete this post</a>}
assert_equal expected, link(:update => "#posts", :html => {"data-custom" => "me"})
end
......@@ -74,7 +74,7 @@ def link(options)
end
test "basic link_to_remote with :url =>" do
expected = %{<a href="/blog/destroy/3" data-update-success="#posts">Delete this post</a>}
expected = %{<a href="/blog/destroy/3" data-remote="true" data-update-success="#posts">Delete this post</a>}
assert_equal expected,
link_to_remote("Delete this post", :url => "/blog/destroy/3", :update => "#posts")
end
......@@ -93,7 +93,7 @@ def button(options, html = {})
def url_for(*)
"/whatnot"
end
class StandardTest < ButtonToRemoteTest
test "basic" do
button = button({:url => {:action => "whatnot"}}, {:class => "fine"})
......@@ -103,13 +103,12 @@ class StandardTest < ButtonToRemoteTest
end
end
end
class LegacyButtonToRemoteTest < ButtonToRemoteTest
include ActionView::Helpers::AjaxHelper::Rails2Compatibility
assert_callbacks_work do |callback|
button(callback => "undoRequestCompleted(request)")
end
end
end
\ No newline at end of file
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册