-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bring back that test and make it pass
- Loading branch information
1 parent
ead98a3
commit cc654d9
Showing
2 changed files
with
31 additions
and
1 deletion.
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 |
---|---|---|
|
@@ -29,4 +29,34 @@ class TeamTest < ActiveSupport::TestCase | |
team.reload | ||
assert_equal "UTC", team.time_zone | ||
end | ||
|
||
test "default UTC time_zone is overwritten once the first user sets a time zone" do | ||
team = Team.create!(name: "new test team") | ||
user = User.create!(email: "[email protected]", password: "password", password_confirmation: "password", time_zone: nil) | ||
Membership.create!(team: team, user: user) | ||
team.reload | ||
assert_equal "UTC", team.time_zone | ||
|
||
user.time_zone = "Central Time (US & Canada)" | ||
user.save | ||
|
||
team.reload | ||
assert_equal "Central Time (US & Canada)", team.time_zone | ||
end | ||
|
||
test "nil time_zone is overwritten once the first user sets a time zone" do | ||
team = Team.create!(name: "new test team", time_zone: nil) | ||
user = User.create!(email: "[email protected]", password: "password", password_confirmation: "password", time_zone: nil) | ||
Membership.create!(team: team, user: user) | ||
team.time_zone = nil | ||
team.save | ||
team.reload | ||
assert_equal nil, team.time_zone | ||
|
||
user.time_zone = "Central Time (US & Canada)" | ||
user.save | ||
|
||
team.reload | ||
assert_equal "Central Time (US & Canada)", team.time_zone | ||
end | ||
end |