Reputation: 97
Below is the problem I am having. I am not sure how to pass the correct params to this controller action.
def get_standards
@standard_children, @temp = Standard.browse(params[:guid])
@parent_standard = params[:guid]
respond_to do |format|
format.js
end
end
describe "Get Standards" do
it "should return correct values" do
@stateOne = mock_model(Standard, description: "beta")
Standard.stub!(:browse).and_return(@stateOne, "temp")
assigns(:standard_children).should == @stateOne
assigns(:parent_standard).should == 'one'
get :get_standards, :params => {guid: 'one'}
end
end
Failure/Error: assigns(:standard_children).should == @stateOne
expected: #<Standard:0x3ffed4e53d88 @name="Standard_1001">
got: nil (using ==)
Upvotes: 2
Views: 7724
Reputation: 15781
describe "Get Standards" do
it "should return correct values" do
@stateOne = mock_model(Standard, description: "beta")
Standard.stub!(:browse).and_return(@stateOne, "temp")
get :get_standards, :guid => 'one'
assigns(:parent_standard).should == 'one'
assigns(:standard_children).should == @stateOne
end
end
Upvotes: 8