JavaScript database strategies should take options #192

Closed
tomstuart opened this Issue Jan 14, 2012 · 8 comments

5 participants

@tomstuart

If the (non-JavaScript) DatabaseCleaner strategy needs to be set to, say,

DatabaseCleaner.strategy = :truncation, {:except => %w[widgets]}

then there's no way to provide the :except => %w[widgets] option when setting Cucumber::Rails::Database.javascript_strategy to :truncation.

@mattwynne
Cucumber member

Would you like some help providing a patch?

@mipearson

I just blew two hours on this to find out that this isn't supported.

The documentation example in the generated env.rb implies that options are honoured. Investigating the source, and then finding this issue, shows that it does not.

Please fix. I would do so myself, but I feel that I've already wasted enough time as the result of incorrect documentation.

@mipearson

PR to adjust documentation in Issue #194.

@mattwynne
Cucumber member

@mipearson thanks for the docs patch and sorry about your wasted hours. Why not make capitalize on what you've learned and make a patch that fixes it? :)

@twalpole

I submitted a pull request that should allow for options to be passed to the strategy

@mipearson

Shouldn't it be using the DatabaseCleaner strategy already set rather than overriding it?

Is that possible with the current implementation?

@twalpole

The current cucumber-rails implentation defaults to :truncation for the javascript strategy since one would normally be using :transaction for non javascript tests and that cant be used for javascript tests normally - the change I submitted allows you to pass options (:except, :only ... ) to the javascript strategy to enable handling of things like preloaded static data in the database which you wouldnt want cleared

@Kosmas
Cucumber member

Closing old issues. If they are still relevant, please reopen

@Kosmas Kosmas closed this Feb 5, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment