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

spec folder dones't exists #10

Open
wonderer007 opened this issue Feb 12, 2017 · 11 comments
Open

spec folder dones't exists #10

wonderer007 opened this issue Feb 12, 2017 · 11 comments

Comments

@wonderer007
Copy link

I want to change deals table to services so when I run
rails_refactor rename Deal Service
I got this error

mv: rename spec/models/deal_spec.rb to spec/models/service_spec.rb: No such file or directory
/Users/haiderali/.rvm/gems/ruby-2.3.0/gems/rails_refactor-1.3/bin/rails_refactor.rb:85:in `read': No such file or directory @ rb_sysopen - spec/models/service_spec.rb (Errno::ENOENT)

I read the documentation and came to know that rails_refactor rename OldModel NewModel command rename model, spec and migration files. since i didn't have spec folder I am getting this error. How can I get rid of this error ?

Thanks

@wonderer007
Copy link
Author

I have forked the gem and have fixed the issue, when I am trying to add gem from my forked repo like gem "rails_refactor", :git => "[email protected]:/wonderer007/rails_refactor.git"

when running bundle its giving me error

Could not find gem 'rails_refactor' in [email protected]:/wonderer007/rails_refactor.git (at master@fefe84f).
Source does not contain any versions of 'rails_refactor'

@jcrisp
Copy link
Owner

jcrisp commented Feb 13, 2017

Hi! Thanks for your interest in Rails Refactor. If you send me a pull request, I can merge in your change and re-publish the gem with a new version.
Cheers
James

@jcrisp
Copy link
Owner

jcrisp commented Feb 13, 2017

I'd suggest it does not fail but does print out a warning if a file is missing.

@jcrisp
Copy link
Owner

jcrisp commented Feb 20, 2017

I'm doing some updates now to bring it into rails 4

@wonderer007
Copy link
Author

@jcrisp
Copy link
Owner

jcrisp commented Feb 21, 2017

Hi @wonderer007 I've made quite a few updates now, and brought it across to use a modern gem setup. I suspect it'll work for you now, but you'll need to merge in the new changes into your fork.After you feel your change is ready (including a test for it), please send me a pull request and I'll review and merge it in and re-publish the gem with a new version. As an aside, you can always install the gem just on your filesystem. If you run gem build rails_refactor.gemspec you can then run gem install gem install rails_refactor-1.4.0.gem to test - you don't need to push it to github to install it. Cheers James

@wonderer007
Copy link
Author

@scrisp i was working on pull request to change spec folder to test ( rails 4 and 5 have test folder instead of spec folder) I notices that the dummy app project you have inside gem is of rails 3 as well. Do we really need rails project inside the gem itself just to run our test cases ?

Also we at the moment have rails 5.1 and lots of structure has changed from rails 3 and I would suggest to add features like renaming serializes, uploaders, workers, activejobs as well.

@jcrisp
Copy link
Owner

jcrisp commented Mar 1, 2017

@wonderer007 so I've already updated the included Dummy app to rails 4 (re-generated it and updated refactor tests) and it is no longer included in the gem file, though it is in the github repo for testing purposes.

Adding more renamers sounds good to me. I think the way to go is to support both rails 4 (still popular, I use it at work) and rails 5. Ie, add a dummy5 rails app which is a vanilla rails 5 app for test purposes, and also run the tests against that to make sure they work there too. Also the rename of files should handle missing files with a warning.

Which bit(s) are you interested in working on?

For pull requests, please make them small and self contained, doing one thing. That way it'll be easy for me to review and merge (and they'll be neat!).

Thanks for your interest in the gem :-)

Cheers
James

@johnpitchko
Copy link

Bumping this. I'm using Minitest and not RSpec and encountered the same issue when trying to rename a model.

@jcrisp
Copy link
Owner

jcrisp commented Dec 29, 2022

Hi @johnpitchko, would you be interested in writing a PR for this to provide Minitest support? The switch could happen automatically based on if the spec folder existed.
Cheers
James

@johnpitchko
Copy link

I would be; won't have a chance to work on this in the near future, but I will add it to my overall 'to-do' list.

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

3 participants