Browse files

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

…iles for ActionController matchers
  • Loading branch information...
1 parent 440fe40 commit 39041bfbd2e547af154538535525bb37da96ac63 @jferris jferris committed Jan 31, 2009
View
25 controller_progress.txt
@@ -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
View
1 lib/shoulda/controller.rb
@@ -1,5 +1,6 @@
require 'shoulda'
require 'shoulda/controller/helpers'
+require 'shoulda/controller/matchers'
require 'shoulda/controller/resource_options'
require 'shoulda/controller/macros'
View
28 lib/shoulda/controller/matchers.rb
@@ -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
View
2 .../allow_mass_assignment_of_matcher_test.rb → .../allow_mass_assignment_of_matcher_test.rb
@@ -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:
View
2 test/matchers/allow_value_matcher_test.rb → ...active_record/allow_value_matcher_test.rb
@@ -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:
View
2 test/matchers/association_matcher_test.rb → ...active_record/association_matcher_test.rb
@@ -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:
View
2 ...chers/ensure_inclusion_of_matcher_test.rb → ...ecord/ensure_inclusion_of_matcher_test.rb
@@ -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:
View
2 ...matchers/ensure_length_of_matcher_test.rb → ...e_record/ensure_length_of_matcher_test.rb
@@ -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:
View
2 test/matchers/have_db_column_matcher_test.rb → ...ive_record/have_db_column_matcher_test.rb
@@ -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:
View
2 test/matchers/have_index_matcher_test.rb → .../active_record/have_index_matcher_test.rb
@@ -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:
View
2 ...matchers/have_named_scope_matcher_test.rb → ...e_record/have_named_scope_matcher_test.rb
@@ -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:
View
2 .../have_readonly_attributes_matcher_test.rb → .../have_readonly_attributes_matcher_test.rb
@@ -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:
View
2 ...rs/validate_acceptance_of_matcher_test.rb → ...rd/validate_acceptance_of_matcher_test.rb
@@ -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:
View
2 .../validate_numericality_of_matcher_test.rb → .../validate_numericality_of_matcher_test.rb
@@ -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:
View
2 ...hers/validate_presence_of_matcher_test.rb → ...cord/validate_presence_of_matcher_test.rb
@@ -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:
View
2 ...rs/validate_uniqueness_of_matcher_test.rb → ...rd/validate_uniqueness_of_matcher_test.rb
@@ -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:

0 comments on commit 39041bf

Please sign in to comment.