Skip to content
This repository has been archived by the owner on Oct 26, 2021. It is now read-only.

Support for shoulda controller tests in scaffold #3

Open
javierm opened this issue Jul 27, 2010 · 5 comments
Open

Support for shoulda controller tests in scaffold #3

javierm opened this issue Jul 27, 2010 · 5 comments
Labels

Comments

@javierm
Copy link

javierm commented Jul 27, 2010

Using Rails 3.0 RC, shoulda 2.11.1 and rails3-generators 0.11.0, I've found that running:
rails g scaffold article title:string body:text

Generates the following output:
invoke active_record
create db/migrate/20100727193257_create_articles.rb
create app/models/article.rb
invoke shoulda
create test/unit/article_test.rb
invoke factory_girl
create test/factories/articles.rb
route resources :articles
invoke scaffold_controller
create app/controllers/articles_controller.rb
invoke haml
create app/views/articles
create app/views/articles/index.html.haml
create app/views/articles/edit.html.haml
create app/views/articles/show.html.haml
create app/views/articles/new.html.haml
invoke simple_form
create app/views/articles/_form.html.haml
error shoulda [not found]
invoke helper
create app/helpers/articles_helper.rb
error shoulda [not found]

It would be nice if shoulda generated the test for the controller. Of course if a fallback is specified, the controller test file is generated with "test/unit" style, but then what's the point of having shoulda as the default generator ;).

Thanks.

@negonicrac
Copy link
Collaborator

Agreed. However, I have a problem, I do not use shoulda or known the current best practices when using shoulda. If you like, you can fork/brach (branching is good) the project to add some suggested stuff. Even if it is just stubs of how you setup your controller tests.

Thanks for pointing this out and thanks for your future contributions

Louis T.

@jeanmartin
Copy link

Also, when using shoulda with rspec, the unit and functional test files are still created in test/ (not spec). If I change that in my application.rb (with the :dir => '' option) it is changed for both unit and functional test files (e.g. putting the model- and controller test files inside the same dir). Frustrating.

@JonnieCache
Copy link

I'd just like to say that I've wasted almost an hour of my life trying to work out why I was getting these [not found] messages, I convinced myself it was some kind dependency loading issue (rails3-generators is a dependency of a gem I am requiring into my main project, it is loaded into the main project 'through' the gem and I was unsure if this was working.) Don't get me wrong I'm not ungrateful just frustrated :)

If this message could be suppressed in the generator output that would be a very good move, I am sure there are others out there going round and round in circles along these same lines.

@negonicrac
Copy link
Collaborator

What are you working with?

@albertoperdomo
Copy link

I'm seeing this issue too. How are you supposed to use the shoulda generators?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants