On Mar 3, 2011, at 1:36 AM, Jiang Guimin wrote:
> 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.
Please run it again with the --backtrace flag and post the output.
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users