ruby_psigate 0.7.6 → 0.7.7
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +1 -0
- data/lib/ruby_psigate/address.rb +15 -0
- data/ruby_psigate.gemspec +1 -1
- data/test/unit/address_test.rb +21 -0
- metadata +2 -2
data/CHANGELOG
CHANGED
data/lib/ruby_psigate/address.rb
CHANGED
@@ -21,6 +21,21 @@ module RubyPsigate
|
|
21
21
|
|
22
22
|
alias_method :phone, :telephone
|
23
23
|
|
24
|
+
def initialize(options={})
|
25
|
+
@firstname = options[:firstname]
|
26
|
+
@lastname = options[:lastname]
|
27
|
+
@line1 = options[:line1]
|
28
|
+
@line2 = options[:line2]
|
29
|
+
@city = options[:city]
|
30
|
+
@state = options[:state]
|
31
|
+
@country = options[:country]
|
32
|
+
@zipcode = options[:zipcode]
|
33
|
+
@telephone = options[:telephone]
|
34
|
+
@fax = options[:fax]
|
35
|
+
@company = options[:company]
|
36
|
+
super
|
37
|
+
end
|
38
|
+
|
24
39
|
def name
|
25
40
|
"#{firstname} #{lastname}".strip
|
26
41
|
end
|
data/ruby_psigate.gemspec
CHANGED
data/test/unit/address_test.rb
CHANGED
@@ -7,6 +7,27 @@ module RubyPsigate
|
|
7
7
|
@address = Address.new
|
8
8
|
end
|
9
9
|
|
10
|
+
should "instantiate the address with hash" do
|
11
|
+
@valid_attributes = {
|
12
|
+
:firstname => "Bob",
|
13
|
+
:lastname => "Parsons",
|
14
|
+
:line1 => "1234 West 3rd Street",
|
15
|
+
:line2 => "Apt 123",
|
16
|
+
:city => "Toronto",
|
17
|
+
:state => "Ontario",
|
18
|
+
:country => "Canada",
|
19
|
+
:zipcode => "N3N3N3",
|
20
|
+
:telephone => "4161234567",
|
21
|
+
:fax => "4169999999",
|
22
|
+
:company => "Bob Parsons Company"
|
23
|
+
}
|
24
|
+
@address = Address.new(@valid_attributes)
|
25
|
+
|
26
|
+
%w( firstname lastname line1 line2 city state province country zipcode postalcode telephone fax company ).each do |field|
|
27
|
+
assert_not_nil @address.send(field.to_sym)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
10
31
|
%w( firstname lastname line1 line2 city state province country zipcode postalcode telephone fax company ).each do |field|
|
11
32
|
should "respond to #{field}" do
|
12
33
|
assert @address.respond_to?(field.downcase.to_sym)
|