Created
May 14, 2010 09:31
-
-
Save mallain/400982 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Division < ActiveRecord::Base | |
has_many :agencies, :dependent => :destroy | |
belongs_to :country | |
validates_presence_of :name, :country | |
validates_uniqueness_of :name, :case_sensitive => false | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Factory.define :division do |f| | |
f.name Faker::Name.name | |
f.association :country, :factory => :country | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'test_helper' | |
class DivisionTest < ActiveSupport::TestCase | |
subject { Factory(:division) } | |
should_validate_uniqueness_of(:name, :case_sensitive => false) | |
should_have_many(:agencies) | |
should_belong_to(:country) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mickael@mickael-laptop:~/projects/pabd$ rake test:units | |
(in /home/mickael/projects/pabd) | |
/usr/bin/ruby1.8 -I"lib:test" "/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "test/unit/user_test.rb" "test/unit/country_test.rb" "test/unit/delivery_test.rb" "test/unit/function_test.rb" "test/unit/service_test.rb" "test/unit/assignment_test.rb" "test/unit/division_test.rb" "test/unit/stage_test.rb" "test/unit/helpers/divisions_helper_test.rb" "test/unit/helpers/countries_helper_test.rb" "test/unit/helpers/users_helper_test.rb" "test/unit/helpers/home_helper_test.rb" "test/unit/helpers/user_sessions_helper_test.rb" "test/unit/helpers/admin/stages_helper_test.rb" "test/unit/helpers/admin/account_helper_test.rb" "test/unit/helpers/admin/subcontract_types_helper_test.rb" "test/unit/helpers/admin/services_helper_test.rb" "test/unit/helpers/admin/admin_helper_test.rb" "test/unit/helpers/admin/skills_helper_test.rb" "test/unit/helpers/admin/functions_helper_test.rb" "test/unit/helpers/admin/accounts_helper_test.rb" "test/unit/helpers/admin/administration_helper_test.rb" "test/unit/helpers/admin/deliveries_helper_test.rb" "test/unit/helpers/admin/assignments_helper_test.rb" "test/unit/helpers/admin/account_types_helper_test.rb" "test/unit/helpers/admin/agencies_helper_test.rb" "test/unit/subcontract_type_test.rb" "test/unit/account_type_test.rb" "test/unit/account_test.rb" "test/unit/skill_test.rb" "test/unit/agency_test.rb" | |
Loaded suite /var/lib/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader | |
Started | |
................................... | |
Finished in 1.863244 seconds. | |
35 tests, 35 assertions, 0 failures, 0 errors | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank's that's solve my issue.