[rspec-users] Specs for ApplicationController, where to put them?

Tim Lucas t.lucas at toolmantim.com
Tue May 29 19:13:42 EDT 2007

On 25/05/2007, at 5:16 AM, Anthony Carlos wrote:

> I'm sorry, but I'm a newbie and I don't fully understand. Could you
> please give me more details?
> 1. Is the slightly dodgy way completely separate from using a shared
> spec?

Yeah, it's completely separate. The pastie[1] is the complete spec.  
This only tests your ApplicationController though.

> 2. What is the appropriate file path and name for your first example
> regarding a shared spec? Is it RAILS_ROOT/spec/controllers/
> all_controllers_spec.rb?
> 3. Does the event controller spec belong in RAILS_ROOT/spec/
> controllers/event_controller_spec.rb?
> 4. How do you actually fire off the test? Do I have to call get or
> post inside a do-end block that is attached to it_should_behave_like
> "All controllers"?
> e.g.,
> describe EventController do
>    it_should_behave_like "All controllers" do
>      get 'event1' # just an example action
>    end
> end
> 5. Is there any further documentation on it_should_behave_like other
> than the RDoc? It doesn't really say too much.

I haven't actually used shared specs... so if you figure out please  
do share!

-- tim

[1] http://pastie.caboo.se/64123

More information about the rspec-users mailing list