Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Moved ActiveRecord matcher tests into their own directory and added f…

…iles for ActionController matchers
  • Loading branch information...
commit 39041bfbd2e547af154538535525bb37da96ac63 1 parent 440fe40
Joe Ferris jferris authored
25 controller_progress.txt
View
@@ -0,0 +1,25 @@
+Unfinished:
+should_assign_to
+should_filter_params
+should_not_assign_to
+should_not_set_the_flash
+should_render_with_layout
+should_render_without_layout
+should_respond_with
+should_respond_with_content_type
+should_return_from_session
+should_route
+should_set_the_flash_to
+
+Finished:
+should_be_restful
+
+Won't implement:
+
+Already implemented in spec-rails:
+should_redirect_to
+should_render_template
+
+View macros:
+should_render_a_form
+should_render_page_with_metadata
1  lib/shoulda/controller.rb
View
@@ -1,5 +1,6 @@
require 'shoulda'
require 'shoulda/controller/helpers'
+require 'shoulda/controller/matchers'
require 'shoulda/controller/resource_options'
require 'shoulda/controller/macros'
28 lib/shoulda/controller/matchers.rb
View
@@ -0,0 +1,28 @@
+module Shoulda # :nodoc:
+ module Controller # :nodoc:
+
+ # By using the macro helpers you can quickly and easily create concise and
+ # easy to read test suites.
+ #
+ # This code segment:
+ #
+ # describe UsersController, "on GET to show with a valid id" do
+ # before(:each) do
+ # get :show, :id => User.first.to_param
+ # end
+ #
+ # it { should assign_to(:user) }
+ # it { should respond_with(:success) }
+ # it { should render_template(:show) }
+ # it { should not_set_the_flash) }
+ #
+ # it "should do something else really cool" do
+ # assigns[:user].id.should == 1
+ # end
+ # end
+ #
+ # Would produce 5 tests for the show action
+ module Matchers
+ end
+ end
+end
2  ...matchers/allow_mass_assignment_of_matcher_test.rb → ...e_record/allow_mass_assignment_of_matcher_test.rb
View
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), '..', 'test_helper')
+require File.join(File.dirname(__FILE__), '..', '..', 'test_helper')
class AllowMassAssignmentOfMatcherTest < Test::Unit::TestCase # :nodoc:
2  test/matchers/allow_value_matcher_test.rb → ...atchers/active_record/allow_value_matcher_test.rb
View
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), '..', 'test_helper')
+require File.join(File.dirname(__FILE__), '..', '..', 'test_helper')
class AllowValueMatcherTest < Test::Unit::TestCase # :nodoc:
2  test/matchers/association_matcher_test.rb → ...atchers/active_record/association_matcher_test.rb
View
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), '..', 'test_helper')
+require File.join(File.dirname(__FILE__), '..', '..', 'test_helper')
class AssociationMatcherTest < Test::Unit::TestCase # :nodoc:
2  test/matchers/ensure_inclusion_of_matcher_test.rb → ...active_record/ensure_inclusion_of_matcher_test.rb
View
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), '..', 'test_helper')
+require File.join(File.dirname(__FILE__), '..', '..', 'test_helper')
class EnsureInclusionOfMatcherTest < Test::Unit::TestCase # :nodoc:
2  test/matchers/ensure_length_of_matcher_test.rb → ...rs/active_record/ensure_length_of_matcher_test.rb
View
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), '..', 'test_helper')
+require File.join(File.dirname(__FILE__), '..', '..', 'test_helper')
class EnsureLengthOfMatcher < Test::Unit::TestCase # :nodoc:
2  test/matchers/have_db_column_matcher_test.rb → ...hers/active_record/have_db_column_matcher_test.rb
View
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), '..', 'test_helper')
+require File.join(File.dirname(__FILE__), '..', '..', 'test_helper')
class HaveDbColumnMatcherTest < Test::Unit::TestCase # :nodoc:
2  test/matchers/have_index_matcher_test.rb → ...matchers/active_record/have_index_matcher_test.rb
View
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), '..', 'test_helper')
+require File.join(File.dirname(__FILE__), '..', '..', 'test_helper')
class HaveIndexMatcherTest < Test::Unit::TestCase # :nodoc:
2  test/matchers/have_named_scope_matcher_test.rb → ...rs/active_record/have_named_scope_matcher_test.rb
View
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), '..', 'test_helper')
+require File.join(File.dirname(__FILE__), '..', '..', 'test_helper')
class HaveNamedScopeMatcherTest < Test::Unit::TestCase # :nodoc:
2  ...matchers/have_readonly_attributes_matcher_test.rb → ...e_record/have_readonly_attributes_matcher_test.rb
View
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), '..', 'test_helper')
+require File.join(File.dirname(__FILE__), '..', '..', 'test_helper')
class HaveReadonlyAttributesMatcherTest < Test::Unit::TestCase # :nodoc:
2  test/matchers/validate_acceptance_of_matcher_test.rb → ...ive_record/validate_acceptance_of_matcher_test.rb
View
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), '..', 'test_helper')
+require File.join(File.dirname(__FILE__), '..', '..', 'test_helper')
class ValidateAcceptanceOfMatcherTest < Test::Unit::TestCase # :nodoc:
2  ...matchers/validate_numericality_of_matcher_test.rb → ...e_record/validate_numericality_of_matcher_test.rb
View
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), '..', 'test_helper')
+require File.join(File.dirname(__FILE__), '..', '..', 'test_helper')
class ValidateNumericalityOfMatcherTest < Test::Unit::TestCase # :nodoc:
2  test/matchers/validate_presence_of_matcher_test.rb → ...ctive_record/validate_presence_of_matcher_test.rb
View
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), '..', 'test_helper')
+require File.join(File.dirname(__FILE__), '..', '..', 'test_helper')
class ValidatePresenceOfMatcherTest < Test::Unit::TestCase # :nodoc:
2  test/matchers/validate_uniqueness_of_matcher_test.rb → ...ive_record/validate_uniqueness_of_matcher_test.rb
View
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), '..', 'test_helper')
+require File.join(File.dirname(__FILE__), '..', '..', 'test_helper')
class ValidateUniquenessOfMatcherTest < Test::Unit::TestCase # :nodoc:
Please sign in to comment.
Something went wrong with that request. Please try again.