Skip to content
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

Index action can be configured with custom query params. but Rspec matcher only expect ClassName #867

Open
asad-ali-bhatti opened this issue Sep 18, 2024 · 0 comments

Comments

@asad-ali-bhatti
Copy link

Steps to reproduce

We can configure index actions in ability class like following

can :index, [Product], brand_id: allowed_brand_ids_from_session

But how I can test it in Rspec as you can only access allowed products coming from session
Why we dont we allow query params in be_able_to matchers

This don't cover actuall implementation of our ability. Because at the moment we can only pass model name only.

expect(subject).to be_able_to(:index, Product) 

Expected behavior

we can allow some thing like .with to also mention query params that we pass in actuall ability class.

expect(subject).to be_able_to(:index, Product).with(brand_id: some_brand_ids) 

Actual behavior

Tell us what happens instead

System configuration

Rails version:

Ruby version:

CanCanCan version

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

No branches or pull requests

1 participant