-
-
Notifications
You must be signed in to change notification settings - Fork 328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
handling of @javascript tag is confusing #521
Comments
Hello :) The JavaScript tag related to database strategy is documented here: https://github.com/cucumber/cucumber-rails/blob/main/features/choose_javascript_database_strategy.feature Does that help? |
I found this feature yesterday and it somehow helped understand what is going on, although I didn't really until I read the database strategy hooks and classes. The bigger issue is that one can't configure this behavior easily depending on project tags. I'm trying to workaround this with a custom strategy class now and will post what I come up with here if this may serve as a better example of what I'm trying to do. |
Once you have a custom strategy defined then you can just leverage that inside whatever logic you want inside your hooks? I'm confused with where the issue lies? |
Hi again. The issue is that there is special handling of To avoid the special IMO there should be a simpler way to tell cucumber-rails to avoid If I had to design this feature, I'd let users configure behavior like: Cucumber::Rails::Database.default_strategy = :transaction_non_shared_connection
Cucumber::Rails::Database.truncation_tags = %w[@no-txn @tag1]
Cucumber::Rails::Database.transaction_shared_connection_tags = %w[@javascript @tag2]
Cucumber::Rails::Database.transaction_non_shared_connection_tags = %w[@tag3 @tag4] Where last line is redundant provided the default but if default was set to something else, it would have been useful. |
Some of those articles are severely old / some of the points made are old. But to me now it feels like a "configure it how you wish" approach. The custom strategy allows for just that, configure it how you wish. If the default tags don't serve their purpose for you, feel free to use others. I believe (But I could be wrong), that those tags were there to express intent for what things should do in the js/non-js scenarios when executed in sep threads to the app proper. But again I could be wrong here. This all feels like behaviour that encompasses the default/s easily? If you're happy with a workaround / think the defaults could be improved, feel free to submit a PR. But I'm not sure I'd class it as a bugfix. It would be more of a breaking change (Which I suppose is valid). |
What could be interesting at least would be to improve documentation regarding those points in the README |
To me besides some documentation, it should be easier and more obvious how to turn off the |
I'm a bit confused, the only way this feature works is if you specifically use it by tagging it as a javascript. or am I missing some point. If you don't want to use it, just don't tag your scenarios as such? |
The issue is that feature kicks in when a test is tagged with At the very least, something like this can be available:
|
Right 100% on board with you now. Sorry for the confusion. Yes we shouldn't amend any of our code then, just maybe highlight to users that we pre-determine certain things. That's deliberate as we want to make this project work out of the box for a lot of users. |
Closing as fixed in main |
Presently handling of scenarios tagged with
@javascript
and without is hardcoded. This is very confusing, see #166.I see no clear documentation when a scenario is supposed to be tagged
@javascript
and then it shouldn't. I believe that it will be much clearer if tag is named@shared-connection
as well create ability to people to list tags that should be handled one way or another.In current implementation if project wants to use
@tag1
,@tag2
and@tag3
with shared connection transactional clean-up and@tag4
,@tag5
and@tag6
with non-shared connection truncation clean-up, then there seems to be no way of doing this.For example if one has this in
support/env.rb
:This doesn't help because default hooks will call
Cucumber::Rails::Database.before_non_js
for anything not tagged@javascript
even though we ourselves calledbefore_js
. And if we moverequire 'cucumber/rails'
on top, then database cleaner will already be started so our hooks will be pointless.The text was updated successfully, but these errors were encountered: