Giter Club home page Giter Club logo

Comments (7)

bkeepers avatar bkeepers commented on June 15, 2024

@norman Sorry you're running into issues. TestHelp was just added in 1.2 and is enabled by default. I'm guessing there's an order issue with the before/around callbacks.

To help isolate it, can you first try disabling the TestHelp integration?

# config/initializers/flipper.rb
Rails.application.configure do
  config.flipper.test_help = false
end

If your test pass after that, then I'm guessing what is happening is:

  1. Your with_feature_flag helper enables the feature in the around block
  2. TestHelp#flipper_configure gets called, resetting the current flipper instance
  3. The specs run with the newly configured flipper instance

from flipper.

norman avatar norman commented on June 15, 2024

Sorry you're running into issues.

@bkeepers No worries! Thanks for the quick response and thanks for working on this library that my coworkers and I are super happy with.

To help isolate it, can you first try disabling the TestHelp integration?

Yes, the specs pass when I add the initializer you provided.

I think our usage of adding a context-level around hook is pretty weird, a fair solution to the problem might just be to document that as "DON'T DO THIS" - I can change our code to call the with_feature_flag in a before block, which should be compatible with your code as-is. Getting your setup code to reliably run before my around hook seems difficult with RSpec.

from flipper.

bkeepers avatar bkeepers commented on June 15, 2024

@norman can you try this branch with your original with_feature_flag helper?

gem 'flipper-active_record', git: 'https://github.com/flippercloud/flipper', branch: 'rspec-prepend'

from flipper.

norman avatar norman commented on June 15, 2024

@norman can you try this branch with your original with_feature_flag helper?

gem 'flipper-active_record', git: 'https://github.com/flippercloud/flipper', branch: 'rspec-prepend'

Yes! That worked.

from flipper.

bkeepers avatar bkeepers commented on June 15, 2024

Yes! That worked.

Awesome. And just to confirm, this is with config.flipper.test_help = true?

from flipper.

norman avatar norman commented on June 15, 2024

Yes! That worked.

Awesome. And just to confirm, this is with config.flipper.test_help = true?

Oh crap. Sorry, I'm doing a million things at once right now and forgot to unset that. I still had your initializer running. When I removed it the specs no longer pass with your branch, the behavior is the same as my original report.

from flipper.

d-otis avatar d-otis commented on June 15, 2024

Howdy 👋🏻 🤠
FWIW Jumping in here to say I'm experiencing a similar issue in a Rails(7.0.8) app albeit we use Redis instead of ActiveRecord for Flipper. We are using RSpec v3.12 with Flipper.enable/disable in our tests. These tests were passing before this update.

The config changes in the Flipper initializer mentioned earlier in this thread allowed our Flipper-related tests to pass 🤩 , but the rspec-prepend gem branch did not. I was guessing at the gem though:

gem 'flipper-redis', git: 'https://github.com/flippercloud/flipper', branch: 'rspec-prepend'

I could be wrong there ☝🏻
LMK if you have other questions 🙏🏻

from flipper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.