Hi,
  I hava a controller

  class DynamicFlowsController < ApplicationController

   def create
      @workflow = Workflow.find_by_id(params[:workflow_id])
      table = @workflow.flex_table
       save_u_and_node(table, @workflow.node_definition)
       redirect_to "/#{table.name}"
   end

  end

  and I had written some rspec codes

   describe "save attachment" do

    before(:each) do
      workflow, table, form = init_stubs("baoxiaos", 1)
      definition = workflow.node_definition
      controller.should_receive(:save_u_and_node).with(table,
definition)
    end

    it "should be successful" do
      file = UploadFile.new("a" * 10000, "testfile", "text/plain")
      post '/workflows/1/baoxiaos', { :attachment => file}
      response.should be_successful
    end

  end

When I run the test, unfortunately rspec told me that "controller"  is
nil, I got a fail test.
So, I want to konw how to get the correct "controller" object.

Thanks
Kayak

-- 
Posted via http://www.ruby-forum.com/.
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to