Does config.cache_classes really have to be true in all contexts?

158 views
Skip to first unread message

Lenny Marks

unread,
Nov 24, 2009, 12:00:40 PM11/24/09
to cu...@googlegroups.com
As of Cucumber 0.4.4 the generated config/environments/cucumber.rb
from script/generate cucumber contains:

config.cache_classes = true # This must be true for Cucumber to
operate correctly!

Doesn't this only apply to use with Spork or transactional fixtures?
In my environment, I'm using Cucumber with Celerity, Jruby/Rails. I
typically start the rails server before running any features. It would
be really annoying if I had to restart the Rails server after each
change so I change config.cache_classes=false and all seems well. The
comment is a little scary. Would it make sense to make the comment a
bit more informative or is it really true that it "must be true for
Cucumber to operate correctly!" in all contexts.

Thanks,
-lenny

Lenny Marks

unread,
Nov 24, 2009, 4:40:59 PM11/24/09
to cu...@googlegroups.com
Ahh. I missed the message below that scrolls by when you run cucumber.

WARNING: You have set Rails' config.cache_classes to false (most
likely in config/environments/cucumber.rb). This setting is known to
break Cucumber's use_transactional_fixtures method. Set
config.cache_classes to true if you want to use transactional
fixtures. For more information see https://rspec.lighthouseapp.com/projects/16211/tickets/165
.

Can we add a similar message to the generated cucumber.rb iteself?

From: Lenny Marks <le...@lenny.ridge.aps.org>
Subject: [PATCH] Added variation of cucumber startup warning about
config.cache_classes to generated Rails environments/cucumber.rb

---
.../cucumber/templates/cucumber_environment.rb | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/rails_generators/cucumber/templates/
cucumber_environment.rb b/rails_generators/cucumber/templates/
cucumber_environment.rb
index 7972f1c..72c3c04 100644
--- a/rails_generators/cucumber/templates/cucumber_environment.rb
+++ b/rails_generators/cucumber/templates/cucumber_environment.rb
@@ -2,7 +2,12 @@
# Edit at your own peril - it's recommended to regenerate this file
# in the future when you upgrade to a newer version of Cucumber.

-config.cache_classes = true # This must be true for Cucumber to
operate correctly!
+
+# WARNING: This setting is known to break Cucumber's
+# use_transactional_fixtures method. Set config.cache_classes
+# to true if you want to use transactional fixtures.
+# For more information see https://rspec.lighthouseapp.com/projects/16211/tickets/165
.
+config.cache_classes = true

# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true
@@ -27,4 +32,4 @@ config.gem 'rspec-rails', :lib =>
false, :version => '>=1.2.9' unless Fil
<% end %>
<% if spork? -%>
config.gem 'spork', :lib => false, :version =>
'>=0.7.3' unless File.directory?(File.join(Rails.root, 'vendor/plugins/
spork'))
-<% end %>
\ No newline at end of file
+<% end %>
--
1.6.1
> --
>
> You received this message because you are subscribed to the Google
> Groups "Cukes" group.
> To post to this group, send email to cu...@googlegroups.com.
> To unsubscribe from this group, send email to cukes+un...@googlegroups.com
> .
> For more options, visit this group at http://groups.google.com/group/cukes?hl=en
> .
>
>

aslak hellesoy

unread,
Nov 24, 2009, 6:09:13 PM11/24/09
to cu...@googlegroups.com
On Tue, Nov 24, 2009 at 10:40 PM, Lenny Marks <le...@aps.org> wrote:
> Ahh. I missed the message below that scrolls by when you run cucumber.
>
> WARNING: You have set Rails' config.cache_classes to false (most
> likely in config/environments/cucumber.rb).  This setting is known to
> break Cucumber's use_transactional_fixtures method. Set
> config.cache_classes to true if you want to use transactional
> fixtures.  For more information see https://rspec.lighthouseapp.com/projects/16211/tickets/165
> .
>
> Can we add a similar message to the generated cucumber.rb iteself?
>

Good idea. Done.

Aslak
Reply all
Reply to author
Forward
0 new messages