Skip to content

Declare an activemodel dependency #798

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

Closed
wants to merge 1 commit into from

Conversation

jfirebaugh
Copy link
Contributor

mocks.rb requires active_model, therefore it should be listed in the gemspec.

mocks.rb requires active_model, therefore it should
be listed in the gemspec.
@fables-tales
Copy link
Member

@jfirebaugh does this fix a particular issue that you were having?

@jfirebaugh
Copy link
Contributor Author

Yes, konacha uses rspec-rails in tests but does not have an activemodel dependency itself, so this fixes a require error I was getting (current workaround).

@JonRowe
Copy link
Member

JonRowe commented Aug 3, 2013

The issue is that you don't have to use mock_model (which is what I assume requires ActiveModel) and you don't have to use ActiveModel in Rails so this is adding an extra unnecessary dependency which most people will already have in their own dependencies if they are using it.

@jfirebaugh
Copy link
Contributor Author

If you want to avoid the dependency entirely, then mocks.rb needs to rescue from the failure of require "active_model" or otherwise do a conditional require. As it is there is a dependency on activemodel, it just isn't declared.

@JonRowe
Copy link
Member

JonRowe commented Aug 3, 2013

It's an optional dependency, which rubygems doesn't allow us to specify. We probably should rescue the require and issue a warning tho.

@jfirebaugh
Copy link
Contributor Author

I'm confused. Issue a warning? rspec/rails/mocks.rb is included by rspec/rails.rb. So, if I'm not using mock_model, am I expected to manually require all the files under rspec/rails that I do use, but not rspec/rails.rb, in order to avoid the warning?

@alindeman alindeman closed this in dd4408a Aug 13, 2013
@alindeman
Copy link
Contributor

Thanks @jfirebaugh. I'll include this in an upcoming 2.14.1. In the mean time you could point at the 2-14-maintenance branch.

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.

4 participants