Skip to content

Commit

Permalink
Enable using just t (not I18n.t) in specs
Browse files Browse the repository at this point in the history
  • Loading branch information
gabebw committed Mar 20, 2014
1 parent 12a7578 commit 7ea5176
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]:

Expand Down
4 changes: 4 additions & 0 deletions lib/suspenders/app_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions lib/suspenders/generators/app_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions templates/i18n.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
RSpec.configure do |config|
config.include AbstractController::Translation
end

0 comments on commit 7ea5176

Please sign in to comment.