How can I call the create method of a push controller for doing the rspec test that proper thing is getting returned in response?
You can test controllers in two ways:
- They can be tested indirectly via an integration test (this will test via the UI)
- You can test directly using an RSpec controller test For example:
# spec/controllers/teams_controller_spec.rb
describe TeamsController do
describe "GET index" do
it "renders the index template" do
get :index
expect(response).to render_template("index")
end
end
end
1 Like