I have routes set up that look like:
match '/things/:thing_id' => "descriptions#index", :as => :thing
resources :things, :except => [:show] do
...
resources :descriptions, :only => [:create, :index]
end
How would I test the :create method for the nested descriptions?
So far i've got
context "with user signed in" do
before(:each) do
user = Factory.create(:user, :name => "Bob")
controller.stub!(:authenticate_user!).and_return(true)
controller.stub!(:current_user).and_return(user)
end
describe "PUT create" do
before(:each) do
@thing = Factory.create(:thing)
params = {"text" => "Happy Text"}
post thing_descriptions_path(@thing.id), params #Doesn't work
post :create, params #Doesn't work
end
end
end