Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Enable using just `t` (not `I18n.t`) in specs #304

Merged
merged 1 commit into from

4 participants

@gabebw
Owner

No description provided.

README.md
@@ -88,12 +88,14 @@ Suspenders also comes with:
* [Fast-failing factories][fast]
* A [low database connection pool limit][pool]
* [Safe binstubs][binstub]
+* [Ability to use t() in specs][i18n]
@calebthompson Owner

You've also included l().

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

This looks good to me.

@calebthompson

Yup. One documentation suggestion.

@gabebw gabebw merged commit 7ea5176 into master
@gabebw gabebw deleted the gbw-include-abstract-controller-translation branch
@gylaz gylaz commented on the diff
templates/i18n.rb
@@ -0,0 +1,3 @@
+RSpec.configure do |config|
+ config.include AbstractController::Translation
@gylaz Owner
gylaz added a note

Should this be rather ActionView::Helpers::TranslationHelper? I'm not sure on the differences between the two

@gabebw Owner
gabebw added a note

Me neither. I've used this on 2 projects so far and I haven't run into any problems. The TranslationHelper might be the wrapper that allows you to do t(".hello") (note the leading dot), which we wouldn't use in specs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 20, 2014
  1. @gabebw
This page is out of date. Refresh to see the latest.
View
2  README.md
@@ -88,12 +88,14 @@ Suspenders also comes with:
* [Fast-failing factories][fast]
* A [low database connection pool limit][pool]
* [Safe binstubs][binstub]
+* [t() and l() in specs without prefixing with I18n][i18n]
[bin]: http://robots.thoughtbot.com/bin-setup
[compress]: http://robots.thoughtbot.com/content-compression-with-rack-deflater/
[fast]: http://robots.thoughtbot.com/testing-your-factories-first
[pool]: https://devcenter.heroku.com/articles/concurrency-and-database-connections
[binstub]: https://github.com/thoughtbot/suspenders/pull/282
+[i18n]: https://github.com/thoughtbot/suspenders/pull/304
Suspenders fixes several of Rails' [insecure defaults]:
View
4 lib/suspenders/app_builder.rb
@@ -172,6 +172,10 @@ def configure_travis
template 'travis.yml.erb', '.travis.yml'
end
+ def configure_i18n_in_specs
+ copy_file 'i18n.rb', 'spec/support/i18n.rb'
+ end
+
def use_spring_binstubs
run 'bundle exec spring binstub --all'
end
View
1  lib/suspenders/generators/app_generator.rb
@@ -82,6 +82,7 @@ def setup_test_environment
build :enable_database_cleaner
build :configure_spec_support_features
build :configure_travis
+ build :configure_i18n_in_specs
end
def setup_production_environment
View
3  templates/i18n.rb
@@ -0,0 +1,3 @@
+RSpec.configure do |config|
+ config.include AbstractController::Translation
@gylaz Owner
gylaz added a note

Should this be rather ActionView::Helpers::TranslationHelper? I'm not sure on the differences between the two

@gabebw Owner
gabebw added a note

Me neither. I've used this on 2 projects so far and I haven't run into any problems. The TranslationHelper might be the wrapper that allows you to do t(".hello") (note the leading dot), which we wouldn't use in specs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+end
Something went wrong with that request. Please try again.