[Git][noosfero/noosfero][master] using Date.current to take into account the Rails timezone

Joenio Costa gitlab at mg.gitlab.com
Tue Mar 15 23:13:20 BRT 2016


Joenio Costa pushed to branch master at Noosfero / noosfero


Commits:
b7f8b7cc by Joenio Costa at 2016-03-15T23:05:41-03:00
using Date.current to take into account the Rails timezone

we must avoid using Date.today and DateTime.now in tests cases, they can
return yesterday or tomorrow depending on the machine's time zone and
ignores the configured Rails timezone

reference:
http://www.elabs.se/blog/36-working-with-time-zones-in-ruby-on-rails

- - - - -


1 changed file:

- test/unit/person_test.rb


Changes:

=====================================
test/unit/person_test.rb
=====================================
--- a/test/unit/person_test.rb
+++ b/test/unit/person_test.rb
@@ -1932,7 +1932,7 @@ class PersonTest < ActiveSupport::TestCase
     community.add_member person
 
     assert !person.member_relation_of(community).empty?, "Person '#{person.identifier}' is not a member of Community '#{community.identifier}'"
-    assert person.member_since_date(community) == Date.today,"Person '#{person.identifier}' is not added like a member of Community '#{community.identifier}' today"
+    assert_equal Date.current, person.member_since_date(community), "Person '#{person.identifier}' is not added like a member of Community '#{community.identifier}' today"
   end
 
   should 'a person follows many articles' do



View it on GitLab: https://gitlab.com/noosfero/noosfero/commit/b7f8b7cc650e13bb02d1a8d72eca1892f9ed150b
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20160316/60f8a542/attachment.html>


More information about the Noosfero-dev mailing list