Permalink
Browse files

Fix tests after scoped patch.

  • Loading branch information...
1 parent 7fb9e76 commit c23b8d493bfa96f2b10a1fa171fdce6081b154a6 Adam Wróbel committed with josevalim Jan 28, 2011
View
@@ -44,27 +44,27 @@ class IndexActionBaseTest < ActionController::TestCase
include UserTestHelper
def test_expose_all_users_as_instance_variable
- User.expects(:all).returns([mock_user])
+ User.expects(:scoped).returns([mock_user])
get :index
assert_equal [mock_user], assigns(:users)
end
def test_apply_scopes_if_method_is_available
- User.expects(:all).returns([mock_user])
+ User.expects(:scoped).returns([mock_user])
get :index
assert @controller.scopes_applied
end
def test_controller_should_render_index
- User.stubs(:all).returns([mock_user])
+ User.stubs(:scoped).returns([mock_user])
get :index
assert_response :success
assert_equal 'Index HTML', @response.body.strip
end
def test_render_all_users_as_xml_when_mime_type_is_xml
@request.accept = 'application/xml'
- User.expects(:all).returns(mock_user)
+ User.expects(:scoped).returns([mock_user])
mock_user.expects(:to_xml).returns('Generated XML')
get :index
assert_response :success
View
@@ -24,7 +24,7 @@ def setup
end
def test_expose_all_comments_as_instance_variable_on_index
- Comment.expects(:all).returns([mock_comment])
+ Comment.expects(:scoped).returns([mock_comment])
get :index, :post_id => '37'
assert_equal mock_post, assigns(:post)
assert_equal [mock_comment], assigns(:comments)
@@ -106,7 +106,7 @@ def helper_methods
def test_helpers
mock_post.stubs(:class).returns(Post)
- Comment.expects(:all).returns([mock_comment])
+ Comment.expects(:scoped).returns([mock_comment])
get :index, :post_id => '37'
assert helper_methods.include?('parent?')
@@ -24,7 +24,7 @@ def setup
end
def test_expose_all_tags_as_instance_variable_on_index
- Tag.expects(:all).returns([mock_tag])
+ Tag.expects(:scoped).returns([mock_tag])
get :index, :post_id => 'thirty_seven'
assert_equal mock_post, assigns(:post)
assert_equal [mock_tag], assigns(:tags)
@@ -22,7 +22,7 @@ def setup
end
def test_expose_the_requested_school_with_chosen_instance_variable_on_index
- Professor.stubs(:all).returns([mock_professor])
+ Professor.stubs(:scoped).returns([mock_professor])
get :index, :school_title => 'nice'
assert_equal mock_school, assigns(:great_school)
end
View
@@ -23,7 +23,7 @@ def setup
end
def test_expose_all_painters_as_instance_variable
- Malarz.expects(:all).returns([mock_painter])
+ Malarz.expects(:scoped).returns([mock_painter])
get :index
assert_equal [mock_painter], assigns(:malarze)
end
@@ -90,7 +90,7 @@ def setup
end
def test_expose_all_professors_as_instance_variable
- Professor.expects(:all).returns([mock_professor])
+ Professor.expects(:scoped).returns([mock_professor])
get :index
assert_equal [mock_professor], assigns(:professors)
end
@@ -30,7 +30,7 @@ def setup
def test_assigns_dresser_and_shelf_and_plate_on_index
Shelf.expects(:find).with('37').twice.returns(mock_shelf)
- Plate.expects(:all).returns([mock_plate])
+ Plate.expects(:scoped).returns([mock_plate])
get :index, :shelf_id => '37'
assert_equal mock_dresser, assigns(:dresser)
@@ -22,14 +22,14 @@ def setup
def test_expose_all_products_as_instance_variable_with_category
Category.expects(:find).with('37').returns(mock_category)
mock_category.expects(:products).returns(Product)
- Product.expects(:all).returns([mock_product])
+ Product.expects(:scoped).returns([mock_product])
get :index, :category_id => '37'
assert_equal mock_category, assigns(:category)
assert_equal [mock_product], assigns(:products)
end
def test_expose_all_products_as_instance_variable_without_category
- Product.expects(:all).returns([mock_product])
+ Product.expects(:scoped).returns([mock_product])
get :index
assert_equal nil, assigns(:category)
assert_equal [mock_product], assigns(:products)
@@ -142,7 +142,7 @@ def test_the_requested_product_is_destroyed_without_category
end
def test_polymorphic_helpers
- Product.expects(:all).returns([mock_product])
+ Product.expects(:scoped).returns([mock_product])
get :index
assert !@controller.send(:parent?)
View
@@ -23,7 +23,7 @@ def setup
end
def test_expose_all_employees_as_instance_variable_on_index
- Employee.expects(:all).returns([mock_employee])
+ Employee.expects(:scoped).returns([mock_employee])
get :index, :factory_id => '37'
assert_equal mock_factory, assigns(:factory)
assert_equal [mock_employee], assigns(:employees)
@@ -77,7 +77,7 @@ def test_the_requested_employee_is_destroyed_on_destroy
def test_polymorphic_helpers
mock_factory.stubs(:class).returns(Factory)
- Employee.expects(:all).returns([mock_employee])
+ Employee.expects(:scoped).returns([mock_employee])
get :index, :factory_id => '37'
assert @controller.send(:parent?)
@@ -110,7 +110,7 @@ def setup
end
def test_expose_all_employees_as_instance_variable_on_index
- Employee.expects(:all).returns([mock_employee])
+ Employee.expects(:scoped).returns([mock_employee])
get :index, :company_id => '37'
assert_equal mock_company, assigns(:company)
assert_equal [mock_employee], assigns(:employees)
@@ -164,7 +164,7 @@ def test_the_requested_employee_is_destroyed_on_destroy
def test_polymorphic_helpers
mock_company.stubs(:class).returns(Company)
- Employee.expects(:all).returns([mock_employee])
+ Employee.expects(:scoped).returns([mock_employee])
get :index, :company_id => '37'
assert @controller.send(:parent?)

0 comments on commit c23b8d4

Please sign in to comment.