|
Revision 8632, 407 bytes
(checked in by nzkoz, 11 months ago)
|
Add some tests for adv_attr_accessor. Closes #10633 [fcheung]
|
| Line | |
|---|
| 1 |
require File.dirname(__FILE__) + '/abstract_unit' |
|---|
| 2 |
require 'action_mailer/adv_attr_accessor' |
|---|
| 3 |
|
|---|
| 4 |
class AdvAttrTest < Test::Unit::TestCase |
|---|
| 5 |
class Person |
|---|
| 6 |
include ActionMailer::AdvAttrAccessor |
|---|
| 7 |
adv_attr_accessor :name |
|---|
| 8 |
end |
|---|
| 9 |
|
|---|
| 10 |
def test_adv_attr |
|---|
| 11 |
bob = Person.new |
|---|
| 12 |
assert_nil bob.name |
|---|
| 13 |
bob.name 'Bob' |
|---|
| 14 |
assert_equal 'Bob', bob.name |
|---|
| 15 |
|
|---|
| 16 |
assert_raise(ArgumentError) {bob.name 'x', 'y'} |
|---|
| 17 |
end |
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
end |
|---|