Commit 48038fc5280aa13175bba9fc78512ca7faad9c24
Exists in
master
and in
29 other branches
Merge branch 'stable' into noosfero_0.47.0
Conflicts: app/controllers/public/content_viewer_controller.rb features/categories_block.feature po/eo/noosfero.po po/es/noosfero.po po/it/noosfero.po test/unit/block_test.rb
Showing
29 changed files
with
306 additions
and
186 deletions
Show diff stats
app/controllers/public/content_viewer_controller.rb
@@ -50,7 +50,7 @@ class ContentViewerController < ApplicationController | @@ -50,7 +50,7 @@ class ContentViewerController < ApplicationController | ||
50 | end | 50 | end |
51 | 51 | ||
52 | # At this point the page will be showed | 52 | # At this point the page will be showed |
53 | - @page.hit | 53 | + @page.hit unless user_is_a_bot? |
54 | 54 | ||
55 | @page = FilePresenter.for @page | 55 | @page = FilePresenter.for @page |
56 | 56 | ||
@@ -174,4 +174,13 @@ class ContentViewerController < ApplicationController | @@ -174,4 +174,13 @@ class ContentViewerController < ApplicationController | ||
174 | allowed | 174 | allowed |
175 | end | 175 | end |
176 | 176 | ||
177 | + def user_is_a_bot? | ||
178 | + user_agent= request.env["HTTP_USER_AGENT"] | ||
179 | + user_agent.blank? || | ||
180 | + user_agent.match(/bot/) || | ||
181 | + user_agent.match(/spider/) || | ||
182 | + user_agent.match(/crawler/) || | ||
183 | + user_agent.match(/\(.*https?:\/\/.*\)/) | ||
184 | + end | ||
185 | + | ||
177 | end | 186 | end |
app/controllers/public/events_controller.rb
@@ -7,11 +7,11 @@ class EventsController < PublicController | @@ -7,11 +7,11 @@ class EventsController < PublicController | ||
7 | @date = build_date(params[:year], params[:month], params[:day]) | 7 | @date = build_date(params[:year], params[:month], params[:day]) |
8 | 8 | ||
9 | if !params[:year] && !params[:month] && !params[:day] | 9 | if !params[:year] && !params[:month] && !params[:day] |
10 | - @events = profile.events.next_events_from_month(@date) | 10 | + @events = profile.events.next_events_from_month(@date).paginate(:per_page => per_page, :page => params[:page]) |
11 | end | 11 | end |
12 | 12 | ||
13 | if params[:year] || params[:month] | 13 | if params[:year] || params[:month] |
14 | - @events = profile.events.by_month(@date) | 14 | + @events = profile.events.by_month(@date).paginate(:per_page => per_page, :page => params[:page]) |
15 | end | 15 | end |
16 | 16 | ||
17 | events_in_range = profile.events.by_range((@date - 1.month).at_beginning_of_month .. (@date + 1.month).at_end_of_month) | 17 | events_in_range = profile.events.by_range((@date - 1.month).at_beginning_of_month .. (@date + 1.month).at_end_of_month) |
@@ -29,4 +29,7 @@ class EventsController < PublicController | @@ -29,4 +29,7 @@ class EventsController < PublicController | ||
29 | 29 | ||
30 | include EventsHelper | 30 | include EventsHelper |
31 | 31 | ||
32 | + def per_page | ||
33 | + 20 | ||
34 | + end | ||
32 | end | 35 | end |
app/controllers/public/search_controller.rb
@@ -99,14 +99,14 @@ class SearchController < PublicController | @@ -99,14 +99,14 @@ class SearchController < PublicController | ||
99 | @events = [] | 99 | @events = [] |
100 | if params[:day] || !params[:year] && !params[:month] | 100 | if params[:day] || !params[:year] && !params[:month] |
101 | @events = @category ? | 101 | @events = @category ? |
102 | - environment.events.by_day(@date).in_category(Category.find(@category_id)) : | ||
103 | - environment.events.by_day(@date) | 102 | + environment.events.by_day(@date).in_category(Category.find(@category_id)).paginate(:per_page => per_page, :page => params[:page]) : |
103 | + environment.events.by_day(@date).paginate(:per_page => per_page, :page => params[:page]) | ||
104 | end | 104 | end |
105 | 105 | ||
106 | if params[:year] || params[:month] | 106 | if params[:year] || params[:month] |
107 | @events = @category ? | 107 | @events = @category ? |
108 | - environment.events.by_month(@date).in_category(Category.find(@category_id)) : | ||
109 | - environment.events.by_month(@date) | 108 | + environment.events.by_month(@date).in_category(Category.find(@category_id)).paginate(:per_page => per_page, :page => params[:page]) : |
109 | + environment.events.by_month(@date).paginate(:per_page => per_page, :page => params[:page]) | ||
110 | end | 110 | end |
111 | 111 | ||
112 | @scope = date_range && params[:action] == 'events' ? environment.events.by_range(date_range) : environment.events | 112 | @scope = date_range && params[:action] == 'events' ? environment.events.by_range(date_range) : environment.events |
@@ -139,7 +139,7 @@ class SearchController < PublicController | @@ -139,7 +139,7 @@ class SearchController < PublicController | ||
139 | 139 | ||
140 | def events_by_day | 140 | def events_by_day |
141 | @date = build_date(params[:year], params[:month], params[:day]) | 141 | @date = build_date(params[:year], params[:month], params[:day]) |
142 | - @events = environment.events.by_day(@date) | 142 | + @events = environment.events.by_day(@date).paginate(:per_page => per_page, :page => params[:page]) |
143 | render :partial => 'events/events' | 143 | render :partial => 'events/events' |
144 | end | 144 | end |
145 | 145 | ||
@@ -224,4 +224,8 @@ class SearchController < PublicController | @@ -224,4 +224,8 @@ class SearchController < PublicController | ||
224 | @environment.send(klass.name.underscore.pluralize).visible.includes(relations) | 224 | @environment.send(klass.name.underscore.pluralize).visible.includes(relations) |
225 | end | 225 | end |
226 | 226 | ||
227 | + def per_page | ||
228 | + 20 | ||
229 | + end | ||
230 | + | ||
227 | end | 231 | end |
app/models/block.rb
@@ -141,7 +141,7 @@ class Block < ActiveRecord::Base | @@ -141,7 +141,7 @@ class Block < ActiveRecord::Base | ||
141 | end | 141 | end |
142 | 142 | ||
143 | alias :active_record_cache_key :cache_key | 143 | alias :active_record_cache_key :cache_key |
144 | - def cache_key(language='en') | 144 | + def cache_key(language='en', user=nil) |
145 | active_record_cache_key+'-'+language | 145 | active_record_cache_key+'-'+language |
146 | end | 146 | end |
147 | 147 |
app/models/event.rb
@@ -38,15 +38,12 @@ class Event < Article | @@ -38,15 +38,12 @@ class Event < Article | ||
38 | named_scope :next_events_from_month, lambda { |date| | 38 | named_scope :next_events_from_month, lambda { |date| |
39 | date_temp = date.strftime("%Y-%m-%d") | 39 | date_temp = date.strftime("%Y-%m-%d") |
40 | { :conditions => ["start_date >= ?","#{date_temp}"], | 40 | { :conditions => ["start_date >= ?","#{date_temp}"], |
41 | - :limit => 10, | ||
42 | :order => 'start_date ASC' | 41 | :order => 'start_date ASC' |
43 | } | 42 | } |
44 | } | 43 | } |
45 | 44 | ||
46 | named_scope :by_month, lambda { |date| | 45 | named_scope :by_month, lambda { |date| |
47 | - date_temp = date.strftime("%Y-%m") | ||
48 | { :conditions => ["EXTRACT(YEAR FROM start_date) = ? AND EXTRACT(MONTH FROM start_date) = ?",date.year,date.month], | 46 | { :conditions => ["EXTRACT(YEAR FROM start_date) = ? AND EXTRACT(MONTH FROM start_date) = ?",date.year,date.month], |
49 | - :limit => 10, | ||
50 | :order => 'start_date ASC' | 47 | :order => 'start_date ASC' |
51 | } | 48 | } |
52 | } | 49 | } |
app/models/members_block.rb
@@ -36,4 +36,15 @@ class MembersBlock < ProfileListBlock | @@ -36,4 +36,15 @@ class MembersBlock < ProfileListBlock | ||
36 | } | 36 | } |
37 | end | 37 | end |
38 | 38 | ||
39 | + def cache_key(language='en', user=nil) | ||
40 | + logged = '' | ||
41 | + if user | ||
42 | + logged += '-logged-in' | ||
43 | + if user.is_member_of? self.owner | ||
44 | + logged += '-member' | ||
45 | + end | ||
46 | + end | ||
47 | + super + logged | ||
48 | + end | ||
49 | + | ||
39 | end | 50 | end |
app/views/events/_events.rhtml
app/views/shared/block.rhtml
1 | <% if block.cacheable? && use_cache %> | 1 | <% if block.cacheable? && use_cache %> |
2 | - <% cache_timeout(block.cache_key(language), block.timeout) do %> | 2 | + <% cache_timeout(block.cache_key(language, user), block.timeout) do %> |
3 | <%= display_block_content(block, user, main_content) %> | 3 | <%= display_block_content(block, user, main_content) %> |
4 | <% end %> | 4 | <% end %> |
5 | <% else %> | 5 | <% else %> |
features/balloon.feature
@@ -8,6 +8,7 @@ Feature: balloon | @@ -8,6 +8,7 @@ Feature: balloon | ||
8 | And the following communities | 8 | And the following communities |
9 | | identifier | name | | 9 | | identifier | name | |
10 | | sample | Sample | | 10 | | sample | Sample | |
11 | + And I am logged in as "joaosilva" | ||
11 | 12 | ||
12 | @selenium | 13 | @selenium |
13 | Scenario: I should not see trigger if not enabled | 14 | Scenario: I should not see trigger if not enabled |
features/categories_block.feature
@@ -24,6 +24,8 @@ Feature: categories_block | @@ -24,6 +24,8 @@ Feature: categories_block | ||
24 | | owner | type | | 24 | | owner | type | |
25 | | environment | CategoriesBlock | | 25 | | environment | CategoriesBlock | |
26 | And I am logged in as admin | 26 | And I am logged in as admin |
27 | + And I go to /admin/environment_design | ||
28 | + And display ".button-bar" | ||
27 | 29 | ||
28 | # Note that this @ignore-hidden-elements only works for seeing hidden | 30 | # Note that this @ignore-hidden-elements only works for seeing hidden |
29 | # elements. It actually doesn't work for following hidden link or pressing | 31 | # elements. It actually doesn't work for following hidden link or pressing |
@@ -31,9 +33,7 @@ Feature: categories_block | @@ -31,9 +33,7 @@ Feature: categories_block | ||
31 | # the link. | 33 | # the link. |
32 | @selenium @ignore-hidden-elements | 34 | @selenium @ignore-hidden-elements |
33 | Scenario: List just product categories | 35 | Scenario: List just product categories |
34 | - Given I go to /admin/environment_design | ||
35 | - And display ".categories-block .button-bar" | ||
36 | - And I follow "Edit" within ".categories-block" | 36 | + Given I follow "Edit" within ".categories-block" |
37 | And I check "Product" | 37 | And I check "Product" |
38 | When I press "Save" | 38 | When I press "Save" |
39 | Then I should see "Food" | 39 | Then I should see "Food" |
@@ -42,11 +42,9 @@ Feature: categories_block | @@ -42,11 +42,9 @@ Feature: categories_block | ||
42 | And "Steak" should not be visible within "span#category-name" | 42 | And "Steak" should not be visible within "span#category-name" |
43 | And "Fiction" should not be visible within "span#category-name" | 43 | And "Fiction" should not be visible within "span#category-name" |
44 | 44 | ||
45 | - @selenium @ignore-hidden-elements | 45 | + @selenium |
46 | Scenario: Show submenu if it exists | 46 | Scenario: Show submenu if it exists |
47 | - Given I go to /admin/environment_design | ||
48 | - And display ".categories-block .button-bar" | ||
49 | - And I follow "Edit" within ".categories-block" | 47 | + Given I follow "Edit" within ".categories-block" |
50 | And I check "Product" | 48 | And I check "Product" |
51 | And I press "Save" | 49 | And I press "Save" |
52 | Then I should see "Food" | 50 | Then I should see "Food" |
@@ -61,11 +59,9 @@ Feature: categories_block | @@ -61,11 +59,9 @@ Feature: categories_block | ||
61 | And I should see "Steak" | 59 | And I should see "Steak" |
62 | And I should not see "Fiction" | 60 | And I should not see "Fiction" |
63 | 61 | ||
64 | - @selenium @ignore-hidden-elements | 62 | + @selenium |
65 | Scenario: Show only one submenu per time | 63 | Scenario: Show only one submenu per time |
66 | - Given I go to /admin/environment_design | ||
67 | - And display ".categories-block .button-bar" | ||
68 | - And I follow "Edit" within ".categories-block" | 64 | + Given I follow "Edit" within ".categories-block" |
69 | And I check "Product" | 65 | And I check "Product" |
70 | And I press "Save" | 66 | And I press "Save" |
71 | Then I should see "Book" | 67 | Then I should see "Book" |
@@ -73,20 +69,16 @@ Feature: categories_block | @@ -73,20 +69,16 @@ Feature: categories_block | ||
73 | When I follow "block_2_category_2" | 69 | When I follow "block_2_category_2" |
74 | Then I should see "Literature" | 70 | Then I should see "Literature" |
75 | 71 | ||
76 | - @selenium @ignore-hidden-elements | 72 | + @selenium |
77 | Scenario: List just general categories | 73 | Scenario: List just general categories |
78 | - Given I go to /admin/environment_design | ||
79 | - And display ".categories-block .button-bar" | ||
80 | - And I follow "Edit" within ".categories-block" | 74 | + Given I follow "Edit" within ".categories-block" |
81 | And I check "Generic category" | 75 | And I check "Generic category" |
82 | When I press "Save" | 76 | When I press "Save" |
83 | Then I should see "Wood" | 77 | Then I should see "Wood" |
84 | 78 | ||
85 | - @selenium @ignore-hidden-elements | 79 | + @selenium |
86 | Scenario: List just regions | 80 | Scenario: List just regions |
87 | - Given I go to /admin/environment_design | ||
88 | - And display ".categories-block .button-bar" | ||
89 | - And I follow "Edit" within ".categories-block" | 81 | + Given I follow "Edit" within ".categories-block" |
90 | And I check "Region" | 82 | And I check "Region" |
91 | When I press "Save" | 83 | When I press "Save" |
92 | Then I should see "Bahia" | 84 | Then I should see "Bahia" |
features/comment.feature
@@ -39,7 +39,7 @@ Feature: comment | @@ -39,7 +39,7 @@ Feature: comment | ||
39 | When I press "Post comment" | 39 | When I press "Post comment" |
40 | Then I should see "Hey ho, let's go" | 40 | Then I should see "Hey ho, let's go" |
41 | 41 | ||
42 | - @selenium | 42 | + @selenium-fixme |
43 | Scenario: redirect to right place after comment a picture | 43 | Scenario: redirect to right place after comment a picture |
44 | Given the following files | 44 | Given the following files |
45 | | owner | file | mime | | 45 | | owner | file | mime | |
features/events.feature
@@ -244,3 +244,38 @@ Feature: events | @@ -244,3 +244,38 @@ Feature: events | ||
244 | Given I am on /profile/josesilva/events/2009/10 | 244 | Given I am on /profile/josesilva/events/2009/10 |
245 | When I follow "Oktoberfest" | 245 | When I follow "Oktoberfest" |
246 | Then I should see "Oktoberfest" | 246 | Then I should see "Oktoberfest" |
247 | + | ||
248 | + Scenario: list events paginated for a specific profile for the month | ||
249 | + Given I am logged in as admin | ||
250 | + And the following users | ||
251 | + | login | | ||
252 | + | josemanuel | | ||
253 | + And I am logged in as "josemanuel" | ||
254 | + And the following events | ||
255 | + | owner | name | start_date | | ||
256 | + | josemanuel | Event 5 | 2009-10-12 | | ||
257 | + | josemanuel | Event 3 | 2009-10-15 | | ||
258 | + | josemanuel | Test Event | 2009-10-15 | | ||
259 | + | josemanuel | Oktoberfest | 2009-10-19 | | ||
260 | + | josemanuel | WikiSym | 2009-10-21 | | ||
261 | + | josemanuel | Free Software | 2009-10-22 | | ||
262 | + | josemanuel | Rachel Birthday | 2009-10-23 | | ||
263 | + | josemanuel | Manuel Birthday | 2009-10-24 | | ||
264 | + | josemanuel | Michelle Birthday | 2009-10-25 | | ||
265 | + | josemanuel | Lecture Allien 10 | 2009-10-26 | | ||
266 | + | josemanuel | Lecture Allien 11 | 2009-10-26 | | ||
267 | + | josemanuel | Lecture Allien 12 | 2009-10-26 | | ||
268 | + | josemanuel | Lecture Allien 13 | 2009-10-26 | | ||
269 | + | josemanuel | Lecture Allien 14 | 2009-10-26 | | ||
270 | + | josemanuel | Lecture Allien 15 | 2009-10-26 | | ||
271 | + | josemanuel | Lecture Allien 16 | 2009-10-26 | | ||
272 | + | josemanuel | Lecture Allien 17 | 2009-10-26 | | ||
273 | + | josemanuel | Lecture Allien 18 | 2009-10-26 | | ||
274 | + | josemanuel | Lecture Allien 19 | 2009-10-26 | | ||
275 | + | josemanuel | Lecture Allien 20 | 2009-10-26 | | ||
276 | + | josemanuel | Party On | 2009-10-27 | | ||
277 | + | ||
278 | + When I am on /profile/josemanuel/events/2009/10 | ||
279 | + Then I should not see "Party On" within "#agenda-items" | ||
280 | + When I follow "Next" | ||
281 | + Then I should see "Party On" within "#agenda-items" |
features/short_filename.feature
@@ -1,21 +0,0 @@ | @@ -1,21 +0,0 @@ | ||
1 | -Feature: sitemap | ||
2 | - As a noosfero user | ||
3 | - I want to list articles | ||
4 | - | ||
5 | - Background: | ||
6 | - Given I am on the homepage | ||
7 | - And the following users | ||
8 | - | login | name | | ||
9 | - | joaosilva | Joao Silva | | ||
10 | - And the following files | ||
11 | - | owner | file | mime | | ||
12 | - | joaosilva | AGENDA_CULTURA_-_FESTA_DE_VAQUEIROS_PONTO_DE_SERRA_PRETA_BAIXA.txt | text/plain | | ||
13 | - | ||
14 | - Scenario: view a folder page | ||
15 | - When I am on /profile/joaosilva/sitemap | ||
16 | - Then I should see "AGENDA_CULTURA_-_FESTA_DE_VAQUEIRO(...).txt" | ||
17 | - | ||
18 | - Scenario: view the CMS | ||
19 | - Given I am logged in as "joaosilva" | ||
20 | - When I am on /myprofile/joaosilva/cms | ||
21 | - Then I should see "AGENDA_CULTURA_-_FESTA_DE_VAQUEIROS_PONTO_DE_SERRA_(...).txt" |
lib/feed_handler.rb
@@ -51,7 +51,6 @@ class FeedHandler | @@ -51,7 +51,6 @@ class FeedHandler | ||
51 | end | 51 | end |
52 | 52 | ||
53 | def process(container) | 53 | def process(container) |
54 | - RAILS_DEFAULT_LOGGER.info("Processing %s with id = %d" % [container.class.name, container.id]) | ||
55 | begin | 54 | begin |
56 | container.class.transaction do | 55 | container.class.transaction do |
57 | if container.update_errors > FeedHandler.max_errors && container.fetched_at < (Time.now - FeedHandler.disabled_period) | 56 | if container.update_errors > FeedHandler.max_errors && container.fetched_at < (Time.now - FeedHandler.disabled_period) |
lib/file_presenter.rb
@@ -50,6 +50,10 @@ class FilePresenter | @@ -50,6 +50,10 @@ class FilePresenter | ||
50 | nil | 50 | nil |
51 | end | 51 | end |
52 | 52 | ||
53 | + def download?(view=nil) | ||
54 | + false | ||
55 | + end | ||
56 | + | ||
53 | def short_description | 57 | def short_description |
54 | file_type = if content_type.present? | 58 | file_type = if content_type.present? |
55 | content_type.sub(/^application\//, '').sub(/^x-/, '').sub(/^image\//, '') | 59 | content_type.sub(/^application\//, '').sub(/^x-/, '').sub(/^image\//, '') |
lib/tasks/plugins_tests.rake
@@ -25,51 +25,87 @@ def plugin_disabled_warning(plugin) | @@ -25,51 +25,87 @@ def plugin_disabled_warning(plugin) | ||
25 | puts "E: you should enable #{plugin} plugin before running it's tests!" | 25 | puts "E: you should enable #{plugin} plugin before running it's tests!" |
26 | end | 26 | end |
27 | 27 | ||
28 | -def run_tests(name, files_glob) | ||
29 | - files = Dir.glob(files_glob) | ||
30 | - if files.empty? | ||
31 | - puts "I: no tests to run (#{name})" | 28 | +def task2ext(task) |
29 | + (task == :selenium || task == :cucumber) ? :feature : :rb | ||
30 | +end | ||
31 | + | ||
32 | +def task2profile(task, plugin) | ||
33 | + if task == :cucumber | ||
34 | + return plugin | ||
35 | + elsif task == :selenium | ||
36 | + return "#{plugin}_selenium" | ||
32 | else | 37 | else |
33 | - sh 'testrb', '-Itest', *files | 38 | + return 'default' |
34 | end | 39 | end |
35 | end | 40 | end |
36 | 41 | ||
37 | -def run_cucumber(name, profile, files_glob) | ||
38 | - files = Dir.glob(files_glob) | ||
39 | - if files.empty? | ||
40 | - puts "I: no tests to run #{name}" | 42 | +def filename2plugin(filename) |
43 | + filename.split('/')[1] | ||
44 | +end | ||
45 | + | ||
46 | +def task2folder(task) | ||
47 | + result = case task.to_sym | ||
48 | + when :units | ||
49 | + :unit | ||
50 | + when :functionals | ||
51 | + :functional | ||
52 | + when :integration | ||
53 | + :integration | ||
54 | + when :cucumber | ||
55 | + :features | ||
56 | + when :selenium | ||
57 | + :features | ||
58 | + end | ||
59 | + | ||
60 | + return result | ||
61 | +end | ||
62 | + | ||
63 | +def run_test(name, files) | ||
64 | + files = Array(files) | ||
65 | + plugin = filename2plugin(files.first) | ||
66 | + if name == :cucumber || name == :selenium | ||
67 | + run_cucumber task2_profile(name, plugin), files | ||
41 | else | 68 | else |
42 | - sh 'xvfb-run', 'ruby', '-S', 'cucumber', '--profile', profile.to_s, '--format', ENV['CUCUMBER_FORMAT'] || 'progress' , *files | 69 | + run_testrb files |
43 | end | 70 | end |
44 | end | 71 | end |
45 | 72 | ||
46 | -def plugin_test_task(name, plugin, files_glob) | ||
47 | - desc "Run #{name} tests for #{plugin_name(plugin)}" | ||
48 | - task name => 'db:test:plugins:prepare' do |t| | ||
49 | - if plugin_enabled?(plugin) | ||
50 | - run_tests t.name, files_glob | ||
51 | - else | ||
52 | - plugin_disabled_warning(plugin) | 73 | +def run_testrb(files) |
74 | + sh 'testrb', '-Itest', *files | ||
75 | +end | ||
76 | + | ||
77 | +def run_cucumber(profile, files) | ||
78 | + sh 'xvfb-run', 'ruby', '-S', 'cucumber', '--profile', profile.to_s, '--format', ENV['CUCUMBER_FORMAT'] || 'progress' , *files | ||
79 | +end | ||
80 | + | ||
81 | +def custom_run(name, files, run=:individually) | ||
82 | + case run | ||
83 | + when :all | ||
84 | + run_test name, files | ||
85 | + when :individually | ||
86 | + files.each do |file| | ||
87 | + run_test name, file | ||
53 | end | 88 | end |
89 | + when :by_plugin | ||
54 | end | 90 | end |
55 | end | 91 | end |
56 | 92 | ||
57 | -def plugin_cucumber_task(name, plugin, files_glob) | ||
58 | - desc "Run #{name} tests for #{plugin_name(plugin)}" | ||
59 | - task name => 'db:test:plugins:prepare' do |t| | ||
60 | - if plugin_enabled?(plugin) | ||
61 | - run_cucumber t.name, plugin, files_glob | ||
62 | - else | ||
63 | - plugin_disabled_warning(plugin) | ||
64 | - end | 93 | +def run_tests(name, plugins, run=:individually) |
94 | + plugins = Array(plugins) | ||
95 | + glob = "plugins/{#{plugins.join(',')}}/test/#{task2folder(name)}/**/*.#{task2ext(name)}" | ||
96 | + files = Dir.glob(glob) | ||
97 | + if files.empty? | ||
98 | + puts "I: no tests to run #{name}" | ||
99 | + else | ||
100 | + custom_run(name, files, run) | ||
65 | end | 101 | end |
66 | end | 102 | end |
67 | 103 | ||
68 | -def plugin_selenium_task(name, plugin, files_glob) | 104 | +def plugin_test_task(name, plugin, run=:individually) |
69 | desc "Run #{name} tests for #{plugin_name(plugin)}" | 105 | desc "Run #{name} tests for #{plugin_name(plugin)}" |
70 | task name => 'db:test:plugins:prepare' do |t| | 106 | task name => 'db:test:plugins:prepare' do |t| |
71 | if plugin_enabled?(plugin) | 107 | if plugin_enabled?(plugin) |
72 | - run_cucumber t.name, "#{plugin}_selenium", files_glob | 108 | + run_tests(name, plugin, run) |
73 | else | 109 | else |
74 | plugin_disabled_warning(plugin) | 110 | plugin_disabled_warning(plugin) |
75 | end | 111 | end |
@@ -98,28 +134,28 @@ namespace :test do | @@ -98,28 +134,28 @@ namespace :test do | ||
98 | namespace :noosfero_plugins do | 134 | namespace :noosfero_plugins do |
99 | all_plugins.each do |plugin| | 135 | all_plugins.each do |plugin| |
100 | namespace plugin do | 136 | namespace plugin do |
101 | - plugin_test_task :units, plugin, "plugins/#{plugin}/test/unit/**/*.rb" | ||
102 | - plugin_test_task :functionals, plugin, "plugins/#{plugin}/test/functional/**/*.rb" | ||
103 | - plugin_test_task :integration, plugin, "plugins/#{plugin}/test/integration/**/*.rb" | ||
104 | - plugin_cucumber_task :cucumber, plugin, "plugins/#{plugin}/features/**/*.feature" | ||
105 | - plugin_selenium_task :selenium, plugin, "plugins/#{plugin}/features/**/*.feature" | 137 | + plugin_test_task :units, plugin |
138 | + plugin_test_task :functionals, plugin | ||
139 | + plugin_test_task :integration, plugin | ||
140 | + plugin_test_task :cucumber, plugin | ||
141 | + plugin_test_task :selenium, plugin | ||
106 | end | 142 | end |
107 | 143 | ||
108 | test_sequence_task(plugin, plugin, "#{plugin}:units", "#{plugin}:functionals", "#{plugin}:integration", "#{plugin}:cucumber", "#{plugin}:selenium") | 144 | test_sequence_task(plugin, plugin, "#{plugin}:units", "#{plugin}:functionals", "#{plugin}:integration", "#{plugin}:cucumber", "#{plugin}:selenium") |
109 | end | 145 | end |
110 | 146 | ||
111 | - { :units => :unit , :functionals => :functional , :integration => :integration }.each do |taskname,folder| | 147 | + [:units, :functionals, :integration].each do |taskname| |
112 | task taskname => 'db:test:plugins:prepare' do |t| | 148 | task taskname => 'db:test:plugins:prepare' do |t| |
113 | - run_tests t.name, "plugins/{#{enabled_plugins.join(',')}}/test/#{folder}/**/*.rb" | 149 | + run_tests taskname, enabled_plugins |
114 | end | 150 | end |
115 | end | 151 | end |
116 | 152 | ||
117 | task :cucumber => 'db:test:plugins:prepare' do |t| | 153 | task :cucumber => 'db:test:plugins:prepare' do |t| |
118 | - run_cucumber t.name, :default, "plugins/{#{enabled_plugins.join(',')}}/test/features/**/*.features" | 154 | + run_tests :cucumber, enabled_plugins |
119 | end | 155 | end |
120 | 156 | ||
121 | task :selenium => 'db:test:plugins:prepare' do |t| | 157 | task :selenium => 'db:test:plugins:prepare' do |t| |
122 | - run_cucumber t.name, :selenium, "plugins/{#{enabled_plugins.join(',')}}/test/features/**/*.features" | 158 | + run_tests :selenium, enabled_plugins |
123 | end | 159 | end |
124 | 160 | ||
125 | task :temp_enable_all_plugins do | 161 | task :temp_enable_all_plugins do |
plugins/anti_spam/lib/anti_spam_plugin/wrapper.rb
@@ -2,9 +2,10 @@ class AntiSpamPlugin::Wrapper < SimpleDelegator | @@ -2,9 +2,10 @@ class AntiSpamPlugin::Wrapper < SimpleDelegator | ||
2 | include Rakismet::Model | 2 | include Rakismet::Model |
3 | 3 | ||
4 | @@wrappers = [] | 4 | @@wrappers = [] |
5 | + cattr_accessor :wrappers | ||
5 | 6 | ||
6 | def self.wrap(object) | 7 | def self.wrap(object) |
7 | - wrapper = @@wrappers.find { |wrapper| wrapper.wraps?(object) } | 8 | + wrapper = wrappers.find { |wrapper| wrapper.wraps?(object) } |
8 | wrapper ? wrapper.new(object) : object | 9 | wrapper ? wrapper.new(object) : object |
9 | end | 10 | end |
10 | 11 | ||
@@ -13,6 +14,10 @@ class AntiSpamPlugin::Wrapper < SimpleDelegator | @@ -13,6 +14,10 @@ class AntiSpamPlugin::Wrapper < SimpleDelegator | ||
13 | end | 14 | end |
14 | 15 | ||
15 | def self.inherited(child) | 16 | def self.inherited(child) |
16 | - @@wrappers << child | 17 | + wrappers << child |
17 | end | 18 | end |
18 | end | 19 | end |
20 | + | ||
21 | +Dir.glob(File.join(AntiSpamPlugin.root_path, 'lib', 'anti_spam_plugin', '*_wrapper.rb')) do |file| | ||
22 | + load(file) | ||
23 | +end |
plugins/community_track/test/functional/community_track_plugin_content_viewer_controller_test.rb
@@ -10,7 +10,7 @@ end | @@ -10,7 +10,7 @@ end | ||
10 | class ContentViewerControllerTest < ActionController::TestCase | 10 | class ContentViewerControllerTest < ActionController::TestCase |
11 | 11 | ||
12 | def setup | 12 | def setup |
13 | - @profile = fast_create(Community) | 13 | + @profile = Community.create!(:name => 'Sample community', :identifier => 'sample-community') |
14 | @track = create_track('track', @profile) | 14 | @track = create_track('track', @profile) |
15 | @step = CommunityTrackPlugin::Step.create!(:name => 'step1', :body => 'body', :profile => @profile, :parent => @track, :published => false, :end_date => Date.today, :start_date => Date.today, :tool_type => TinyMceArticle.name) | 15 | @step = CommunityTrackPlugin::Step.create!(:name => 'step1', :body => 'body', :profile => @profile, :parent => @track, :published => false, :end_date => Date.today, :start_date => Date.today, :tool_type => TinyMceArticle.name) |
16 | 16 | ||
@@ -87,43 +87,35 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -87,43 +87,35 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
87 | end | 87 | end |
88 | 88 | ||
89 | should 'render a div with block id for track list block' do | 89 | should 'render a div with block id for track list block' do |
90 | - box = fast_create(Box, :owner_id => @profile.id, :owner_type => @profile.class.name) | ||
91 | - @block = CommunityTrackPlugin::TrackListBlock.create!(:box => box) | ||
92 | - @profile.boxes << box | 90 | + @block = CommunityTrackPlugin::TrackListBlock.create!(:box => @profile.boxes.last) |
93 | get :view_page, @step.url | 91 | get :view_page, @step.url |
94 | assert_tag :tag => 'div', :attributes => { :class => 'track_list', :id => "track_list_#{@block.id}" } | 92 | assert_tag :tag => 'div', :attributes => { :class => 'track_list', :id => "track_list_#{@block.id}" } |
95 | end | 93 | end |
96 | 94 | ||
97 | should 'render a div with block id for track card list block' do | 95 | should 'render a div with block id for track card list block' do |
98 | - box = fast_create(Box, :owner_id => @profile.id, :owner_type => @profile.class.name) | ||
99 | - @block = CommunityTrackPlugin::TrackCardListBlock.create!(:box => box) | ||
100 | - @profile.boxes << box | 96 | + @block = CommunityTrackPlugin::TrackCardListBlock.create!(:box => @profile.boxes.last) |
101 | get :view_page, @step.url | 97 | get :view_page, @step.url |
102 | assert_tag :tag => 'div', :attributes => { :class => 'track_list', :id => "track_list_#{@block.id}" } | 98 | assert_tag :tag => 'div', :attributes => { :class => 'track_list', :id => "track_list_#{@block.id}" } |
103 | end | 99 | end |
104 | 100 | ||
105 | should 'render tracks in track list block' do | 101 | should 'render tracks in track list block' do |
106 | - box = fast_create(Box, :owner_id => @profile.id, :owner_type => @profile.class.name) | ||
107 | - @block = CommunityTrackPlugin::TrackListBlock.create!(:box => box) | ||
108 | - @profile.boxes << box | 102 | + @block = CommunityTrackPlugin::TrackListBlock.create!(:box => @profile.boxes.last) |
109 | get :view_page, @step.url | 103 | get :view_page, @step.url |
104 | + file = File.open('result.html', 'w+') | ||
105 | + file.write(@response.body) | ||
106 | + file.close | ||
110 | assert_tag :tag => 'div', :attributes => { :class => "item category_#{@track.category_name}" }, :descendant => { :tag => 'div', :attributes => { :class => 'steps' }, :descendant => { :tag => 'span', :attributes => { :class => "step #{@block.status_class(@step)}" } } } | 107 | assert_tag :tag => 'div', :attributes => { :class => "item category_#{@track.category_name}" }, :descendant => { :tag => 'div', :attributes => { :class => 'steps' }, :descendant => { :tag => 'span', :attributes => { :class => "step #{@block.status_class(@step)}" } } } |
111 | end | 108 | end |
112 | 109 | ||
113 | should 'render tracks in track card list block' do | 110 | should 'render tracks in track card list block' do |
114 | - box = fast_create(Box, :owner_id => @profile.id, :owner_type => @profile.class.name) | ||
115 | - @block = CommunityTrackPlugin::TrackCardListBlock.create!(:box => box) | ||
116 | - @profile.boxes << box | 111 | + @block = CommunityTrackPlugin::TrackCardListBlock.create!(:box => @profile.boxes.last) |
117 | get :view_page, @step.url | 112 | get :view_page, @step.url |
118 | assert_tag :tag => 'div', :attributes => { :class => "item_card category_#{@track.category_name}" }, :descendant => { :tag => 'div', :attributes => { :class => 'track_content' } } | 113 | assert_tag :tag => 'div', :attributes => { :class => "item_card category_#{@track.category_name}" }, :descendant => { :tag => 'div', :attributes => { :class => 'track_content' } } |
119 | assert_tag :tag => 'div', :attributes => { :class => "item_card category_#{@track.category_name}" }, :descendant => { :tag => 'div', :attributes => { :class => 'track_stats' } } | 114 | assert_tag :tag => 'div', :attributes => { :class => "item_card category_#{@track.category_name}" }, :descendant => { :tag => 'div', :attributes => { :class => 'track_stats' } } |
120 | end | 115 | end |
121 | 116 | ||
122 | should 'render link to display more tracks in track list block' do | 117 | should 'render link to display more tracks in track list block' do |
123 | - box = fast_create(Box, :owner_id => @profile.id, :owner_type => @profile.class.name) | ||
124 | - @block = CommunityTrackPlugin::TrackCardListBlock.create!(:box => box) | ||
125 | - @profile.boxes << box | ||
126 | - | 118 | + @block = CommunityTrackPlugin::TrackCardListBlock.create!(:box => @profile.boxes.last) |
127 | (@block.limit+1).times { |i| create_track("track#{i}", @profile) } | 119 | (@block.limit+1).times { |i| create_track("track#{i}", @profile) } |
128 | 120 | ||
129 | get :view_page, @step.url | 121 | get :view_page, @step.url |
@@ -131,9 +123,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -131,9 +123,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
131 | end | 123 | end |
132 | 124 | ||
133 | should 'render link to show all tracks in track list block' do | 125 | should 'render link to show all tracks in track list block' do |
134 | - box = fast_create(Box, :owner_id => @profile.id, :owner_type => @profile.class.name) | ||
135 | - @block = CommunityTrackPlugin::TrackCardListBlock.create!(:box => box) | ||
136 | - @profile.boxes << box | 126 | + @block = CommunityTrackPlugin::TrackCardListBlock.create!(:box => @profile.boxes.last) |
137 | @block.more_another_page = true | 127 | @block.more_another_page = true |
138 | @block.save! | 128 | @block.save! |
139 | 129 |
plugins/recent_content/test/unit/recent_content_block_test.rb
@@ -61,9 +61,9 @@ class RecentContentBlockTest < ActiveSupport::TestCase | @@ -61,9 +61,9 @@ class RecentContentBlockTest < ActiveSupport::TestCase | ||
61 | 61 | ||
62 | root = fast_create(Blog, :name => 'test-blog', :profile_id => profile.id) | 62 | root = fast_create(Blog, :name => 'test-blog', :profile_id => profile.id) |
63 | 63 | ||
64 | - a1 = fast_create(TextileArticle, :name => 'article #1', :profile_id => profile.id, :parent_id => root.id) | ||
65 | - a2 = fast_create(TextileArticle, :name => 'article #2', :profile_id => profile.id, :parent_id => root.id) | ||
66 | - a3 = fast_create(TextileArticle, :name => 'article #3', :profile_id => profile.id, :parent_id => root.id) | 64 | + a1 = fast_create(TextileArticle, :name => 'article #1', :profile_id => profile.id, :parent_id => root.id, :created_at => Time.now - 2.days) |
65 | + a2 = fast_create(TextileArticle, :name => 'article #2', :profile_id => profile.id, :parent_id => root.id, :created_at => Time.now - 1.days) | ||
66 | + a3 = fast_create(TextileArticle, :name => 'article #3', :profile_id => profile.id, :parent_id => root.id, :created_at => Time.now) | ||
67 | 67 | ||
68 | block = RecentContentBlock.new | 68 | block = RecentContentBlock.new |
69 | block.stubs(:holder).returns(profile) | 69 | block.stubs(:holder).returns(profile) |
po/eo/noosfero.po
@@ -109,7 +109,7 @@ msgstr "" | @@ -109,7 +109,7 @@ msgstr "" | ||
109 | #: app/views/blocks/profile_info_actions/_join_leave_community.rhtml:25 | 109 | #: app/views/blocks/profile_info_actions/_join_leave_community.rhtml:25 |
110 | #: app/views/profile/_private_profile.rhtml:10 | 110 | #: app/views/profile/_private_profile.rhtml:10 |
111 | msgid "Join" | 111 | msgid "Join" |
112 | -msgstr "" | 112 | +msgstr "Eniri" |
113 | 113 | ||
114 | #: app/helpers/application_helper.rb:556 | 114 | #: app/helpers/application_helper.rb:556 |
115 | #: app/views/blocks/profile_info_actions/_join_leave_community.rhtml:4 | 115 | #: app/views/blocks/profile_info_actions/_join_leave_community.rhtml:4 |
@@ -290,7 +290,7 @@ msgstr "" | @@ -290,7 +290,7 @@ msgstr "" | ||
290 | 290 | ||
291 | #: app/helpers/application_helper.rb:1088 | 291 | #: app/helpers/application_helper.rb:1088 |
292 | msgid "See all" | 292 | msgid "See all" |
293 | -msgstr "" | 293 | +msgstr "Vidi ĉiujn" |
294 | 294 | ||
295 | #: app/helpers/application_helper.rb:1091 | 295 | #: app/helpers/application_helper.rb:1091 |
296 | msgid "<span>Manage</span> %s" | 296 | msgid "<span>Manage</span> %s" |
@@ -688,11 +688,11 @@ msgstr "" | @@ -688,11 +688,11 @@ msgstr "" | ||
688 | 688 | ||
689 | #: app/helpers/forum_helper.rb:14 app/helpers/blog_helper.rb:23 | 689 | #: app/helpers/forum_helper.rb:14 app/helpers/blog_helper.rb:23 |
690 | msgid "« Newer posts" | 690 | msgid "« Newer posts" |
691 | -msgstr "" | 691 | +msgstr "« Pli freŝaj afiŝoj" |
692 | 692 | ||
693 | #: app/helpers/forum_helper.rb:15 app/helpers/blog_helper.rb:24 | 693 | #: app/helpers/forum_helper.rb:15 app/helpers/blog_helper.rb:24 |
694 | msgid "Older posts »" | 694 | msgid "Older posts »" |
695 | -msgstr "" | 695 | +msgstr "Malpli freŝaj afiŝoj »" |
696 | 696 | ||
697 | #: app/helpers/forum_helper.rb:18 | 697 | #: app/helpers/forum_helper.rb:18 |
698 | msgid "Discussion topic" | 698 | msgid "Discussion topic" |
@@ -774,63 +774,63 @@ msgstr "" | @@ -774,63 +774,63 @@ msgstr "" | ||
774 | #: app/helpers/dates_helper.rb:7 app/helpers/forms_helper.rb:172 | 774 | #: app/helpers/dates_helper.rb:7 app/helpers/forms_helper.rb:172 |
775 | #: plugins/display_content/lib/display_content_block.rb:4 | 775 | #: plugins/display_content/lib/display_content_block.rb:4 |
776 | msgid "January" | 776 | msgid "January" |
777 | -msgstr "" | 777 | +msgstr "Januaro" |
778 | 778 | ||
779 | #: app/helpers/dates_helper.rb:8 app/helpers/forms_helper.rb:172 | 779 | #: app/helpers/dates_helper.rb:8 app/helpers/forms_helper.rb:172 |
780 | #: plugins/display_content/lib/display_content_block.rb:5 | 780 | #: plugins/display_content/lib/display_content_block.rb:5 |
781 | msgid "February" | 781 | msgid "February" |
782 | -msgstr "" | 782 | +msgstr "Februaro" |
783 | 783 | ||
784 | #: app/helpers/dates_helper.rb:9 app/helpers/forms_helper.rb:172 | 784 | #: app/helpers/dates_helper.rb:9 app/helpers/forms_helper.rb:172 |
785 | #: plugins/display_content/lib/display_content_block.rb:6 | 785 | #: plugins/display_content/lib/display_content_block.rb:6 |
786 | msgid "March" | 786 | msgid "March" |
787 | -msgstr "" | 787 | +msgstr "Marto" |
788 | 788 | ||
789 | #: app/helpers/dates_helper.rb:10 app/helpers/forms_helper.rb:172 | 789 | #: app/helpers/dates_helper.rb:10 app/helpers/forms_helper.rb:172 |
790 | #: plugins/display_content/lib/display_content_block.rb:7 | 790 | #: plugins/display_content/lib/display_content_block.rb:7 |
791 | msgid "April" | 791 | msgid "April" |
792 | -msgstr "" | 792 | +msgstr "Aprilo" |
793 | 793 | ||
794 | #: app/helpers/dates_helper.rb:11 app/helpers/forms_helper.rb:172 | 794 | #: app/helpers/dates_helper.rb:11 app/helpers/forms_helper.rb:172 |
795 | #: app/helpers/forms_helper.rb:173 | 795 | #: app/helpers/forms_helper.rb:173 |
796 | #: plugins/display_content/lib/display_content_block.rb:8 | 796 | #: plugins/display_content/lib/display_content_block.rb:8 |
797 | msgid "May" | 797 | msgid "May" |
798 | -msgstr "" | 798 | +msgstr "Majo" |
799 | 799 | ||
800 | #: app/helpers/dates_helper.rb:12 app/helpers/forms_helper.rb:172 | 800 | #: app/helpers/dates_helper.rb:12 app/helpers/forms_helper.rb:172 |
801 | #: plugins/display_content/lib/display_content_block.rb:9 | 801 | #: plugins/display_content/lib/display_content_block.rb:9 |
802 | msgid "June" | 802 | msgid "June" |
803 | -msgstr "" | 803 | +msgstr "Junio" |
804 | 804 | ||
805 | #: app/helpers/dates_helper.rb:13 app/helpers/forms_helper.rb:172 | 805 | #: app/helpers/dates_helper.rb:13 app/helpers/forms_helper.rb:172 |
806 | #: plugins/display_content/lib/display_content_block.rb:10 | 806 | #: plugins/display_content/lib/display_content_block.rb:10 |
807 | msgid "July" | 807 | msgid "July" |
808 | -msgstr "" | 808 | +msgstr "Julio" |
809 | 809 | ||
810 | #: app/helpers/dates_helper.rb:14 app/helpers/forms_helper.rb:172 | 810 | #: app/helpers/dates_helper.rb:14 app/helpers/forms_helper.rb:172 |
811 | #: plugins/display_content/lib/display_content_block.rb:11 | 811 | #: plugins/display_content/lib/display_content_block.rb:11 |
812 | msgid "August" | 812 | msgid "August" |
813 | -msgstr "" | 813 | +msgstr "Aŭgusto" |
814 | 814 | ||
815 | #: app/helpers/dates_helper.rb:15 app/helpers/forms_helper.rb:172 | 815 | #: app/helpers/dates_helper.rb:15 app/helpers/forms_helper.rb:172 |
816 | #: plugins/display_content/lib/display_content_block.rb:12 | 816 | #: plugins/display_content/lib/display_content_block.rb:12 |
817 | msgid "September" | 817 | msgid "September" |
818 | -msgstr "" | 818 | +msgstr "Septembro" |
819 | 819 | ||
820 | #: app/helpers/dates_helper.rb:16 app/helpers/forms_helper.rb:172 | 820 | #: app/helpers/dates_helper.rb:16 app/helpers/forms_helper.rb:172 |
821 | #: plugins/display_content/lib/display_content_block.rb:13 | 821 | #: plugins/display_content/lib/display_content_block.rb:13 |
822 | msgid "October" | 822 | msgid "October" |
823 | -msgstr "" | 823 | +msgstr "Oktobro" |
824 | 824 | ||
825 | #: app/helpers/dates_helper.rb:17 app/helpers/forms_helper.rb:172 | 825 | #: app/helpers/dates_helper.rb:17 app/helpers/forms_helper.rb:172 |
826 | #: plugins/display_content/lib/display_content_block.rb:14 | 826 | #: plugins/display_content/lib/display_content_block.rb:14 |
827 | msgid "November" | 827 | msgid "November" |
828 | -msgstr "" | 828 | +msgstr "Novembro" |
829 | 829 | ||
830 | #: app/helpers/dates_helper.rb:18 app/helpers/forms_helper.rb:172 | 830 | #: app/helpers/dates_helper.rb:18 app/helpers/forms_helper.rb:172 |
831 | #: plugins/display_content/lib/display_content_block.rb:15 | 831 | #: plugins/display_content/lib/display_content_block.rb:15 |
832 | msgid "December" | 832 | msgid "December" |
833 | -msgstr "" | 833 | +msgstr "Decembro" |
834 | 834 | ||
835 | #: app/helpers/dates_helper.rb:28 | 835 | #: app/helpers/dates_helper.rb:28 |
836 | #: plugins/display_content/lib/display_content_block.rb:156 | 836 | #: plugins/display_content/lib/display_content_block.rb:156 |
@@ -845,7 +845,7 @@ msgstr "" | @@ -845,7 +845,7 @@ msgstr "" | ||
845 | #: app/helpers/dates_helper.rb:31 | 845 | #: app/helpers/dates_helper.rb:31 |
846 | #: plugins/display_content/lib/display_content_block.rb:159 | 846 | #: plugins/display_content/lib/display_content_block.rb:159 |
847 | msgid "%{month_name} %{day}, %{year}" | 847 | msgid "%{month_name} %{day}, %{year}" |
848 | -msgstr "" | 848 | +msgstr "La %{day}-a de %{month_name} %{year}" |
849 | 849 | ||
850 | #: app/helpers/dates_helper.rb:31 | 850 | #: app/helpers/dates_helper.rb:31 |
851 | #: plugins/display_content/lib/display_content_block.rb:159 | 851 | #: plugins/display_content/lib/display_content_block.rb:159 |
@@ -8278,7 +8278,7 @@ msgstr "" | @@ -8278,7 +8278,7 @@ msgstr "" | ||
8278 | 8278 | ||
8279 | #: app/views/account/index_anonymous.rhtml:10 | 8279 | #: app/views/account/index_anonymous.rhtml:10 |
8280 | msgid "Sign up." | 8280 | msgid "Sign up." |
8281 | -msgstr "" | 8281 | +msgstr "Aliĝi" |
8282 | 8282 | ||
8283 | #: app/views/account/index_anonymous.rhtml:11 | 8283 | #: app/views/account/index_anonymous.rhtml:11 |
8284 | msgid "" | 8284 | msgid "" |
po/es/noosfero.po
@@ -291,7 +291,6 @@ msgid "Next" | @@ -291,7 +291,6 @@ msgid "Next" | ||
291 | msgstr "Siguiente" | 291 | msgstr "Siguiente" |
292 | 292 | ||
293 | #: app/helpers/application_helper.rb:1088 | 293 | #: app/helpers/application_helper.rb:1088 |
294 | -#, fuzzy | ||
295 | msgid "See all" | 294 | msgid "See all" |
296 | msgstr "Ver todos" | 295 | msgstr "Ver todos" |
297 | 296 | ||
@@ -700,11 +699,11 @@ msgstr "Configurar foro" | @@ -700,11 +699,11 @@ msgstr "Configurar foro" | ||
700 | 699 | ||
701 | #: app/helpers/forum_helper.rb:14 app/helpers/blog_helper.rb:23 | 700 | #: app/helpers/forum_helper.rb:14 app/helpers/blog_helper.rb:23 |
702 | msgid "« Newer posts" | 701 | msgid "« Newer posts" |
703 | -msgstr "« Entradas recientes" | 702 | +msgstr "« Noticias más nuevas" |
704 | 703 | ||
705 | #: app/helpers/forum_helper.rb:15 app/helpers/blog_helper.rb:24 | 704 | #: app/helpers/forum_helper.rb:15 app/helpers/blog_helper.rb:24 |
706 | msgid "Older posts »" | 705 | msgid "Older posts »" |
707 | -msgstr "Entradas antiguas »" | 706 | +msgstr "Noticias más viejas »" |
708 | 707 | ||
709 | #: app/helpers/forum_helper.rb:18 | 708 | #: app/helpers/forum_helper.rb:18 |
710 | msgid "Discussion topic" | 709 | msgid "Discussion topic" |
@@ -852,15 +851,13 @@ msgstr "%{day} de %{month} %{year}" | @@ -852,15 +851,13 @@ msgstr "%{day} de %{month} %{year}" | ||
852 | 851 | ||
853 | #: app/helpers/dates_helper.rb:28 app/helpers/dates_helper.rb:40 | 852 | #: app/helpers/dates_helper.rb:28 app/helpers/dates_helper.rb:40 |
854 | #: plugins/display_content/lib/display_content_block.rb:156 | 853 | #: plugins/display_content/lib/display_content_block.rb:156 |
855 | -#, fuzzy | ||
856 | msgid "%{month}/%{day}" | 854 | msgid "%{month}/%{day}" |
857 | -msgstr "%{day} de %{month} %{year}" | 855 | +msgstr "%{day}/%{month}" |
858 | 856 | ||
859 | #: app/helpers/dates_helper.rb:31 | 857 | #: app/helpers/dates_helper.rb:31 |
860 | #: plugins/display_content/lib/display_content_block.rb:159 | 858 | #: plugins/display_content/lib/display_content_block.rb:159 |
861 | -#, fuzzy | ||
862 | msgid "%{month_name} %{day}, %{year}" | 859 | msgid "%{month_name} %{day}, %{year}" |
863 | -msgstr "%{day} de %{month} %{year}" | 860 | +msgstr "%{day} de %{month} de %{year}" |
864 | 861 | ||
865 | # LAs cadenas de este tipo NO se traducen | 862 | # LAs cadenas de este tipo NO se traducen |
866 | #: app/helpers/dates_helper.rb:31 | 863 | #: app/helpers/dates_helper.rb:31 |
@@ -888,21 +885,19 @@ msgstr "%{month} %{year}" | @@ -888,21 +885,19 @@ msgstr "%{month} %{year}" | ||
888 | 885 | ||
889 | #: app/helpers/dates_helper.rb:53 | 886 | #: app/helpers/dates_helper.rb:53 |
890 | msgid "%{day} %{month} %{year}, %{hour}:%{minutes}" | 887 | msgid "%{day} %{month} %{year}, %{hour}:%{minutes}" |
891 | -msgstr "%{day} %{month} %{year}, %{hour}:%{minutes}" | 888 | +msgstr "%{day} de %{month} de %{year}, %{hour}:%{minutes}" |
892 | 889 | ||
893 | #: app/helpers/dates_helper.rb:65 | 890 | #: app/helpers/dates_helper.rb:65 |
894 | -#, fuzzy | ||
895 | msgid "from %{month} %{day1} to %{day2}, %{year}" | 891 | msgid "from %{month} %{day1} to %{day2}, %{year}" |
896 | -msgstr "%{day} de %{month} %{year}" | 892 | +msgstr "de %{day1} para %{day2} de %{month} de %{year}" |
897 | 893 | ||
898 | #: app/helpers/dates_helper.rb:72 | 894 | #: app/helpers/dates_helper.rb:72 |
899 | -#, fuzzy | ||
900 | msgid "from %{date1} to %{date2}, %{year}" | 895 | msgid "from %{date1} to %{date2}, %{year}" |
901 | -msgstr "Por %{author} el %{date}" | 896 | +msgstr "de %{date1} para %{date2} de %{year}" |
902 | 897 | ||
903 | #: app/helpers/dates_helper.rb:79 | 898 | #: app/helpers/dates_helper.rb:79 |
904 | msgid "from %{date1} to %{date2}" | 899 | msgid "from %{date1} to %{date2}" |
905 | -msgstr "Por %{author} el %{date}" | 900 | +msgstr "de %{date1} para %{date2}" |
906 | 901 | ||
907 | #: app/helpers/dates_helper.rb:89 app/helpers/forms_helper.rb:163 | 902 | #: app/helpers/dates_helper.rb:89 app/helpers/forms_helper.rb:163 |
908 | msgid "Sun" | 903 | msgid "Sun" |
po/it/noosfero.po
@@ -111,7 +111,7 @@ msgstr "" | @@ -111,7 +111,7 @@ msgstr "" | ||
111 | #: app/views/blocks/profile_info_actions/_join_leave_community.rhtml:25 | 111 | #: app/views/blocks/profile_info_actions/_join_leave_community.rhtml:25 |
112 | #: app/views/profile/_private_profile.rhtml:10 | 112 | #: app/views/profile/_private_profile.rhtml:10 |
113 | msgid "Join" | 113 | msgid "Join" |
114 | -msgstr "" | 114 | +msgstr "Accedere" |
115 | 115 | ||
116 | #: app/helpers/application_helper.rb:556 | 116 | #: app/helpers/application_helper.rb:556 |
117 | #: app/views/blocks/profile_info_actions/_join_leave_community.rhtml:4 | 117 | #: app/views/blocks/profile_info_actions/_join_leave_community.rhtml:4 |
@@ -763,63 +763,63 @@ msgstr "" | @@ -763,63 +763,63 @@ msgstr "" | ||
763 | #: app/helpers/dates_helper.rb:7 app/helpers/forms_helper.rb:172 | 763 | #: app/helpers/dates_helper.rb:7 app/helpers/forms_helper.rb:172 |
764 | #: plugins/display_content/lib/display_content_block.rb:4 | 764 | #: plugins/display_content/lib/display_content_block.rb:4 |
765 | msgid "January" | 765 | msgid "January" |
766 | -msgstr "" | 766 | +msgstr "gennaio" |
767 | 767 | ||
768 | #: app/helpers/dates_helper.rb:8 app/helpers/forms_helper.rb:172 | 768 | #: app/helpers/dates_helper.rb:8 app/helpers/forms_helper.rb:172 |
769 | #: plugins/display_content/lib/display_content_block.rb:5 | 769 | #: plugins/display_content/lib/display_content_block.rb:5 |
770 | msgid "February" | 770 | msgid "February" |
771 | -msgstr "" | 771 | +msgstr "febbraio" |
772 | 772 | ||
773 | #: app/helpers/dates_helper.rb:9 app/helpers/forms_helper.rb:172 | 773 | #: app/helpers/dates_helper.rb:9 app/helpers/forms_helper.rb:172 |
774 | #: plugins/display_content/lib/display_content_block.rb:6 | 774 | #: plugins/display_content/lib/display_content_block.rb:6 |
775 | msgid "March" | 775 | msgid "March" |
776 | -msgstr "" | 776 | +msgstr "marzo" |
777 | 777 | ||
778 | #: app/helpers/dates_helper.rb:10 app/helpers/forms_helper.rb:172 | 778 | #: app/helpers/dates_helper.rb:10 app/helpers/forms_helper.rb:172 |
779 | #: plugins/display_content/lib/display_content_block.rb:7 | 779 | #: plugins/display_content/lib/display_content_block.rb:7 |
780 | msgid "April" | 780 | msgid "April" |
781 | -msgstr "" | 781 | +msgstr "aprile" |
782 | 782 | ||
783 | #: app/helpers/dates_helper.rb:11 app/helpers/forms_helper.rb:172 | 783 | #: app/helpers/dates_helper.rb:11 app/helpers/forms_helper.rb:172 |
784 | #: app/helpers/forms_helper.rb:173 | 784 | #: app/helpers/forms_helper.rb:173 |
785 | #: plugins/display_content/lib/display_content_block.rb:8 | 785 | #: plugins/display_content/lib/display_content_block.rb:8 |
786 | msgid "May" | 786 | msgid "May" |
787 | -msgstr "" | 787 | +msgstr "maggio" |
788 | 788 | ||
789 | #: app/helpers/dates_helper.rb:12 app/helpers/forms_helper.rb:172 | 789 | #: app/helpers/dates_helper.rb:12 app/helpers/forms_helper.rb:172 |
790 | #: plugins/display_content/lib/display_content_block.rb:9 | 790 | #: plugins/display_content/lib/display_content_block.rb:9 |
791 | msgid "June" | 791 | msgid "June" |
792 | -msgstr "" | 792 | +msgstr "giugno" |
793 | 793 | ||
794 | #: app/helpers/dates_helper.rb:13 app/helpers/forms_helper.rb:172 | 794 | #: app/helpers/dates_helper.rb:13 app/helpers/forms_helper.rb:172 |
795 | #: plugins/display_content/lib/display_content_block.rb:10 | 795 | #: plugins/display_content/lib/display_content_block.rb:10 |
796 | msgid "July" | 796 | msgid "July" |
797 | -msgstr "" | 797 | +msgstr "luglio" |
798 | 798 | ||
799 | #: app/helpers/dates_helper.rb:14 app/helpers/forms_helper.rb:172 | 799 | #: app/helpers/dates_helper.rb:14 app/helpers/forms_helper.rb:172 |
800 | #: plugins/display_content/lib/display_content_block.rb:11 | 800 | #: plugins/display_content/lib/display_content_block.rb:11 |
801 | msgid "August" | 801 | msgid "August" |
802 | -msgstr "" | 802 | +msgstr "agosto" |
803 | 803 | ||
804 | #: app/helpers/dates_helper.rb:15 app/helpers/forms_helper.rb:172 | 804 | #: app/helpers/dates_helper.rb:15 app/helpers/forms_helper.rb:172 |
805 | #: plugins/display_content/lib/display_content_block.rb:12 | 805 | #: plugins/display_content/lib/display_content_block.rb:12 |
806 | msgid "September" | 806 | msgid "September" |
807 | -msgstr "" | 807 | +msgstr "settembre" |
808 | 808 | ||
809 | #: app/helpers/dates_helper.rb:16 app/helpers/forms_helper.rb:172 | 809 | #: app/helpers/dates_helper.rb:16 app/helpers/forms_helper.rb:172 |
810 | #: plugins/display_content/lib/display_content_block.rb:13 | 810 | #: plugins/display_content/lib/display_content_block.rb:13 |
811 | msgid "October" | 811 | msgid "October" |
812 | -msgstr "" | 812 | +msgstr "ottobre" |
813 | 813 | ||
814 | #: app/helpers/dates_helper.rb:17 app/helpers/forms_helper.rb:172 | 814 | #: app/helpers/dates_helper.rb:17 app/helpers/forms_helper.rb:172 |
815 | #: plugins/display_content/lib/display_content_block.rb:14 | 815 | #: plugins/display_content/lib/display_content_block.rb:14 |
816 | msgid "November" | 816 | msgid "November" |
817 | -msgstr "" | 817 | +msgstr "novembre" |
818 | 818 | ||
819 | #: app/helpers/dates_helper.rb:18 app/helpers/forms_helper.rb:172 | 819 | #: app/helpers/dates_helper.rb:18 app/helpers/forms_helper.rb:172 |
820 | #: plugins/display_content/lib/display_content_block.rb:15 | 820 | #: plugins/display_content/lib/display_content_block.rb:15 |
821 | msgid "December" | 821 | msgid "December" |
822 | -msgstr "" | 822 | +msgstr "dicembre" |
823 | 823 | ||
824 | #: app/helpers/dates_helper.rb:28 | 824 | #: app/helpers/dates_helper.rb:28 |
825 | #: plugins/display_content/lib/display_content_block.rb:156 | 825 | #: plugins/display_content/lib/display_content_block.rb:156 |
@@ -834,7 +834,7 @@ msgstr "" | @@ -834,7 +834,7 @@ msgstr "" | ||
834 | #: app/helpers/dates_helper.rb:31 | 834 | #: app/helpers/dates_helper.rb:31 |
835 | #: plugins/display_content/lib/display_content_block.rb:159 | 835 | #: plugins/display_content/lib/display_content_block.rb:159 |
836 | msgid "%{month_name} %{day}, %{year}" | 836 | msgid "%{month_name} %{day}, %{year}" |
837 | -msgstr "" | 837 | +msgstr "%{day} %{month_name} %{year}" |
838 | 838 | ||
839 | #: app/helpers/dates_helper.rb:31 | 839 | #: app/helpers/dates_helper.rb:31 |
840 | #: plugins/display_content/lib/display_content_block.rb:159 | 840 | #: plugins/display_content/lib/display_content_block.rb:159 |
@@ -8246,7 +8246,7 @@ msgstr "" | @@ -8246,7 +8246,7 @@ msgstr "" | ||
8246 | 8246 | ||
8247 | #: app/views/account/index_anonymous.rhtml:10 | 8247 | #: app/views/account/index_anonymous.rhtml:10 |
8248 | msgid "Sign up." | 8248 | msgid "Sign up." |
8249 | -msgstr "" | 8249 | +msgstr "Registro" |
8250 | 8250 | ||
8251 | #: app/views/account/index_anonymous.rhtml:11 | 8251 | #: app/views/account/index_anonymous.rhtml:11 |
8252 | msgid "" | 8252 | msgid "" |
public/stylesheets/application.css
@@ -3561,9 +3561,10 @@ div#article-parent { | @@ -3561,9 +3561,10 @@ div#article-parent { | ||
3561 | } | 3561 | } |
3562 | #agenda .agenda-calendar { | 3562 | #agenda .agenda-calendar { |
3563 | width: 50%; | 3563 | width: 50%; |
3564 | + display: inline-block; | ||
3564 | } | 3565 | } |
3565 | #agenda td, #agenda th { | 3566 | #agenda td, #agenda th { |
3566 | - padding: 15px; | 3567 | + padding: 10px; |
3567 | padding-right: 0px; | 3568 | padding-right: 0px; |
3568 | } | 3569 | } |
3569 | #agenda .agenda-calendar .previous-month td, #agenda .agenda-calendar .previous-month th, #agenda .agenda-calendar .next-month td, #agenda .agenda-calendar .next-month th { | 3570 | #agenda .agenda-calendar .previous-month td, #agenda .agenda-calendar .previous-month th, #agenda .agenda-calendar .next-month td, #agenda .agenda-calendar .next-month th { |
@@ -3621,26 +3622,25 @@ div#article-parent { | @@ -3621,26 +3622,25 @@ div#article-parent { | ||
3621 | vertical-align: middle; | 3622 | vertical-align: middle; |
3622 | } | 3623 | } |
3623 | #agenda .agenda-calendar .current-month caption { | 3624 | #agenda .agenda-calendar .current-month caption { |
3624 | - margin-bottom: 10px; | 3625 | + margin: 10px 0px; |
3625 | } | 3626 | } |
3626 | #agenda #events-of-the-day { | 3627 | #agenda #events-of-the-day { |
3627 | - position: absolute; | ||
3628 | - left: 50%; | ||
3629 | width: 45%; | 3628 | width: 45%; |
3630 | - top: 0px; | ||
3631 | height: 100%; | 3629 | height: 100%; |
3632 | padding-left: 20px; | 3630 | padding-left: 20px; |
3631 | + display: inline-block; | ||
3632 | + vertical-align: top; | ||
3633 | } | 3633 | } |
3634 | #agenda #events-of-the-day #agenda-items { | 3634 | #agenda #events-of-the-day #agenda-items { |
3635 | display: block; | 3635 | display: block; |
3636 | overflow: auto; | 3636 | overflow: auto; |
3637 | overflow-x: hidden; | 3637 | overflow-x: hidden; |
3638 | - height: 80%; | 3638 | + height: 250px; |
3639 | background: white; | 3639 | background: white; |
3640 | border: none; | 3640 | border: none; |
3641 | } | 3641 | } |
3642 | #agenda-toolbar { | 3642 | #agenda-toolbar { |
3643 | - float: right; | 3643 | + text-align: right; |
3644 | font-variant: normal; | 3644 | font-variant: normal; |
3645 | font-weight: normal; | 3645 | font-weight: normal; |
3646 | } | 3646 | } |
@@ -3663,6 +3663,9 @@ h1#agenda-title { | @@ -3663,6 +3663,9 @@ h1#agenda-title { | ||
3663 | display: block; | 3663 | display: block; |
3664 | margin-top: 10px; | 3664 | margin-top: 10px; |
3665 | } | 3665 | } |
3666 | +#agenda .pagination { | ||
3667 | + margin-top: 15px; | ||
3668 | +} | ||
3666 | /* ==> public/stylesheets/controller_favorite_enterprises.css <== */ | 3669 | /* ==> public/stylesheets/controller_favorite_enterprises.css <== */ |
3667 | 3670 | ||
3668 | /* ==> @import url(manage_contacts_list.css); <== */ | 3671 | /* ==> @import url(manage_contacts_list.css); <== */ |
test/functional/content_viewer_controller_test.rb
@@ -72,9 +72,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -72,9 +72,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
72 | get :view_page, :profile => 'someone', :page => [ '500.html' ] | 72 | get :view_page, :profile => 'someone', :page => [ '500.html' ] |
73 | 73 | ||
74 | assert_response :success | 74 | assert_response :success |
75 | - assert_match /^text\/html/, @response.headers['Content-Type'] | ||
76 | - assert @response.headers['Content-Disposition'].present? | ||
77 | - assert_match /attachment/, @response.headers['Content-Disposition'] | 75 | + assert_match /#{html.public_filename}/, @response.body |
78 | end | 76 | end |
79 | 77 | ||
80 | should 'produce a download-link when article is not text/html' do | 78 | should 'produce a download-link when article is not text/html' do |
@@ -577,14 +575,6 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -577,14 +575,6 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
577 | assert_template 'view_page' | 575 | assert_template 'view_page' |
578 | end | 576 | end |
579 | 577 | ||
580 | - should 'download data for image when not view' do | ||
581 | - file = UploadedFile.create!(:uploaded_data => fixture_file_upload('/files/rails.png', 'image/png'), :profile => profile) | ||
582 | - get :view_page, :profile => profile.identifier, :page => file.explode_path | ||
583 | - | ||
584 | - assert_response :success | ||
585 | - assert_template nil | ||
586 | - end | ||
587 | - | ||
588 | should "display 'Upload files' when create children of image gallery" do | 578 | should "display 'Upload files' when create children of image gallery" do |
589 | login_as(profile.identifier) | 579 | login_as(profile.identifier) |
590 | f = Gallery.create!(:name => 'gallery', :profile => profile) | 580 | f = Gallery.create!(:name => 'gallery', :profile => profile) |
@@ -1355,8 +1345,23 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -1355,8 +1345,23 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
1355 | 1345 | ||
1356 | should 'display link to download of non-recognized file types on its page' do | 1346 | should 'display link to download of non-recognized file types on its page' do |
1357 | file = UploadedFile.create!(:uploaded_data => fixture_file_upload('/files/test.txt', 'bin/unknown'), :profile => profile) | 1347 | file = UploadedFile.create!(:uploaded_data => fixture_file_upload('/files/test.txt', 'bin/unknown'), :profile => profile) |
1358 | - get :view_page, file.url.merge(:view=>:true) | ||
1359 | - assert_match /this is a sample text file/, @response.body | 1348 | + get :view_page, file.url |
1349 | + assert_match /#{file.public_filename}/, @response.body | ||
1350 | + end | ||
1351 | + | ||
1352 | + should 'not count hit from bots' do | ||
1353 | + article = fast_create(Article, :profile_id => profile.id) | ||
1354 | + assert_no_difference article, :hits do | ||
1355 | + @request.env['HTTP_USER_AGENT'] = 'bot' | ||
1356 | + get 'view_page', :profile => profile.identifier, :page => article.path.split('/') | ||
1357 | + @request.env['HTTP_USER_AGENT'] = 'spider' | ||
1358 | + get 'view_page', :profile => profile.identifier, :page => article.path.split('/') | ||
1359 | + @request.env['HTTP_USER_AGENT'] = 'crawler' | ||
1360 | + get 'view_page', :profile => profile.identifier, :page => article.path.split('/') | ||
1361 | + @request.env['HTTP_USER_AGENT'] = '(http://some-crawler.com)' | ||
1362 | + get 'view_page', :profile => profile.identifier, :page => article.path.split('/') | ||
1363 | + article.reload | ||
1364 | + end | ||
1360 | end | 1365 | end |
1361 | 1366 | ||
1362 | should 'add meta tags with article info' do | 1367 | should 'add meta tags with article info' do |
test/functional/events_controller_test.rb
@@ -38,4 +38,12 @@ class EventsControllerTest < ActionController::TestCase | @@ -38,4 +38,12 @@ class EventsControllerTest < ActionController::TestCase | ||
38 | assert_tag :tag =>'a', :attributes => {:href => "/profile/#{profile.identifier}/events/#{next_month.year}/#{next_month.month}"}, :content => next_month_name | 38 | assert_tag :tag =>'a', :attributes => {:href => "/profile/#{profile.identifier}/events/#{next_month.year}/#{next_month.month}"}, :content => next_month_name |
39 | end | 39 | end |
40 | 40 | ||
41 | + should 'see the events paginated' do | ||
42 | + 30.times do |i| | ||
43 | + profile.events << Event.new(:name => "Lesson #{i}", :start_date => Date.today) | ||
44 | + end | ||
45 | + get :events, :profile => profile.identifier | ||
46 | + assert_equal 20, assigns(:events).count | ||
47 | + end | ||
48 | + | ||
41 | end | 49 | end |
test/functional/search_controller_test.rb
@@ -370,6 +370,15 @@ class SearchControllerTest < ActionController::TestCase | @@ -370,6 +370,15 @@ class SearchControllerTest < ActionController::TestCase | ||
370 | assert_equal [ 'upcoming event 1' ], assigns(:searches)[:events][:results].map(&:name) | 370 | assert_equal [ 'upcoming event 1' ], assigns(:searches)[:events][:results].map(&:name) |
371 | end | 371 | end |
372 | 372 | ||
373 | + should 'see the events paginated' do | ||
374 | + person = create_user('testuser').person | ||
375 | + 30.times do |i| | ||
376 | + create_event(person, :name => "Event #{i}", :start_date => Date.today) | ||
377 | + end | ||
378 | + get :events | ||
379 | + assert_equal 20, assigns(:events).count | ||
380 | + end | ||
381 | + | ||
373 | %w[ people enterprises articles events communities products ].each do |asset| | 382 | %w[ people enterprises articles events communities products ].each do |asset| |
374 | should "render asset-specific template when searching for #{asset}" do | 383 | should "render asset-specific template when searching for #{asset}" do |
375 | get "#{asset}" | 384 | get "#{asset}" |
test/unit/block_test.rb
@@ -222,4 +222,11 @@ class BlockTest < ActiveSupport::TestCase | @@ -222,4 +222,11 @@ class BlockTest < ActiveSupport::TestCase | ||
222 | assert block.visible?(2) | 222 | assert block.visible?(2) |
223 | assert !block.visible?(3) | 223 | assert !block.visible?(3) |
224 | end | 224 | end |
225 | + | ||
226 | + should 'accept user as parameter on cache_key without change its value' do | ||
227 | + person = fast_create(Person) | ||
228 | + block = Block.new | ||
229 | + assert_equal block.cache_key('en'), block.cache_key('en', person) | ||
230 | + end | ||
231 | + | ||
225 | end | 232 | end |
test/unit/members_block_test.rb
@@ -35,4 +35,28 @@ class MembersBlockTest < ActiveSupport::TestCase | @@ -35,4 +35,28 @@ class MembersBlockTest < ActiveSupport::TestCase | ||
35 | assert_same list, block.profiles | 35 | assert_same list, block.profiles |
36 | end | 36 | end |
37 | 37 | ||
38 | + should 'use logged-in to compose cache key' do | ||
39 | + person = fast_create(Person) | ||
40 | + community = fast_create(Community) | ||
41 | + block = MembersBlock.create | ||
42 | + block.expects(:owner).returns(community) | ||
43 | + | ||
44 | + assert_match(/-logged-in/,block.cache_key('en', person)) | ||
45 | + end | ||
46 | + | ||
47 | + should 'use logged-in and member to compose cache key for members' do | ||
48 | + person = fast_create(Person) | ||
49 | + community = fast_create(Community) | ||
50 | + community.add_member person | ||
51 | + block = MembersBlock.create | ||
52 | + block.expects(:owner).returns(community) | ||
53 | + | ||
54 | + assert_match(/-logged-in-member/,block.cache_key('en', person)) | ||
55 | + end | ||
56 | + | ||
57 | + should 'not change block cache key if user is nil' do | ||
58 | + block = MembersBlock.new | ||
59 | + assert_equal block.cache_key('en'), block.cache_key('en', nil) | ||
60 | + end | ||
61 | + | ||
38 | end | 62 | end |
test/unit/tags_helper_test.rb
@@ -20,12 +20,14 @@ class TagsHelperTest < ActiveSupport::TestCase | @@ -20,12 +20,14 @@ class TagsHelperTest < ActiveSupport::TestCase | ||
20 | 20 | ||
21 | should 'order tags alphabetically with special characters' do | 21 | should 'order tags alphabetically with special characters' do |
22 | result = tag_cloud( | 22 | result = tag_cloud( |
23 | - { 'aula'=>9, 'área'=>2, 'area'=>2, 'avião'=>2, 'armário'=>2, | ||
24 | - 'A'=>1, 'Á'=>1, 'AB'=>1, 'ÁA'=>1 }, | 23 | + { 'area'=>9, 'área'=>2, 'base'=>2, 'báse' => 3, |
24 | + 'A'=>1, 'Á'=>1, 'zebra'=>1, 'zebrá'=>1 }, | ||
25 | :id, | 25 | :id, |
26 | { :host=>'noosfero.org', :controller=>'test', :action=>'tag' } | 26 | { :host=>'noosfero.org', :controller=>'test', :action=>'tag' } |
27 | ) | 27 | ) |
28 | - assert_equal %w(A Á ÁA AB area área armário aula avião).join("\n"), result | 28 | + result = result.split("\n") |
29 | + assert_order ['Á', 'área', 'báse', 'zebrá'], result | ||
30 | + assert_order ['A', 'area', 'base', 'zebra'], result | ||
29 | end | 31 | end |
30 | 32 | ||
31 | end | 33 | end |