<% ['non_link_name', 'template', 'organisation', 'owner'].each do |column| %>
- <%= project_list_column_body(column, plan) %>
+ <%= plant_list_column_body(column, plan) %>
<% end %>
|
diff --git a/config/locales/de.yml b/config/locales/de.yml
index d010da5..07037bf 100644
--- a/config/locales/de.yml
+++ b/config/locales/de.yml
@@ -625,6 +625,7 @@
settings:
title: "Einstellungen"
+ unknown: "Unbekannt"
projects:
title: "Einstellungen - Meine Pläne"
desc: "Die untere Tabelle listet die verfügbaren Spalten auf, welche in der Liste 'Meine Pläne' gezeigt werden können.
diff --git a/config/locales/en-UK.yml b/config/locales/en-UK.yml
index 45caa75..a99a922 100644
--- a/config/locales/en-UK.yml
+++ b/config/locales/en-UK.yml
@@ -695,6 +695,7 @@
settings:
title: "Settings"
+ unknown: "Unknown"
projects:
title: "Settings - My plans"
desc: "The table below lists the available columns that can be shown on the 'My plans' list. Choose which you would like to appear."
diff --git a/config/locales/en-US.yml b/config/locales/en-US.yml
index 2d9b60b..bf5d52a 100644
--- a/config/locales/en-US.yml
+++ b/config/locales/en-US.yml
@@ -675,6 +675,7 @@
settings:
title: "Settings"
+ unknown: "Unknown"
projects:
title: "Settings - My plans"
desc: "The table below lists the available columns that can be shown on the 'My plans' list. Choose which you would like to appear."
diff --git a/config/locales/es.yml b/config/locales/es.yml
index a7e52e5..cf520e7 100644
--- a/config/locales/es.yml
+++ b/config/locales/es.yml
@@ -551,6 +551,7 @@
settings:
title: "Preferencias"
+ unknown: "Desconocido"
projects:
title: "Preferencias - Mis planes"
desc: "La siguiente tabla muestra las columnas que pueden mostrarse en la lista 'Mis planes'. Elija cuales quiere que se muestren."
diff --git a/config/locales/fr.yml b/config/locales/fr.yml
index d045462..e8ec81e 100644
--- a/config/locales/fr.yml
+++ b/config/locales/fr.yml
@@ -565,6 +565,7 @@
settings:
title: "Réglages"
+ unknown: "Inconnu"
projects:
title: "Réglages - Mes plans"
desc: "Le tableau suivant donne la liste des colonnes que lon peut faire apparaître dans la liste Mes Plans. Choisissez celles que vous voulez voir."
diff --git a/test/functional/answers_controller_test.rb b/test/functional/answers_controller_test.rb
index a671b57..fdd684f 100644
--- a/test/functional/answers_controller_test.rb
+++ b/test/functional/answers_controller_test.rb
@@ -68,7 +68,7 @@
follow_redirects
assert_response :success
- assert_select '.main_page_content h1', Plan.model_name.human.pluralize.titleize
+ assert_select '.main_page_content h1', I18n.t("helpers.project.projects_title")
end
end
\ No newline at end of file
diff --git a/test/helpers/application_helper_test.rb b/test/helpers/application_helper_test.rb
index 0eb97aa..11aec2a 100644
--- a/test/helpers/application_helper_test.rb
+++ b/test/helpers/application_helper_test.rb
@@ -23,8 +23,8 @@
assert_equal nil, resource.id, "Expected resource() to return a User with an Id"
# If @resource is set then we should receive that object
- @resource = Organisation.first
- assert resource.is_a?(Organisation), "Expected resource() to return @resource"
+ @resource = Org.first
+ assert resource.is_a?(Org), "Expected resource() to return @resource"
assert_equal @resource.id, resource.id, "Expected resource() to return the first Organisation"
end
diff --git a/test/helpers/projects_helper_test.rb b/test/helpers/projects_helper_test.rb
new file mode 100644
index 0000000..d3a55be
--- /dev/null
+++ b/test/helpers/projects_helper_test.rb
@@ -0,0 +1,68 @@
+require 'test_helper'
+
+class ProjectsHelperTest < ActionView::TestCase
+
+ include Devise::Test::IntegrationHelpers
+
+ def setup
+ scaffold_plan
+
+ @user = User.last
+ sign_in @user
+ end
+
+ # -----------------------------------------------------------------------
+ test "plan_list_column_heading should return the localized text for the column heading" do
+ cols = I18n.t("helpers.project.columns")
+
+ cols.each do |k,v|
+ assert plan_list_column_heading(k.to_s).include?(">#{I18n.t("helpers.project.columns.#{k}")}<"), "expected #{k} to return a column heading labeled #{v}"
+ end
+ end
+
+ # -----------------------------------------------------------------------
+ test "plan_list_column_body should return the localized text for the column heading" do
+ cols = I18n.t("helpers.project.columns")
+
+ cols.each do |k,v|
+ val = plan_list_column_body(k.to_s, @plan)
+
+ if Plan.respond_to?(k)
+ assert plan_list_column_body(k.to_s, @plan).include?(">#{@plan.send(k)}<"), "expected #{k} to return a column containing the Plan's value for that column. Instead got: #{val}"
+
+ else
+ if k == :owner
+ assert val.include?(">#{@plan.users.first.name}<") || val.include?(t("helpers.me")), "expected :owner to return a column containing the Plan's value for that column or #{I18n.t("helpers.me")}. Instead got: #{val}"
+
+ elsif k == :shared?
+ assert val.include?(">Yes<") || val.include?(">No<"), "expected :shared? to return a column containing Yes/No. Instead got: #{val}"
+ else
+
+ end
+ end
+
+ end
+ end
+
+ # TODO: 'custom_template' is part of the case logic in this method but it is unreachable because both
+ # the plan and template settings objects use "Settings::Template". We should remove it from logic
+ # -----------------------------------------------------------------------
+ test "plan_settings_indicator should return the correct export formatting settings" do
+ assert plan_settings_indicator(@plan).include?(">#{I18n.t("helpers.settings.plans.default_formatting")}<"), "expected the default plan to use default export settings"
+
+ @plan.settings(:export).formatting = {margin: {top: 5, bottom: 5, left: 5, right: 5},
+ font_face: Settings::Template::VALID_FONT_FACES.last,
+ font_size: 12}
+ @plan.save!
+
+ assert plan_settings_indicator(@plan).include?(">#{I18n.t("helpers.settings.plans.template_formatting")}<"), "expected the default plan to use default export settings"
+
+ @plan.template.settings(:export).formatting = {margin: {top: 10, bottom: 10, left: 10, right: 10},
+ font_face: Settings::Template::VALID_FONT_FACES.first,
+ font_size: 11}
+ @plan.save!
+
+ assert plan_settings_indicator(@plan).include?(">#{I18n.t("helpers.settings.plans.template_formatting")}<"), "expected the default plan to use default export settings"
+ end
+
+end
diff --git a/test/test_helper.rb b/test/test_helper.rb
index 0765120..5dd32e6 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -25,6 +25,12 @@
require_relative '../db/seeds.rb'
# Add more helper methods to be used by all tests here...
+
+ # Return the user instance variable
+ # ----------------------------------------------------------------------
+ def current_user
+ return @user
+ end
# Convert Ruby Class Names into attribute names (e.g. MyClass --> my_class)
# ----------------------------------------------------------------------
|