Commit aec7550de060f01c65f51593101138352f7c01f0
Committed by
Caio
1 parent
f9116a97
Exists in
master
and in
29 other branches
[Mezuro] add new method in helper and made tests
Showing
3 changed files
with
9 additions
and
2 deletions
Show diff stats
plugins/mezuro/lib/mezuro_plugin/helpers/content_viewer_helper.rb
... | ... | @@ -2,4 +2,8 @@ class MezuroPlugin::Helpers::ContentViewerHelper |
2 | 2 | def self.format_grade(grade) |
3 | 3 | sprintf("%.2f", grade.to_f) |
4 | 4 | end |
5 | + | |
6 | + def self.create_periodicity_options | |
7 | + [["Not Periodically", 0], ["1 day", 1], ["2 days", 2], ["Weekly", 7], ["Biweeky", 15], ["Monthly", 30]] | |
8 | + end | |
5 | 9 | end | ... | ... |
plugins/mezuro/test/unit/mezuro_plugin/helpers/content_viewer_helper_test.rb
... | ... | @@ -7,4 +7,8 @@ class ContentViewerHelperTest < ActiveSupport::TestCase |
7 | 7 | assert_equal '4.10', MezuroPlugin::Helpers::ContentViewerHelper.format_grade('4.1') |
8 | 8 | assert_equal '4.00', MezuroPlugin::Helpers::ContentViewerHelper.format_grade('4') |
9 | 9 | end |
10 | + | |
11 | + should 'create the periodicity options array' do | |
12 | + assert_equal [["Not Periodically", 0], ["1 day", 1], ["2 days", 2], ["Weekly", 7], ["Biweeky", 15], ["Monthly", 30]], MezuroPlugin::Helpers::ContentViewerHelper.create_periodicity_options | |
13 | + end | |
10 | 14 | end | ... | ... |
plugins/mezuro/views/cms/mezuro_plugin/_project_content.html.erb
... | ... | @@ -33,6 +33,5 @@ |
33 | 33 | <%= required labelled_form_field _('Configuration'), |
34 | 34 | f.select(:configuration_name, @configuration_names.sort, {:selected => @selected}) %><br/> |
35 | 35 | |
36 | -<% options = [["Not Periodically", 0], ["1 day", 1], ["2 days", 2], ["Weekly", 7], ["Biweekly", 15], ["Monthly", 30]] %> | |
37 | 36 | <%= required labelled_form_field _('Periodic Avaliation'), |
38 | - f.select(:periodicity_in_days, options, {:selected => 0}) %><br/> | |
37 | + f.select(:periodicity_in_days, MezuroPlugin::Helpers::ContentViewerHelper.create_periodicity_options ,{:selected => 0}) %><br/> | ... | ... |