Rspec testing in rails3

13 views
Skip to first unread message

Pradeep Achuthan

unread,
Apr 26, 2014, 11:16:59 AM4/26/14
to rs...@googlegroups.com
Hi,

I have a Queues controller and and QueueItems controller in my rails
application. In routes I have defined as below
`match 'queues/:queue_id/next', :to=> 'queueitems#next'`
In my QueueItems Controller I have a next action and it assigns an
instance variable.

    def next
    @queue = "Regular"
    #other stuffs related to regular
    end

How do I test this in Rspec. I am pretty very new to Rspec. Please help.
I tried like the below
describe QueuesController do
    describe "next " do
      it "routes /queues/:queue_id/next" do
        { :get => "/queues/regular_queue/next" }.should route_to(
          :controller => "queue_items",
          :action => "next",
          :queue_id => "regular_queue",
          :format => "json"
            )
        assigns(:queue).should_not be_nil
        expect(response).to be_success
      end
end

But it is not at all coming inside my next action in controller.
Reply all
Reply to author
Forward
0 new messages