-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
require 'factory_girl' | ||
|
||
Factory.define :address do |a| | ||
a.street 'Jl. K.H. Ahmad Dahlan VI no 21F' | ||
a.zip '16425' | ||
a.city 'Depok' | ||
a.country 'ID' | ||
a.association :person | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
require 'factory_girl' | ||
|
||
Factory.define :person do |p| | ||
p.name 'Sirajuddin Maizir' | ||
p.sex 'male' | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
require File.dirname(__FILE__) + '/../test_helper' | ||
|
||
class AddressTest < ActionController::IntegrationTest | ||
context 'An address of a person' do | ||
setup do | ||
@address = Factory(:address) | ||
end | ||
|
||
should 'be visible on person page' do | ||
visit '/people' | ||
click_link @address.person.name | ||
assert_contain @address.street | ||
end | ||
|
||
should 'be able to see the details (street, zip, city, country code)' do | ||
visit '/people' | ||
click_link @address.person.name | ||
click_link @address.street | ||
assert_equal 200, status | ||
assert_contain @address.street | ||
assert_contain @address.zip | ||
assert_contain @address.city | ||
assert_contain @address.country | ||
end | ||
|
||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
require File.dirname(__FILE__) + '/../test_helper' | ||
|
||
class PersonTest < ActionController::IntegrationTest | ||
context 'A person' do | ||
setup do | ||
@person = Factory(:person) | ||
end | ||
|
||
should 'be visible on the web and clickable' do | ||
visit '/people' | ||
assert_contain @person.name | ||
click_link @person.name | ||
assert_equal 200, status | ||
end | ||
end | ||
end | ||
|