def create
@user = User.new(user_params)
if @user.save
flash[:success] = "User Saved!"
redirect_to main_app.root_path
else
flash[:error] = "User Not Saved! Check Errors"
render :new
end
end
it "redirects to the home page upon save" do
post :create, contact: FactoryGirl.attributes_for(:contact)
expect(response).to redirect_to root_url #or some other url
end
--
You received this message because you are subscribed to the Google Groups "rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rspec+un...@googlegroups.com.
To post to this group, send email to rs...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rspec/1d9fa996-1f2b-4a0e-883f-7c7a596c6f46%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Routes inside an engine are isolated from the application by default. This is done by the isolate_namespace
call inside the Engine
class. This essentially means that the application and its engines can have identically named routes and they will not clash.
Routes inside an engine are drawn on the Engine
class within config/routes.rb
, like this:
YourEngineName::Engine.routes.draw
do
resources
:posts
end
posts_path
if that template was rendered from the application, or the engine's posts_path
if it was rendered from the engine:
<%= link_to "Blog posts" , posts_path %> To make this route always use the engine's
|
--
You received this message because you are subscribed to a topic in the Google Groups "rspec" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rspec/yvNa2nWwR-s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rspec+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rspec/3E5EE1C7-8D1B-4624-A1E0-A99D9F55EF17%40gmail.com.
If you isolated you engine like that (engine_app/lib/engine.rbà)isolate_namespace YourEngineName
Routes inside an engine are isolated from the application by default. This is done by the
isolate_namespace
call inside theEngine
class. This essentially means that the application and its engines can have identically named routes and they will not clash.Routes inside an engine are drawn on the
Engine
class withinconfig/routes.rb
, like this:YourEngineName::Engine.routes.draw
do
resources
:posts
end
For instance, the following example would go to the application'sposts_path
if that template was rendered from the application, or the engine'sposts_path
if it was rendered from the engine:
<%=
link_to
"Blog posts"
, posts_path
%>
To make this route always use the engine's
posts_path
routing helper method, we must call the method on the routing proxy method that shares the same name as the engine.
<%=
link_to
"Blog posts"
, blorgh.posts_path
%>
If you wish to reference the application inside the engine in a similar way, use the
main_app
helper:
<%=
link_to
"Home"
, main_app.root_path
%>
Hope this helps
To view this discussion on the web visit https://groups.google.com/d/msgid/rspec/CAJGQ%3DvZYW4OncHFjXBjzckHqGNwZP6fCbjEPhyKbR%3DyzaZwHDA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rspec/B09E5A00-82AA-4957-9D0E-4FE4AA0E5089%40gmail.com.