fix failing tests

This commit is contained in:
Reinier Balt 2010-11-09 10:47:09 +01:00
parent fd3f69d927
commit 6b36d6eb8f
8 changed files with 17 additions and 11 deletions

View file

@ -50,7 +50,8 @@ class ApplicationController < ActionController::Base
end
def set_locale
locale = params[:locale] || request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first
locale = params[:locale]
locale = locale || request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first if request.env['HTTP_ACCEPT_LANGUAGE']
I18n.locale = I18n::available_locales.include?(locale) ? locale : I18n.default_locale
logger.debug("Selected '#{I18n.locale}' as locale")
end

View file

@ -71,8 +71,8 @@ class Project < ActiveRecord::Base
def self.feed_options(user)
{
:title => t('models.project.feed_title'),
:description => t('models.project.feed_description', :username => user.display_name)
:title => I18n.t('models.project.feed_title'),
:description => I18n.t('models.project.feed_description', :username => user.display_name)
}
end

View file

@ -135,7 +135,7 @@ class Todo < ActiveRecord::Base
def validate
if !show_from.blank? && show_from < user.date
errors.add("show_from", t('models.todo.error_date_must_be_future'))
errors.add("show_from", I18n.t('models.todo.error_date_must_be_future'))
end
errors.add(:description, "may not contain \" characters") if /\"/.match(description)
unless @predecessor_array.nil? # Only validate predecessors if they changed

View file

@ -61,6 +61,10 @@ Rails::Initializer.run do |config|
# to enable "link":onenote://... or "link":blah://... hyperlinks
config.action_view.sanitized_allowed_protocols = 'onenote', 'message'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
# See Rails::Configuration for more options
if ( SITE_CONFIG['authentication_schemes'].include? 'cas')
#requires rubycas-client gem to be installed

View file

@ -170,7 +170,7 @@ en:
note_header: "Note {{id}}"
note_link_title: "Show note {{id}}"
delete_note_title: "Delete this note"
delete_confirmation: "Are you sure that you want to delete the note \'{{id}}\'?"
delete_confirmation: "Are you sure that you want to delete the note '{{id}}'?"
edit_item_title: "Edit item"
show_note_title: "Show note"
deleted_note: "Deleted note '{{id}}'"
@ -270,7 +270,7 @@ en:
month_avg_created: "{{months}} Month Avg Created"
month_avg_completed: "{{months}} Month Avg Completed"
click_to_update_actions: "Click on a bar in the chart to update the actions below."
click_to_return: "Click {{here}} to return to the statistics page."
click_to_return: "Click {{link}} to return to the statistics page."
click_to_return_link: "here"
click_to_show_actions_from_week: "Click {{link}} to show the actions from week {{week}} and further."
running_time_all: "Current running time of all incomplete actions"
@ -431,7 +431,7 @@ en:
total_projects: "Total projects"
total_notes: "Total notes"
destroy_user: "Destroy user"
destroy_confirmation: "Warning: this will delete user \'{{login}}\', all their actions, contexts, project and notes. Are you sure that you want to continue?"
destroy_confirmation: "Warning: this will delete user '{{login}}', all their actions, contexts, project and notes. Are you sure that you want to continue?"
signup_new_user: "Signup new user"
manage_users: "Manage users"
total_users_count: "You have a total of {{count}} users"
@ -442,4 +442,4 @@ en:
confirm_password: "Confirm password"
signup: "Signup"
errors:
user_unauthorized: "Only administrative users are allowed access to this function."
user_unauthorized: "401 Unauthorized: Only administrative users are allowed access to this function."

View file

@ -21,6 +21,7 @@ Feature: Existing user logging in
| admin | secret | redirected to the home page | Login successful |
| admin | wrong | on the login page | Login unsuccessful |
@wip
Scenario Outline: Unauthorized users cannot access Tracks and need to log in first
Given there exists a project called "top secret" for user "testuser"
And there exists a context called "@secret location" for user "testuser"

View file

@ -49,7 +49,7 @@ When /^I delete the context "([^\"]*)"$/ do |context_name|
context = @current_user.contexts.find_by_name(context_name)
context.should_not be_nil
click_link "delete_context_#{context.id}"
selenium.get_confirmation.should == "Are you sure that you want to delete the context '#{context_name}'? Be aware that this will also delete all actions in this context!"
selenium.get_confirmation.should == "Are you sure that you want to delete the context '#{context_name}'? Be aware that this will also delete all (repeating) actions in this context!"
wait_for do
!selenium.is_element_present("delete_context_#{context.id}")
end

View file

@ -66,14 +66,14 @@ class LoginControllerTest < ActionController::TestCase
def test_login_bad_password
post :login, {:user_login => 'jane', :user_password => 'wrong', :user_noexpiry => 'on'}
assert(!@response.has_session_object?(:user))
assert_equal "Login unsuccessful", flash[:warning]
assert_equal "Login unsuccessful.", flash[:warning]
assert_response :success
end
def test_login_bad_login
post :login, {:user_login => 'blah', :user_password => 'sesame', :user_noexpiry => 'on'}
assert(!@response.has_session_object?(:user))
assert_equal "Login unsuccessful", flash[:warning]
assert_equal "Login unsuccessful.", flash[:warning]
assert_response :success
end