Vote #65878
完了Rename named_scope :public for Project to something else
100%
説明
As the word public is reserved in ruby, the attempt to mock/stub the model Project fails, since the line that introduces a new public method fails due to the fact that word 'public' is redefined by the named_scope.
I suspect you may meet the case while setting up the shoulda.
journals
Agreed. I ran into this when I would mock @Project.public@ in my tests. What do you propose renaming it to? Project.public_projects? Project.all_public?
--------------------------------------------------------------------------------
I think :all_public is pretty good. As a variant I was thinking about :public_state. :-)
--------------------------------------------------------------------------------
@Project.all_public@ it is. Thanks for the suggestion. r2941
--------------------------------------------------------------------------------