mirror of
https://github.com/thoughtbot/shoulda-matchers.git
synced 2022-11-09 12:01:38 -05:00
Moved old tests back into place
git-svn-id: https://svn.thoughtbot.com/plugins/shoulda/trunk@137 7bbfaf0e-4d1d-0410-9690-a8bb5f8ef2aa
This commit is contained in:
parent
788645fe90
commit
6108062ffa
5 changed files with 5 additions and 59 deletions
2
Rakefile
2
Rakefile
|
@ -4,7 +4,7 @@ require 'rake/rdoctask'
|
|||
|
||||
Rake::TestTask.new do |t|
|
||||
t.libs << 'lib'
|
||||
t.pattern = 'test/{unit,functional}/**/*_test.rb' # Update this line
|
||||
t.pattern = 'test/{unit,functional,other}/**/*_test.rb'
|
||||
t.verbose = true
|
||||
end
|
||||
|
||||
|
|
|
@ -1,54 +0,0 @@
|
|||
require File.join(File.dirname(__FILE__), '..', 'test_helper')
|
||||
|
||||
class Post < ActiveRecord::Base
|
||||
belongs_to :user
|
||||
validates_uniqueness_of :title
|
||||
validates_presence_of :title
|
||||
validates_presence_of :body, :message => 'Seriously... wtf'
|
||||
validates_numericality_of :user_id
|
||||
end
|
||||
|
||||
class User < ActiveRecord::Base
|
||||
has_many :posts
|
||||
has_many :taggings
|
||||
has_many :tags, :through => :taggings
|
||||
attr_protected :password
|
||||
validates_format_of :email, :with => /\w*@\w*.com/
|
||||
validates_length_of :email, :in => 1..100
|
||||
validates_inclusion_of :age, :in => 1..100
|
||||
end
|
||||
|
||||
class Tag < ActiveRecord::Base
|
||||
has_many :taggings
|
||||
has_many :users, :through => :taggings
|
||||
end
|
||||
|
||||
class Tagging < ActiveRecord::Base
|
||||
belongs_to :user
|
||||
belongs_to :tag
|
||||
end
|
||||
|
||||
class PostTest < Test::Unit::TestCase # :nodoc:
|
||||
fixtures :posts
|
||||
|
||||
should_belong_to :user
|
||||
should_require_unique_attributes :title
|
||||
|
||||
should_require_attributes :body, :message => /wtf/
|
||||
should_require_attributes :title
|
||||
should_only_allow_numeric_values_for :user_id
|
||||
end
|
||||
|
||||
class UserTest < Test::Unit::TestCase # :nodoc:
|
||||
fixtures :users
|
||||
|
||||
should_have_many :posts
|
||||
should_have_many :taggings
|
||||
should_have_many :tags, :through => :taggings
|
||||
|
||||
should_not_allow_values_for :email, "blah", "b lah"
|
||||
should_allow_values_for :email, "a@b.com", "asdf@asdf.com"
|
||||
should_ensure_length_in_range :email, 1..100
|
||||
should_ensure_value_in_range :age, 1..100
|
||||
should_protect_attributes :password
|
||||
end
|
|
@ -12,7 +12,7 @@ class ContextTest < Test::Unit::TestCase # :nodoc:
|
|||
end
|
||||
|
||||
should "have name set right" do
|
||||
assert_match(/^test context with setup block/, self.to_s)
|
||||
assert_match(/^test: context with setup block/, self.to_s)
|
||||
end
|
||||
|
||||
context "and a subcontext" do
|
||||
|
@ -21,7 +21,7 @@ class ContextTest < Test::Unit::TestCase # :nodoc:
|
|||
end
|
||||
|
||||
should "be named correctly" do
|
||||
assert_match(/^test context with setup block and a subcontext should be named correctly/, self.to_s)
|
||||
assert_match(/^test: context with setup block and a subcontext should be named correctly/, self.to_s)
|
||||
end
|
||||
|
||||
should "run the setup methods in order" do
|
||||
|
@ -40,7 +40,7 @@ class ContextTest < Test::Unit::TestCase # :nodoc:
|
|||
end
|
||||
|
||||
should "have name set right" do
|
||||
assert_match(/^test another context with setup block/, self.to_s)
|
||||
assert_match(/^test: another context with setup block/, self.to_s)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -54,7 +54,7 @@ class ContextTest < Test::Unit::TestCase # :nodoc:
|
|||
end
|
||||
|
||||
should "have name set right" do
|
||||
assert_match(/^test context with method definition/, self.to_s)
|
||||
assert_match(/^test: context with method definition/, self.to_s)
|
||||
end
|
||||
end
|
||||
|
Loading…
Add table
Reference in a new issue