How to remove duplication for similar behaviour?


On a website I created the is two commentable model, “project” and
“actuality”. You can view pages here :
here :
in french for the momeent).

At the end of each page there is a form to create a new comment and a
for all comments. They have the same behaviour and they use the same
partials. My problem is for specs. I created two specs. Here :
here :
There is a duplication and I want, if it’s possible, to have only one
for this.

I tried to create an engine but I’m not satisfied. The behaviour is
related to my application. For example, I have this inherited routes
this :

resources :actualities do
resources :comments

resources :projects do
resources :comments

If I try to put only “resources :comments” it break my controller’s
To find the related model I must to add the class name into the params.
didn’t find another solution and I think it’s uggly.

Do you have and Idea? Is it better to have two specs for a similar
or is it better to remove an spec and keep the other?

Thanks for your help!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs