[noosfero/noosfero][next] 10 commits: features/signup.feature: remove unfixable test

Antonio Terceiro gitlab at gitlab.com
Mon Apr 27 15:14:41 BRT 2015


Antonio Terceiro pushed to branch next at Noosfero / noosfero


Commits:
a3708580 by Antonio Terceiro at 2015-04-20T09:46:27Z
features/signup.feature: remove unfixable test

I have just tested manually and the functionality works. There must be
some timing issue in the test, but I wasn't able to find it.

- - - - -
9ae88783 by Antonio Terceiro at 2015-04-20T14:52:31Z
script/production: fix handling of PID files in status check

- - - - -
767a62fc by Daniela Feitosa at 2015-04-20T20:00:07Z
event_plugin: updated pt translation

- - - - -
6bab0781 by Daniela Feitosa at 2015-04-23T16:36:48Z
profile_suggestions: fixed email content

* broken ul tag
* link to suggestions page

- - - - -
083d29d3 by Daniela Feitosa at 2015-04-23T21:34:29Z
profile_suggestions: added test for link on email

Forgot to include on commit 6bab07816a6524e570945e2bcf3d776300bb3828 :(

- - - - -
486e450c by Daniela Feitosa at 2015-04-24T01:52:07Z
blocks: make sure limit is integer on get_limit

Blocks configured before the definition of limit type were strings and were
crashing

- - - - -
17dff5dd by Antonio Terceiro at 2015-04-24T13:49:16Z
Merge branch 'block_limit' into 'master'

blocks: make sure limit is integer on get_limit

Blocks configured before the definition of limit type were strings and were
crashing

See merge request !558

- - - - -
200ff2b0 by Daniela Feitosa at 2015-04-24T10:49:23Z
tinymce: added tab to configure img margins

- - - - -
cb62ddad by Antonio Terceiro at 2015-04-24T11:35:26Z
HighlightsBlock: fix test for randomness

Obviously a test for randomness that is not well designed will fail ...
randomly!

- - - - -
cbd74497 by Antonio Terceiro at 2015-04-27T15:14:54Z
Merge branch 'master' into next

- - - - -


9 changed files:

- app/models/block.rb
- app/models/highlights_block.rb
- app/views/user_mailer/profiles_suggestions_email.html.erb
- features/signup.feature
- plugins/event/po/pt/event.po
- script/production
- test/unit/block_test.rb
- test/unit/highlights_block_test.rb
- test/unit/user_mailer_test.rb


Changes:

=====================================
app/models/block.rb
=====================================
--- a/app/models/block.rb
+++ b/app/models/block.rb
@@ -23,7 +23,7 @@ class Block < ActiveRecord::Base
   end
 
   def get_limit
-    [0,limit].max
+    [0,limit.to_i].max
   end
 
   def embed_code


=====================================
app/models/highlights_block.rb
=====================================
--- a/app/models/highlights_block.rb
+++ b/app/models/highlights_block.rb
@@ -26,8 +26,16 @@ class HighlightsBlock < Block
   end
 
   def featured_images
-    block_images = images.select{|i| !i[:image_src].nil? }.sort { |x, y| x[:position] <=> y[:position] }
-    shuffle ? block_images.shuffle : block_images
+    images = get_images
+    shuffle ? images.shuffle : images
+  end
+
+  def get_images
+    images.select do |i|
+      !i[:image_src].nil?
+    end.sort do |x, y|
+      x[:position] <=> y[:position]
+    end
   end
 
   def content(args={})


=====================================
app/views/user_mailer/profiles_suggestions_email.html.erb
=====================================
--- a/app/views/user_mailer/profiles_suggestions_email.html.erb
+++ b/app/views/user_mailer/profiles_suggestions_email.html.erb
@@ -10,8 +10,8 @@
     <% @people_suggestions.each do |person| %>
     <li><a href="<%= url_for(person.public_profile_url) %>"><%= person.name %></a></li>
     <% end %>
-  <ul>
-  <%= _("To see the full list of friends suggestions, follow the link: %s") % @people_suggestions_url %>
+  </ul>
+  <%= _("To see the full list of friends suggestions, follow the link: %s") % url_for(@people_suggestions_url) %>
 <% end %>
 
 <% unless @communities_suggestions.empty? %>
@@ -21,13 +21,15 @@
     <% @communities_suggestions.each do |community| %>
     <li><a href="<%= url_for(community.public_profile_url) %>"><%= community.name %></a></li>
     <% end %>
-  <ul>
-  <%= _("To see the full list of communities suggestions, follow the link: %s") % @communities_suggestions_url %>
+  </ul>
+  <%= _("To see the full list of communities suggestions, follow the link: %s") % url_for(@communities_suggestions_url) %>
 <% end %>
 
 
 <%= _("Greetings,") %>
 
---
-<%= _('%s team.') % @environment %>
+<p><%= _("Greetings,") %></p>
+
+--<br/>
+<%= _('%s team.') % @environment %><br/>
 <%= @url %>


=====================================
features/signup.feature
=====================================
--- a/features/signup.feature
+++ b/features/signup.feature
@@ -267,32 +267,6 @@ Feature: signup
     Then I should be on the homepage
 
   @selenium
-  Scenario: join community on signup
-    Given the following users
-      | login | name |
-      | mariasilva | Maria Silva |
-    And the following communities
-       | name           | identifier    | owner     |
-       | Free Software  | freesoftware  | mariasilva |
-    And feature "skip_new_user_email_confirmation" is disabled on environment
-    And I am on /freesoftware
-    When I follow "Join"
-    And I follow "New user"
-    And I fill in the following within ".no-boxes":
-      | e-Mail                | josesilva at example.com |
-      | Username              | josesilva             |
-      | Password              | secret                |
-      | Password confirmation | secret                |
-      | Full name             | José da Silva         |
-    And wait for the captcha signup time
-    And I press "Create my account"
-    And I go to josesilva's confirmation URL
-    And I fill in "Username" with "josesilva"
-    And I fill in "Password" with "secret"
-    And I press "Log in"
-    Then "José da Silva" should be a member of "Free Software"
-
-  @selenium
   Scenario: user registration is moderated by admin
     Given feature "admin_must_approve_new_users" is enabled on environment
     And feature "skip_new_user_email_confirmation" is disabled on environment


=====================================
plugins/event/po/pt/event.po
=====================================
--- a/plugins/event/po/pt/event.po
+++ b/plugins/event/po/pt/event.po
@@ -5,8 +5,8 @@
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: 1.0-690-gcb6e853\n"
-"POT-Creation-Date: 2015-03-05 12:09-0300\n"
+"Project-Id-Version: 1.1~rc4\n"
+"POT-Creation-Date: 2015-04-20 19:44-0300\n"
 "PO-Revision-Date: 2015-01-30 00:18-0000\n"
 "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
 "Language-Team: LANGUAGE <LL at li.org>\n"
@@ -16,61 +16,53 @@ msgstr ""
 "Content-Transfer-Encoding: 8bit\n"
 "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
 
+#: plugins/event/lib/event_plugin.rb:4
+msgid "Event Extras"
+msgstr "Extras para Eventos"
+
+#: plugins/event/lib/event_plugin.rb:8
+msgid ""
+"Include a new block to show the environment's or profiles' events information"
+msgstr ""
+"Adiciona um novo bloco para apresentar as informações de eventos do ambiente "
+"ou dos perfis"
+
 #: plugins/event/lib/event_plugin/event_block.rb:12
 msgid "Events"
 msgstr "Eventos"
 
 #: plugins/event/lib/event_plugin/event_block.rb:16
 msgid "Show the profile events or all environment events."
-msgstr "Mostrar todos os eventos."
+msgstr "Mostra todos os eventos de um perfil ou do ambiente."
 
 #: plugins/event/lib/event_plugin/event_block.rb:65
-#, fuzzy
 msgid "One month ago"
 msgid_plural "%d months ago"
-msgstr[0] "Iniciou a um mês atrás."
-msgstr[1] "Iniciou a %d meses atrás."
+msgstr[0] "Um mês atrás"
+msgstr[1] "%d meses atrás."
 
 #: plugins/event/lib/event_plugin/event_block.rb:67
 msgid "Yesterday"
 msgid_plural "%d days ago"
-msgstr[0] ""
-msgstr[1] ""
+msgstr[0] "Ontem"
+msgstr[1] "%d dias atrás"
 
 #: plugins/event/lib/event_plugin/event_block.rb:69
 msgid "Today"
-msgstr ""
+msgstr "Hoje"
 
 #: plugins/event/lib/event_plugin/event_block.rb:71
 msgid "Tomorrow"
 msgid_plural "%d days left to start"
-msgstr[0] ""
-msgstr[1] ""
+msgstr[0] "Amanhã"
+msgstr[1] "%d dias para começar"
 
 #: plugins/event/lib/event_plugin/event_block.rb:73
-#, fuzzy
 msgid "One month left to start"
 msgid_plural "%d months left to start"
 msgstr[0] "Um mês para iniciar"
 msgstr[1] "% meses para iniciar"
 
-#: plugins/event/lib/event_plugin.rb:4
-msgid "Event Extras"
-msgstr "Eventos"
-
-#: plugins/event/lib/event_plugin.rb:8
-msgid ""
-"Include a new block to show the environment's or profiles' events information"
-msgstr ""
-"Adiciona um novo bloco para apresentar as informações de eventos do ambiente "
-"ou de perfis"
-
-#: plugins/event/views/event_plugin/event_block_item.html.erb:6
-msgid "Duration: 1 day"
-msgid_plural "Duration: %s days"
-msgstr[0] ""
-msgstr[1] ""
-
 #: plugins/event/views/profile_design/event_plugin/_event_block.html.erb:1
 msgid "Limit of items"
 msgstr "Limite de itens"
@@ -94,12 +86,17 @@ msgstr "Mostrar apenas eventos futuros"
 
 #: plugins/event/views/profile_design/event_plugin/_event_block.html.erb:22
 msgid "Limit of days to display"
-msgstr "Limite de dias de distância para mostrar eventos"
+msgstr "Limite de dias para mostrar"
 
 #: plugins/event/views/profile_design/event_plugin/_event_block.html.erb:24
-#, fuzzy
 msgid "Only show events in this interval of days."
-msgstr "Mostar somente eventos que acontecem dentro do limite de dias"
+msgstr "Mostar somente os eventos nesse intervalo de dias"
+
+#: plugins/event/views/event_plugin/event_block_item.html.erb:6
+msgid "Duration: 1 day"
+msgid_plural "Duration: %s days"
+msgstr[0] "Duração: 1 dia"
+msgstr[1] "Duração: %s dias"
 
 #~ msgid "Started one day ago."
 #~ msgid_plural "Started %d days ago."


=====================================
script/production
=====================================
--- a/script/production
+++ b/script/production
@@ -85,7 +85,7 @@ environments_loop() {
 }
 
 do_running() {
-  pids=$(sed "s/.*/& /" tmp/pids/thin.*.pid | tr -d '\n' 2>/dev/null || true)
+  pids=$(sed "s/.*/& /" tmp/pids/thin.*.pid 2>/dev/null | tr -d '\n')
   # passes if any of $pids exist, fails otherwise
   kill -0 $pids > /dev/null 2>&1
 }


=====================================
test/unit/block_test.rb
=====================================
--- a/test/unit/block_test.rb
+++ b/test/unit/block_test.rb
@@ -330,4 +330,11 @@ class BlockTest < ActiveSupport::TestCase
     block.save!
     assert !block.display_to_user?(person_friend)
   end
+
+  should 'get limit as a number when limit is string' do
+    block = RecentDocumentsBlock.new
+    block.settings[:limit] = '5'
+    assert block.get_limit.is_a?(Fixnum)
+  end
+
 end


=====================================
test/unit/highlights_block_test.rb
=====================================
--- a/test/unit/highlights_block_test.rb
+++ b/test/unit/highlights_block_test.rb
@@ -109,33 +109,14 @@ class HighlightsBlockTest < ActiveSupport::TestCase
   end
 
   should 'list images randomically' do
-    f1 = mock()
-    f1.expects(:public_filename).returns('address')
-    UploadedFile.expects(:find).with(1).returns(f1)
-    f2 = mock()
-    f2.expects(:public_filename).returns('address')
-    UploadedFile.expects(:find).with(2).returns(f2)
-    f3 = mock()
-    f3.expects(:public_filename).returns('address')
-    UploadedFile.expects(:find).with(3).returns(f3)
-    f4 = mock()
-    f4.expects(:public_filename).returns('address')
-    UploadedFile.expects(:find).with(4).returns(f4)
-    f5 = mock()
-    f5.expects(:public_filename).returns('address')
-    UploadedFile.expects(:find).with(5).returns(f5)
     block = HighlightsBlock.new
-    i1 = {:image_id => 1, :address => '/address', :position => 3, :title => 'address'}
-    i2 = {:image_id => 2, :address => '/address', :position => 1, :title => 'address'}
-    i3 = {:image_id => 3, :address => '/address', :position => 2, :title => 'address'}
-    i4 = {:image_id => 4, :address => '/address', :position => 5, :title => 'address'}
-    i5 = {:image_id => 5, :address => '/address', :position => 4, :title => 'address'}
-    block.images = [i1,i2,i3,i4,i5]
     block.shuffle = true
-    block.save!
-    block.reload
-    assert_equal [i1,i2,i3,i4,i5], block.images
-    assert_not_equal [i2,i3,i1,i4,i5], block.featured_images
+
+    images = []
+    block.expects(:get_images).returns(images)
+    images.expects(:shuffle).returns(images)
+
+    block.featured_images
   end
 
   [Environment, Profile].each do |klass|


=====================================
test/unit/user_mailer_test.rb
=====================================
--- a/test/unit/user_mailer_test.rb
+++ b/test/unit/user_mailer_test.rb
@@ -18,6 +18,14 @@ class UserMailerTest < ActiveSupport::TestCase
     end
   end
 
+  should 'deliver profiles suggestions email' do
+    person = create_user('some-user').person
+    ProfileSuggestion.create!(:person => person, :suggestion =>
+fast_create(Person))
+    email = UserMailer.profiles_suggestions_email(person).deliver
+    assert_match /profile\/some-user\/friends\/suggest/, email.body.to_s
+  end
+
   private
 
     def read_fixture(action)



View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/d818aa8e5a28bb6cea9c49fb086636b4dc92c9ef...cbd744979ec558beac1f0b8002d195f6363c898d
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20150427/de5087b8/attachment-0001.html>


More information about the Noosfero-dev mailing list