can you controller context test just one test via the -n flag?

0 views
Skip to first unread message

kenglish

unread,
Oct 9, 2008, 1:54:56 PM10/9/08
to shoulda
I have a controller test like this:

class NotificationsControllerTest < ActionController::TestCase
include AuthenticatedTestHelper
context "on GET to :index" do
setup {
login_as :admin
get :index
}
should_assign_to :notifications
should_respond_with :success
should_render_template :index
should_not_set_the_flash
end

context "on GET to :new" do
setup {
login_as :admin
get :new
}

should_respond_with :success
should_render_template :new
should_not_set_the_flash
end

end

In this case, how would I run the single test for the context "on GET
to :new"?

I tried:

ruby test/functional/notifications_controller_test.rb -n "on GET
to :new"

and

ruby test/functional/notifications_controller_test.rb -n "test:on GET
to :new"


Mahalo,

Kevin English

david.l...@gmail.com

unread,
Oct 9, 2008, 2:45:46 PM10/9/08
to sho...@googlegroups.com
use a regexp...
// instead of ""

-D

kenglish

unread,
Oct 9, 2008, 3:07:35 PM10/9/08
to shoulda
Wow, that's awesome.

Aloha,

Kevin

david.l...@gmail.com

unread,
Oct 9, 2008, 3:23:23 PM10/9/08
to sho...@googlegroups.com
PS, if you're using the shoulda textmate bundle, it's option-apple-R
to "run focused context"

-D

On Oct 9, 2008, at 10:54 AM, kenglish wrote:

Reply all
Reply to author
Forward
0 new messages