Skip to content

Instantly share code, notes, and snippets.

@mallain
Created July 12, 2010 15:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mallain/472582 to your computer and use it in GitHub Desktop.
Save mallain/472582 to your computer and use it in GitHub Desktop.
ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'test_help'
require 'factory_girl'
require 'shoulda'
require 'faker'
require "authlogic/test_case"
require 'i18n'
class ActiveSupport::TestCase
# Transactional fixtures accelerate your tests by wrapping each test method
# in a transaction that's rolled back on completion. This ensures that the
# test database remains unchanged so your fixtures don't have to be reloaded
# between every test method. Fewer database queries means faster tests.
#
# Read Mike Clark's excellent walkthrough at
# http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting
#
# Every Active Record database supports transactions except MyISAM tables
# in MySQL. Turn off transactional fixtures in this case; however, if you
# don't care one way or the other, switching from MyISAM to InnoDB tables
# is recommended.
#
# The only drawback to using transactional fixtures is when you actually
# need to test transactions. Since your test is bracketed by a transaction,
# any transactions started in your code will be automatically rolled back.
self.use_transactional_fixtures = true
# Instantiated fixtures are slow, but give you @david where otherwise you
# would need people(:david). If you don't want to migrate your existing
# test cases which use the @david style and don't mind the speed hit (each
# instantiated fixtures translates to a database query per test method),
# then set this back to true.
self.use_instantiated_fixtures = false
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
#
# Note: You'll currently still have to declare fixtures explicitly in integration tests
# -- they do not yet inherit this setting
#fixtures :all
end
module ActionView
module Helpers
module TranslationHelper
def t(key, options = {})
options[:raise] = true
I18n.translate(scope_key_by_partial(key), options)
end
end
end
end
class ActionController::TestCase
setup :activate_authlogic
Factory(:agency) unless Agency.first.nil?
Factory(:feedback) unless Feedback.first.nil?
end
def should_get_action(action)
context "on GET to #{action}" do
setup do
get action
end
should_respond_with :success
should_render_with_layout
should_render_template action
should_not_set_the_flash
end
end
@mallain
Copy link
Author

mallain commented Jul 12, 2010

Here we go, hack of module TranslationHelper works ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment