Refer to Minitest in docs over Test::Unit
Minitest has been used instead of Test::Unit for quite some time now, let's get with the times. [ci skip]
This commit is contained in:
parent
0fbd4bff27
commit
142366ef16
|
@ -135,7 +135,7 @@ describe Person do
|
|||
end
|
||||
```
|
||||
|
||||
### Minitest / Test::Unit
|
||||
### Minitest
|
||||
|
||||
Shoulda Matchers was originally a component of [Shoulda][shoulda], a gem that
|
||||
also provides `should` and `context` syntax via
|
||||
|
|
|
@ -14,7 +14,7 @@ module Shoulda
|
|||
# it { should_not use_before_filter(:prevent_ssl) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class UsersControllerTest < ActionController::TestCase
|
||||
# should use_before_filter(:authenticate_user!)
|
||||
# should_not use_before_filter(:prevent_ssl)
|
||||
|
@ -39,7 +39,7 @@ module Shoulda
|
|||
# it { should_not use_after_filter(:destroy_user) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class IssuesControllerTest < ActionController::TestCase
|
||||
# should use_after_filter(:log_activity)
|
||||
# should_not use_after_filter(:destroy_user)
|
||||
|
@ -64,7 +64,7 @@ module Shoulda
|
|||
# it { should_not use_before_action(:prevent_ssl) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class UsersControllerTest < ActionController::TestCase
|
||||
# should use_before_action(:authenticate_user!)
|
||||
# should_not use_before_action(:prevent_ssl)
|
||||
|
@ -89,7 +89,7 @@ module Shoulda
|
|||
# it { should_not use_after_action(:destroy_user) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class IssuesControllerTest < ActionController::TestCase
|
||||
# should use_after_action(:log_activity)
|
||||
# should_not use_after_action(:destroy_user)
|
||||
|
@ -114,7 +114,7 @@ module Shoulda
|
|||
# it { should_not use_around_filter(:save_view_context) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class ChangesControllerTest < ActionController::TestCase
|
||||
# should use_around_filter(:wrap_in_transaction)
|
||||
# should_not use_around_filter(:save_view_context)
|
||||
|
@ -139,7 +139,7 @@ module Shoulda
|
|||
# it { should_not use_around_action(:save_view_context) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class ChangesControllerTest < ActionController::TestCase
|
||||
# should use_around_action(:wrap_in_transaction)
|
||||
# should_not use_around_action(:save_view_context)
|
||||
|
|
|
@ -14,7 +14,7 @@ module Shoulda
|
|||
# it { should filter_param(:secret_key) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class ApplicationControllerTest < ActionController::TestCase
|
||||
# should filter_param(:secret_key)
|
||||
# end
|
||||
|
|
|
@ -51,7 +51,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class UsersControllerTest < ActionController::TestCase
|
||||
# should "(for POST #create) restrict parameters on :user to first_name, last_name, email, and password" do
|
||||
# params = {
|
||||
|
@ -116,7 +116,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class UsersControllerTest < ActionController::TestCase
|
||||
# setup do
|
||||
# create(:user, id: 1)
|
||||
|
@ -181,7 +181,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class UsersControllerTest < ActionController::TestCase
|
||||
# setup do
|
||||
# create(:user, id: 1)
|
||||
|
|
|
@ -3,7 +3,7 @@ module Shoulda
|
|||
module ActionController
|
||||
# The `redirect_to` matcher tests that an action redirects to a certain
|
||||
# location. In a test suite using RSpec, it is very similar to
|
||||
# rspec-rails's `redirect_to` matcher. In a test suite using Test::Unit /
|
||||
# rspec-rails's `redirect_to` matcher. In a test suite using Minitest +
|
||||
# Shoulda, it provides a more expressive syntax over
|
||||
# `assert_redirected_to`.
|
||||
#
|
||||
|
@ -23,7 +23,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PostsControllerTest < ActionController::TestCase
|
||||
# context 'GET #show' do
|
||||
# setup { get :show }
|
||||
|
|
|
@ -3,8 +3,8 @@ module Shoulda
|
|||
module ActionController
|
||||
# The `render_template` matcher tests that an action renders a template
|
||||
# or partial. In RSpec, it is very similar to rspec-rails's
|
||||
# `render_template` matcher. In Test::Unit, it provides a more expressive
|
||||
# syntax over `assert_template`.
|
||||
# `render_template` matcher. In a test suite using Minitest + Shoulda, it
|
||||
# provides a more expressive syntax over `assert_template`.
|
||||
#
|
||||
# class PostsController < ApplicationController
|
||||
# def show
|
||||
|
@ -24,7 +24,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PostsControllerTest < ActionController::TestCase
|
||||
# context 'GET #show' do
|
||||
# setup { get :show }
|
||||
|
@ -34,8 +34,6 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
#
|
||||
#
|
||||
# @return [RenderTemplateMatcher]
|
||||
#
|
||||
def render_template(options = {}, message = nil)
|
||||
|
|
|
@ -19,7 +19,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PostsControllerTest < ActionController::TestCase
|
||||
# context 'GET #show' do
|
||||
# setup { get :show }
|
||||
|
@ -46,7 +46,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PostsControllerTest < ActionController::TestCase
|
||||
# context 'GET #sidebar' do
|
||||
# setup { get :sidebar }
|
||||
|
|
|
@ -23,7 +23,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class ApplicationControllerTest < ActionController::TestCase
|
||||
# should rescue_from(ActiveRecord::RecordNotFound).
|
||||
# with(:handle_not_found)
|
||||
|
|
|
@ -21,7 +21,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PostsControllerTest < ActionController::TestCase
|
||||
# context 'GET #index' do
|
||||
# setup { get :index }
|
||||
|
@ -47,7 +47,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PostsControllerTest < ActionController::TestCase
|
||||
# context 'DELETE #destroy' do
|
||||
# setup { delete :destroy }
|
||||
|
@ -73,7 +73,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PostsControllerTest < ActionController::TestCase
|
||||
# context 'GET #show' do
|
||||
# setup { get :show }
|
||||
|
|
|
@ -4,8 +4,9 @@ module Shoulda
|
|||
# The `route` matcher tests that a route resolves to a controller,
|
||||
# action, and params; and that the controller, action, and params
|
||||
# generates the same route. For an RSpec suite, this is like using a
|
||||
# combination of `route_to` and `be_routable`. For a Test::Unit suite, it
|
||||
# provides a more expressive syntax over `assert_routing`.
|
||||
# combination of `route_to` and `be_routable`. In a test suite using
|
||||
# Minitest + Shoulda, it provides a more expressive syntax over
|
||||
# `assert_routing`.
|
||||
#
|
||||
# You can use this matcher either in a controller test case or in a
|
||||
# routing test case. For instance, given these routes:
|
||||
|
@ -28,7 +29,7 @@ module Shoulda
|
|||
# it { should route(:get, '/posts/1').to(action: :show, id: 1) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PostsControllerTest < ActionController::TestCase
|
||||
# should route(:get, '/posts').to(action: 'index')
|
||||
# should route(:get, '/posts/1').to(action: :show, id: 1)
|
||||
|
@ -49,7 +50,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class RoutesTest < ActionController::IntegrationTest
|
||||
# should route(:get, '/posts').
|
||||
# to(controller: :posts, action: :index)
|
||||
|
|
|
@ -30,7 +30,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PostsControllerTest < ActionController::TestCase
|
||||
# context 'GET #index' do
|
||||
# setup { get :index }
|
||||
|
@ -67,7 +67,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PostsControllerTest < ActionController::TestCase
|
||||
# context 'GET #index' do
|
||||
# setup { get :show }
|
||||
|
@ -100,7 +100,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PostsControllerTest < ActionController::TestCase
|
||||
# context 'GET #index' do
|
||||
# setup { get :show }
|
||||
|
@ -134,7 +134,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PostsControllerTest < ActionController::TestCase
|
||||
# context 'GET #index' do
|
||||
# setup { get :show }
|
||||
|
|
|
@ -30,7 +30,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PostsControllerTest < ActionController::TestCase
|
||||
# context 'GET #index' do
|
||||
# setup { get :index }
|
||||
|
@ -67,7 +67,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PostsControllerTest < ActionController::TestCase
|
||||
# context 'GET #index' do
|
||||
# setup { get :show }
|
||||
|
@ -100,7 +100,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PostsControllerTest < ActionController::TestCase
|
||||
# context 'GET #index' do
|
||||
# setup { get :show }
|
||||
|
|
|
@ -65,7 +65,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class UserTest < ActiveSupport::TestCase
|
||||
# context "when an admin" do
|
||||
# subject { User.new(admin: true) }
|
||||
|
|
|
@ -31,7 +31,7 @@ module Shoulda
|
|||
# it { should_not allow_mass_assignment_of(:encrypted_password) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PostTest < ActiveSupport::TestCase
|
||||
# should allow_mass_assignment_of(:title)
|
||||
# end
|
||||
|
@ -60,7 +60,7 @@ module Shoulda
|
|||
# it { should allow_mass_assignment_of(:title).as(:admin) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PostTest < ActiveSupport::TestCase
|
||||
# should allow_mass_assignment_of(:title).as(:admin)
|
||||
# end
|
||||
|
|
|
@ -22,7 +22,7 @@ module Shoulda
|
|||
# it { should allow_value('http://bar.com').for(:website_url) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class UserProfileTest < ActiveSupport::TestCase
|
||||
# should allow_value('http://foo.com').for(:website_url)
|
||||
# should allow_value('http://bar.com').for(:website_url)
|
||||
|
@ -46,7 +46,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class UserProfileTest < ActiveSupport::TestCase
|
||||
# should allow_values('http://foo.com', 'http://bar.com/baz').
|
||||
# for(:website_url)
|
||||
|
@ -169,7 +169,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class UserProfileTest < ActiveSupport::TestCase
|
||||
# should allow_value('2013-01-01').
|
||||
# for(:birthday_as_string).
|
||||
|
@ -198,7 +198,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class UserProfileTest < ActiveSupport::TestCase
|
||||
# should allow_value('open', 'closed').
|
||||
# for(:state).
|
||||
|
@ -225,7 +225,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class UserProfileTest < ActiveSupport::TestCase
|
||||
# should allow_value('open', 'closed').
|
||||
# for(:state).
|
||||
|
@ -263,7 +263,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class UserProfileTest < ActiveSupport::TestCase
|
||||
# should allow_value('Broncos', 'Titans').
|
||||
# for(:sports_team).
|
||||
|
@ -291,7 +291,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class AddressTest < ActiveSupport::TestCase
|
||||
# should_not allow_value([]).
|
||||
# for(:zip_code).
|
||||
|
|
|
@ -19,7 +19,7 @@ module Shoulda
|
|||
# it { should have_secure_password }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class UserTest < ActiveSupport::TestCase
|
||||
# should have_secure_password
|
||||
# end
|
||||
|
|
|
@ -16,7 +16,7 @@ module Shoulda
|
|||
# it { should validate_absence_of(:arms) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class ArtilleryTest < ActiveSupport::TestCase
|
||||
# should validate_absence_of(:arms)
|
||||
# end
|
||||
|
@ -39,7 +39,7 @@ module Shoulda
|
|||
# it { should validate_absence_of(:arms).on(:create) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class ArtilleryTest < ActiveSupport::TestCase
|
||||
# should validate_absence_of(:arms).on(:create)
|
||||
# end
|
||||
|
@ -64,7 +64,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class ArtilleryTest < ActiveSupport::TestCase
|
||||
# should validate_absence_of(:arms).
|
||||
# with_message("We're fresh outta arms here, soldier!")
|
||||
|
|
|
@ -16,7 +16,7 @@ module Shoulda
|
|||
# it { should validate_acceptance_of(:eula) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class RegistrationTest < ActiveSupport::TestCase
|
||||
# should validate_acceptance_of(:eula)
|
||||
# end
|
||||
|
@ -42,7 +42,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class RegistrationTest < ActiveSupport::TestCase
|
||||
# should validate_acceptance_of(:terms_of_service).on(:create)
|
||||
# end
|
||||
|
@ -67,7 +67,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class RegistrationTest < ActiveSupport::TestCase
|
||||
# should validate_acceptance_of(:terms_of_service).
|
||||
# with_message('You must accept the terms of service')
|
||||
|
|
|
@ -16,7 +16,7 @@ module Shoulda
|
|||
# it { should validate_confirmation_of(:email) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class UserTest < ActiveSupport::TestCase
|
||||
# should validate_confirmation_of(:email)
|
||||
# end
|
||||
|
@ -39,7 +39,7 @@ module Shoulda
|
|||
# it { should validate_confirmation_of(:password).on(:create) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class UserTest < ActiveSupport::TestCase
|
||||
# should validate_confirmation_of(:password).on(:create)
|
||||
# end
|
||||
|
@ -64,7 +64,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class UserTest < ActiveSupport::TestCase
|
||||
# should validate_confirmation_of(:password).
|
||||
# with_message('Please re-enter your password')
|
||||
|
|
|
@ -23,7 +23,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class GameTest < ActiveSupport::TestCase
|
||||
# should validate_exclusion_of(:supported_os).
|
||||
# in_array(['Mac', 'Linux'])
|
||||
|
@ -46,7 +46,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class GameTest < ActiveSupport::TestCase
|
||||
# should validate_exclusion_of(:floors_with_enemies).
|
||||
# in_range(5..8)
|
||||
|
@ -76,7 +76,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class GameTest < ActiveSupport::TestCase
|
||||
# should validate_exclusion_of(:weapon).
|
||||
# in_array(['pistol', 'paintball gun', 'stick']).
|
||||
|
@ -105,7 +105,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class GameTest < ActiveSupport::TestCase
|
||||
# should validate_exclusion_of(:weapon).
|
||||
# in_array(['pistol', 'paintball gun', 'stick']).
|
||||
|
|
|
@ -24,7 +24,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class IssueTest < ActiveSupport::TestCase
|
||||
# should validate_inclusion_of(:state).
|
||||
# in_array(%w(open resolved unresolved))
|
||||
|
@ -44,7 +44,7 @@ module Shoulda
|
|||
# it { should validate_inclusion_of(:state).in_range(1..5) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class IssueTest < ActiveSupport::TestCase
|
||||
# should validate_inclusion_of(:state).in_range(1..5)
|
||||
# end
|
||||
|
@ -87,7 +87,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class IssueTest < ActiveSupport::TestCase
|
||||
# should validate_inclusion_of(:severity).
|
||||
# in_array(%w(low medium high)).
|
||||
|
@ -116,7 +116,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class IssueTest < ActiveSupport::TestCase
|
||||
# should validate_inclusion_of(:severity).
|
||||
# in_array(%w(low medium high)).
|
||||
|
@ -152,7 +152,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PersonTest < ActiveSupport::TestCase
|
||||
# should validate_inclusion_of(:age).
|
||||
# in_range(0..65).
|
||||
|
@ -188,7 +188,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PersonTest < ActiveSupport::TestCase
|
||||
# should validate_inclusion_of(:age).
|
||||
# in_range(0..21).
|
||||
|
@ -218,7 +218,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class IssueTest < ActiveSupport::TestCase
|
||||
# should validate_inclusion_of(:state).
|
||||
# in_array(%w(open resolved unresolved)).
|
||||
|
@ -248,7 +248,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class IssueTest < ActiveSupport::TestCase
|
||||
# should validate_inclusion_of(:state).
|
||||
# in_array(%w(open resolved unresolved)).
|
||||
|
|
|
@ -25,7 +25,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class UserTest < ActiveSupport::TestCase
|
||||
# should validate_length_of(:password).
|
||||
# is_at_least(10).
|
||||
|
@ -51,7 +51,7 @@ module Shoulda
|
|||
# it { should validate_length_of(:bio).is_at_least(15) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
#
|
||||
# class UserTest < ActiveSupport::TestCase
|
||||
# should validate_length_of(:bio).is_at_least(15)
|
||||
|
@ -75,7 +75,7 @@ module Shoulda
|
|||
# it { should validate_length_of(:status_update).is_at_most(140) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class UserTest < ActiveSupport::TestCase
|
||||
# should validate_length_of(:status_update).is_at_most(140)
|
||||
# end
|
||||
|
@ -98,7 +98,7 @@ module Shoulda
|
|||
# it { should validate_length_of(:favorite_superhero).is_equal_to(6) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class UserTest < ActiveSupport::TestCase
|
||||
# should validate_length_of(:favorite_superhero).is_equal_to(6)
|
||||
# end
|
||||
|
@ -123,7 +123,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class UserTest < ActiveSupport::TestCase
|
||||
# should validate_length_of(:password).
|
||||
# is_at_least(5).is_at_most(30)
|
||||
|
@ -151,7 +151,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class UserTest < ActiveSupport::TestCase
|
||||
# should validate_length_of(:password).
|
||||
# is_at_least(10).
|
||||
|
@ -180,7 +180,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class UserTest < ActiveSupport::TestCase
|
||||
# should validate_length_of(:secret_key).
|
||||
# is_at_least(15).
|
||||
|
@ -209,7 +209,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class UserTest < ActiveSupport::TestCase
|
||||
# should validate_length_of(:secret_key).
|
||||
# is_at_most(100).
|
||||
|
|
|
@ -16,7 +16,7 @@ module Shoulda
|
|||
# it { should validate_numericality_of(:gpa) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PersonTest < ActiveSupport::TestCase
|
||||
# should validate_numericality_of(:gpa)
|
||||
# end
|
||||
|
@ -42,7 +42,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PersonTest < ActiveSupport::TestCase
|
||||
# should validate_numericality_of(:number_of_dependents).on(:create)
|
||||
# end
|
||||
|
@ -65,7 +65,7 @@ module Shoulda
|
|||
# it { should validate_numericality_of(:age).only_integer }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PersonTest < ActiveSupport::TestCase
|
||||
# should validate_numericality_of(:age).only_integer
|
||||
# end
|
||||
|
@ -92,7 +92,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PersonTest < ActiveSupport::TestCase
|
||||
# should validate_numericality_of(:number_of_cars).
|
||||
# is_less_than(2)
|
||||
|
@ -120,7 +120,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PersonTest < ActiveSupport::TestCase
|
||||
# should validate_numericality_of(:birth_year).
|
||||
# is_less_than_or_equal_to(1987)
|
||||
|
@ -144,7 +144,7 @@ module Shoulda
|
|||
# it { should validate_numericality_of(:weight).is_equal_to(150) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PersonTest < ActiveSupport::TestCase
|
||||
# should validate_numericality_of(:weight).is_equal_to(150)
|
||||
# end
|
||||
|
@ -171,7 +171,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PersonTest < ActiveSupport::TestCase
|
||||
# should validate_numericality_of(:height).
|
||||
# is_greater_than_or_equal_to(55)
|
||||
|
@ -198,7 +198,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PersonTest < ActiveSupport::TestCase
|
||||
# should validate_numericality_of(:legal_age).
|
||||
# is_greater_than(21)
|
||||
|
@ -221,7 +221,7 @@ module Shoulda
|
|||
# it { should validate_numericality_of(:birth_month).even }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PersonTest < ActiveSupport::TestCase
|
||||
# should validate_numericality_of(:birth_month).even
|
||||
# end
|
||||
|
@ -244,7 +244,7 @@ module Shoulda
|
|||
# it { should validate_numericality_of(:birth_day).odd }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PersonTest < ActiveSupport::TestCase
|
||||
# should validate_numericality_of(:birth_day).odd
|
||||
# end
|
||||
|
@ -269,7 +269,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PersonTest < ActiveSupport::TestCase
|
||||
# should validate_numericality_of(:number_of_dependents).
|
||||
# with_message('Number of dependents must be a number')
|
||||
|
@ -291,7 +291,7 @@ module Shoulda
|
|||
# it { should validate_numericality_of(:age).allow_nil }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PostTest < ActiveSupport::TestCase
|
||||
# should validate_numericality_of(:age).allow_nil
|
||||
# end
|
||||
|
|
|
@ -16,7 +16,7 @@ module Shoulda
|
|||
# it { should validate_presence_of(:arms) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class RobotTest < ActiveSupport::TestCase
|
||||
# should validate_presence_of(:arms)
|
||||
# end
|
||||
|
@ -73,7 +73,7 @@ module Shoulda
|
|||
# it { should validate_presence_of(:arms).on(:create) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class RobotTest < ActiveSupport::TestCase
|
||||
# should validate_presence_of(:arms).on(:create)
|
||||
# end
|
||||
|
@ -97,7 +97,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class RobotTest < ActiveSupport::TestCase
|
||||
# should validate_presence_of(:legs).
|
||||
# with_message('Robot has no legs')
|
||||
|
|
|
@ -13,7 +13,7 @@ module Shoulda
|
|||
# it { should accept_nested_attributes_for(:doors) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit (using Shoulda)
|
||||
# # Minitest (Shoulda) (using Shoulda)
|
||||
# class CarTest < ActiveSupport::TestCase
|
||||
# should accept_nested_attributes_for(:doors)
|
||||
# end
|
||||
|
@ -37,7 +37,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class CarTest < ActiveSupport::TestCase
|
||||
# should accept_nested_attributes_for(:mirrors).
|
||||
# allow_destroy(true)
|
||||
|
@ -59,7 +59,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class CarTest < ActiveSupport::TestCase
|
||||
# should accept_nested_attributes_for(:windows).
|
||||
# limit(3)
|
||||
|
@ -82,7 +82,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class CarTest < ActiveSupport::TestCase
|
||||
# should accept_nested_attributes_for(:engine).
|
||||
# update_only(true)
|
||||
|
|
|
@ -15,7 +15,7 @@ module Shoulda
|
|||
# it { should belong_to(:organization) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PersonTest < ActiveSupport::TestCase
|
||||
# should belong_to(:organization)
|
||||
# end
|
||||
|
@ -32,7 +32,7 @@ module Shoulda
|
|||
# it { should belong_to(:commentable) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class CommentTest < ActiveSupport::TestCase
|
||||
# should belong_to(:commentable)
|
||||
# end
|
||||
|
@ -56,7 +56,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PersonTest < ActiveSupport::TestCase
|
||||
# should belong_to(:family).
|
||||
# conditions(everyone_is_perfect: false)
|
||||
|
@ -76,7 +76,7 @@ module Shoulda
|
|||
# it { should belong_to(:previous_company).order('hired_on desc') }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PersonTest < ActiveSupport::TestCase
|
||||
# should belong_to(:previous_company).order('hired_on desc')
|
||||
# end
|
||||
|
@ -95,7 +95,7 @@ module Shoulda
|
|||
# it { should belong_to(:ancient_city).class_name('City') }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PersonTest < ActiveSupport::TestCase
|
||||
# should belong_to(:ancient_city).class_name('City')
|
||||
# end
|
||||
|
@ -116,7 +116,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PersonTest < ActiveSupport::TestCase
|
||||
# should belong_to(:great_country).
|
||||
# with_primary_key('country_id')
|
||||
|
@ -138,7 +138,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PersonTest < ActiveSupport::TestCase
|
||||
# should belong_to(:great_country).
|
||||
# with_foreign_key('country_id')
|
||||
|
@ -157,7 +157,7 @@ module Shoulda
|
|||
# it { should belong_to(:world).dependent(:destroy) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PersonTest < ActiveSupport::TestCase
|
||||
# should belong_to(:world).dependent(:destroy)
|
||||
# end
|
||||
|
@ -194,7 +194,7 @@ module Shoulda
|
|||
# it { should belong_to(:organization).counter_cache(true) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PersonTest < ActiveSupport::TestCase
|
||||
# should belong_to(:organization).counter_cache(true)
|
||||
# end
|
||||
|
@ -212,7 +212,7 @@ module Shoulda
|
|||
# it { should belong_to(:organization).touch(true) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PersonTest < ActiveSupport::TestCase
|
||||
# should belong_to(:organization).touch(true)
|
||||
# end
|
||||
|
@ -230,7 +230,7 @@ module Shoulda
|
|||
# it { should belong_to(:bank).autosave(true) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class AccountTest < ActiveSupport::TestCase
|
||||
# should belong_to(:bank).autosave(true)
|
||||
# end
|
||||
|
@ -248,7 +248,7 @@ module Shoulda
|
|||
# it { should belong_to(:organization).inverse_of(:employees) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PersonTest < ActiveSupport::TestCase
|
||||
# should belong_to(:organization).inverse_of(:employees)
|
||||
# end
|
||||
|
@ -271,7 +271,7 @@ module Shoulda
|
|||
# it { should have_many(:friends) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PersonTest < ActiveSupport::TestCase
|
||||
# should have_many(:friends)
|
||||
# end
|
||||
|
@ -288,7 +288,7 @@ module Shoulda
|
|||
# it { should have_many(:pictures) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PersonTest < ActiveSupport::TestCase
|
||||
# should have_many(:pictures)
|
||||
# end
|
||||
|
@ -309,7 +309,7 @@ module Shoulda
|
|||
# it { should have_many(:coins).conditions(quality: 'mint') }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PersonTest < ActiveSupport::TestCase
|
||||
# should have_many(:coins).conditions(quality: 'mint')
|
||||
# end
|
||||
|
@ -328,7 +328,7 @@ module Shoulda
|
|||
# it { should have_many(:shirts).order('color') }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PersonTest < ActiveSupport::TestCase
|
||||
# should have_many(:shirts).order('color')
|
||||
# end
|
||||
|
@ -347,7 +347,7 @@ module Shoulda
|
|||
# it { should have_many(:hopes).class_name('Dream') }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PersonTest < ActiveSupport::TestCase
|
||||
# should have_many(:hopes).class_name('Dream')
|
||||
# end
|
||||
|
@ -365,7 +365,7 @@ module Shoulda
|
|||
# it { should have_many(:worries).with_primary_key('worrier_id') }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PersonTest < ActiveSupport::TestCase
|
||||
# should have_many(:worries).with_primary_key('worrier_id')
|
||||
# end
|
||||
|
@ -383,7 +383,7 @@ module Shoulda
|
|||
# it { should have_many(:worries).with_foreign_key('worrier_id') }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PersonTest < ActiveSupport::TestCase
|
||||
# should have_many(:worries).with_foreign_key('worrier_id')
|
||||
# end
|
||||
|
@ -401,7 +401,7 @@ module Shoulda
|
|||
# it { should have_many(:secret_documents).dependent(:destroy) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PersonTest < ActiveSupport::TestCase
|
||||
# should have_many(:secret_documents).dependent(:destroy)
|
||||
# end
|
||||
|
@ -420,7 +420,7 @@ module Shoulda
|
|||
# it { should have_many(:acquaintances).through(:friends) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PersonTest < ActiveSupport::TestCase
|
||||
# should have_many(:acquaintances).through(:friends)
|
||||
# end
|
||||
|
@ -443,7 +443,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PersonTest < ActiveSupport::TestCase
|
||||
# should have_many(:job_offers).
|
||||
# through(:friends).
|
||||
|
@ -463,7 +463,7 @@ module Shoulda
|
|||
# it { should have_many(:ideas).validate(false) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PersonTest < ActiveSupport::TestCase
|
||||
# should have_many(:ideas).validate(false)
|
||||
# end
|
||||
|
@ -481,7 +481,7 @@ module Shoulda
|
|||
# it { should have_many(:games).autosave(true) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PlayerTest < ActiveSupport::TestCase
|
||||
# should have_many(:games).autosave(true)
|
||||
# end
|
||||
|
@ -504,7 +504,7 @@ module Shoulda
|
|||
# it { should have_one(:partner) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PersonTest < ActiveSupport::TestCase
|
||||
# should have_one(:partner)
|
||||
# end
|
||||
|
@ -525,7 +525,7 @@ module Shoulda
|
|||
# it { should have_one(:pet).conditions('weight < 80') }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PersonTest < ActiveSupport::TestCase
|
||||
# should have_one(:pet).conditions('weight < 80')
|
||||
# end
|
||||
|
@ -544,7 +544,7 @@ module Shoulda
|
|||
# it { should have_one(:focus).order('priority desc') }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PersonTest < ActiveSupport::TestCase
|
||||
# should have_one(:focus).order('priority desc')
|
||||
# end
|
||||
|
@ -563,7 +563,7 @@ module Shoulda
|
|||
# it { should have_one(:chance).class_name('Opportunity') }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PersonTest < ActiveSupport::TestCase
|
||||
# should have_one(:chance).class_name('Opportunity')
|
||||
# end
|
||||
|
@ -581,7 +581,7 @@ module Shoulda
|
|||
# it { should have_one(:contract).dependent(:nullify) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PersonTest < ActiveSupport::TestCase
|
||||
# should have_one(:contract).dependent(:nullify)
|
||||
# end
|
||||
|
@ -599,7 +599,7 @@ module Shoulda
|
|||
# it { should have_one(:job).with_primary_key('worker_id') }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PersonTest < ActiveSupport::TestCase
|
||||
# should have_one(:job).with_primary_key('worker_id')
|
||||
# end
|
||||
|
@ -617,7 +617,7 @@ module Shoulda
|
|||
# it { should have_one(:job).with_foreign_key('worker_id') }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PersonTest < ActiveSupport::TestCase
|
||||
# should have_one(:job).with_foreign_key('worker_id')
|
||||
# end
|
||||
|
@ -636,7 +636,7 @@ module Shoulda
|
|||
# it { should have_one(:life).through(:partner) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PersonTest < ActiveSupport::TestCase
|
||||
# should have_one(:life).through(:partner)
|
||||
# end
|
||||
|
@ -655,7 +655,7 @@ module Shoulda
|
|||
# it { should have_one(:car).through(:partner).source(:vehicle) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PersonTest < ActiveSupport::TestCase
|
||||
# should have_one(:car).through(:partner).source(:vehicle)
|
||||
# end
|
||||
|
@ -673,7 +673,7 @@ module Shoulda
|
|||
# it { should have_one(:parking_card).validate(false) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PersonTest < ActiveSupport::TestCase
|
||||
# should have_one(:parking_card).validate(false)
|
||||
# end
|
||||
|
@ -691,7 +691,7 @@ module Shoulda
|
|||
# it { should have_one(:bank).autosave(true) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class AccountTest < ActiveSupport::TestCase
|
||||
# should have_one(:bank).autosave(true)
|
||||
# end
|
||||
|
@ -715,7 +715,7 @@ module Shoulda
|
|||
# it { should have_and_belong_to_many(:awards) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PersonTest < ActiveSupport::TestCase
|
||||
# should have_and_belong_to_many(:awards)
|
||||
# end
|
||||
|
@ -739,7 +739,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PersonTest < ActiveSupport::TestCase
|
||||
# should have_and_belong_to_many(:issues).
|
||||
# conditions(difficulty: 'hard')
|
||||
|
@ -762,7 +762,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PersonTest < ActiveSupport::TestCase
|
||||
# should have_and_belong_to_many(:projects).
|
||||
# order('time_spent')
|
||||
|
@ -785,7 +785,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PersonTest < ActiveSupport::TestCase
|
||||
# should have_and_belong_to_many(:places_visited).
|
||||
# class_name('City')
|
||||
|
@ -808,7 +808,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PersonTest < ActiveSupport::TestCase
|
||||
# should have_and_belong_to_many(:issues).
|
||||
# join_table('people_tickets')
|
||||
|
@ -830,7 +830,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PersonTest < ActiveSupport::TestCase
|
||||
# should have_and_belong_to_many(:interviews).
|
||||
# validate(false)
|
||||
|
@ -849,7 +849,7 @@ module Shoulda
|
|||
# it { should have_and_belong_to_many(:advertisers).autosave(true) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class AccountTest < ActiveSupport::TestCase
|
||||
# should have_and_belong_to_many(:advertisers).autosave(true)
|
||||
# end
|
||||
|
|
|
@ -14,7 +14,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class ProcessTest < ActiveSupport::TestCase
|
||||
# should define_enum_for(:status)
|
||||
# end
|
||||
|
@ -38,7 +38,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class ProcessTest < ActiveSupport::TestCase
|
||||
# should define_enum_for(:status).
|
||||
# with([:running, :stopped, :suspended])
|
||||
|
|
|
@ -17,7 +17,7 @@ module Shoulda
|
|||
# it { should have_db_column(:supported_ios_version) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PhoneTest < ActiveSupport::TestCase
|
||||
# should have_db_column(:supported_ios_version)
|
||||
# end
|
||||
|
@ -43,7 +43,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PhoneTest < ActiveSupport::TestCase
|
||||
# should have_db_column(:camera_aperture).of_type(:decimal)
|
||||
# end
|
||||
|
@ -70,7 +70,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PhoneTest < ActiveSupport::TestCase
|
||||
# should have_db_column(:camera_aperture).
|
||||
# with_options(precision: 1, null: false)
|
||||
|
|
|
@ -19,7 +19,7 @@ module Shoulda
|
|||
# it { should have_db_index(:user_id) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class BlogTest < ActiveSupport::TestCase
|
||||
# should have_db_index(:user_id)
|
||||
# end
|
||||
|
@ -45,7 +45,7 @@ module Shoulda
|
|||
# it { should have_db_index(:name).unique(true) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class BlogTest < ActiveSupport::TestCase
|
||||
# should have_db_index(:name).unique(true)
|
||||
# end
|
||||
|
@ -58,7 +58,7 @@ module Shoulda
|
|||
# it { should have_db_index(:name).unique }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class BlogTest < ActiveSupport::TestCase
|
||||
# should have_db_index(:name).unique
|
||||
# end
|
||||
|
|
|
@ -13,7 +13,7 @@ module Shoulda
|
|||
# it { should have_readonly_attribute(:password) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class UserTest < ActiveSupport::TestCase
|
||||
# should have_readonly_attribute(:password)
|
||||
# end
|
||||
|
|
|
@ -12,7 +12,7 @@ module Shoulda
|
|||
# it { should serialize(:customizations) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class ProductTest < ActiveSupport::TestCase
|
||||
# should serialize(:customizations)
|
||||
# end
|
||||
|
@ -45,7 +45,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class ProductTest < ActiveSupport::TestCase
|
||||
# should serialize(:specifications).
|
||||
# as(ProductSpecsSerializer)
|
||||
|
@ -77,7 +77,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class ProductTest < ActiveSupport::TestCase
|
||||
# should serialize(:options).
|
||||
# as_instance_of(ProductOptionsSerializer)
|
||||
|
|
|
@ -18,7 +18,7 @@ module Shoulda
|
|||
# it { should validate_uniqueness_of(:permalink) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PostTest < ActiveSupport::TestCase
|
||||
# should validate_uniqueness_of(:permalink)
|
||||
# end
|
||||
|
@ -99,7 +99,7 @@ module Shoulda
|
|||
# it { should validate_uniqueness_of(:title).on(:create) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PostTest < ActiveSupport::TestCase
|
||||
# should validate_uniqueness_of(:title).on(:create)
|
||||
# end
|
||||
|
@ -120,7 +120,7 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PostTest < ActiveSupport::TestCase
|
||||
# should validate_uniqueness_of(:title).
|
||||
# with_message('Please choose another title')
|
||||
|
@ -141,7 +141,7 @@ module Shoulda
|
|||
# it { should validate_uniqueness_of(:slug).scoped_to(:journal_id) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PostTest < ActiveSupport::TestCase
|
||||
# should validate_uniqueness_of(:slug).scoped_to(:journal_id)
|
||||
# end
|
||||
|
@ -162,7 +162,7 @@ module Shoulda
|
|||
# it { should validate_uniqueness_of(:key).case_insensitive }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PostTest < ActiveSupport::TestCase
|
||||
# should validate_uniqueness_of(:key).case_insensitive
|
||||
# end
|
||||
|
@ -180,7 +180,7 @@ module Shoulda
|
|||
# it { should validate_uniqueness_of(:author_id).allow_nil }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PostTest < ActiveSupport::TestCase
|
||||
# should validate_uniqueness_of(:author_id).allow_nil
|
||||
# end
|
||||
|
@ -200,7 +200,7 @@ module Shoulda
|
|||
# it { should validate_uniqueness_of(:author_id).allow_blank }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# # Minitest (Shoulda)
|
||||
# class PostTest < ActiveSupport::TestCase
|
||||
# should validate_uniqueness_of(:author_id).allow_blank
|
||||
# end
|
||||
|
|
|
@ -26,8 +26,8 @@ module Shoulda
|
|||
# it { should delegate_method(:deliver).to(:post_office) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# class CourierTest < Test::Unit::TestCase
|
||||
# # Minitest
|
||||
# class CourierTest < Minitest::Test
|
||||
# should delegate_method(:deliver).to(:post_office)
|
||||
# end
|
||||
#
|
||||
|
@ -77,8 +77,8 @@ module Shoulda
|
|||
# it { should delegate_method(:deliver).to(:post_office).as(:ship) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# class CourierTest < Test::Unit::TestCase
|
||||
# # Minitest
|
||||
# class CourierTest < Minitest::Test
|
||||
# should delegate_method(:deliver).to(:post_office).as(:ship)
|
||||
# end
|
||||
#
|
||||
|
@ -100,8 +100,8 @@ module Shoulda
|
|||
# it { should delegate_method(:title).to(:site).with_prefix(:root) }
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# class PageTest < Test::Unit::TestCase
|
||||
# # Minitest
|
||||
# class PageTest < Minitest::Test
|
||||
# should delegate_method(:name).to(:site).with_prefix
|
||||
# should delegate_method(:name).to(:site).with_prefix(true)
|
||||
# should delegate_method(:title).to(:site).with_prefix(:root)
|
||||
|
@ -138,8 +138,8 @@ module Shoulda
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# # Test::Unit
|
||||
# class CourierTest < Test::Unit::TestCase
|
||||
# # Minitest
|
||||
# class CourierTest < Minitest::Test
|
||||
# should delegate_method(:deliver_package).
|
||||
# to(:post_office).
|
||||
# with_arguments(expedited: true)
|
||||
|
|
Loading…
Reference in New Issue