Skip to content

Conversation

@killondark
Copy link
Contributor

Hey, @Envek. In continue my PR. I want to extend the metrics limit functionality for the adapter.

# current version:
Yabeda.configure do
  group :mushrooms do
    adapter :basket_adapter
    counter :champignon_counter
  end
end

# added version:
Yabeda.configure do
  group :mushrooms do
    counter :champignon_counter
  end

  adapter :basket_adapter do
    include_group :mushrooms
  end
end

But specs do randomly green or red. For example:

1) Yabeda::Counter when config has no group execute perform_counter_increment!
   Failure/Error: let(:counter) { Yabeda.test_counter }
   
   NoMethodError:
     undefined method `test_counter' for Yabeda:Module
   # ./spec/yabeda/counter_spec.rb:14:in `block (3 levels) in <top (required)>'
   # ./spec/yabeda/counter_spec.rb:4:in `block (2 levels) in <top (required)>'
   # ./spec/yabeda/counter_spec.rb:30:in `block (3 levels) in <top (required)>'

What do you think about this? Thanks.

@killondark
Copy link
Contributor Author

Hi, @Envek. I done actualize and fixed failing specs. Running specs randomly is was a problem.

Copy link
Member

@Envek Envek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the pull request and sorry for the late reply. I will try to get to this in a few days.

# Disable RSpec exposing methods globally on `Module` and `main`
config.disable_monkey_patching!

config.order = :random
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not good when test suite result depends on order in which tests are executed. These dependencies need to be detected and removed (maybe something need to be added to the Yabeda.reset!)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, it just solved my problem. Reverted it.

Copy link
Member

@Envek Envek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the pull request. There are some small tweaks and rewording needed, but otherwise it looks good.

else
return yield if block_given?

raise ConfigurationError, "Should be block passed with call .include_group for example"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That error message isn't very helpful because it doesn't tell what is wrong with this call to the adapter method and how to fix it.

Should be something like following, I think:

Yabeda.adapter should be called either inside group declaration or should have block provided with a call to include_group. No metric group provided.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the message.

@Envek Envek merged commit c04077b into yabeda-rb:master Sep 10, 2025
@Envek
Copy link
Member

Envek commented Sep 10, 2025

Thank you very much for your pull request and sorry for the long wait!

Released in 0.14.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants