Permalink
Browse files

Fix path to iframe being wrong when mounted as an engine

Mounting the engine at "/konacha" would still reference the iframes at
"/iframe/…" instead of "/konacha/iframe/…".
  • Loading branch information...
1 parent ff3cabf commit 43731a497c43aabcd65981ce369a97c0818563cd @Burgestrand Burgestrand committed with Dec 4, 2012
Showing with 4 additions and 2 deletions.
  1. +1 −1 app/views/konacha/specs/parent.html.erb
  2. +1 −1 config/routes.rb
  3. +2 −0 spec/views/specs/parent.html.erb_spec.rb
View
2 app/views/konacha/specs/parent.html.erb
@@ -9,7 +9,7 @@
</head>
<body>
<% @specs.each do |spec| %>
- <%= content_tag :iframe, "", :src => "/iframe/#{spec.asset_name}", :class => "test-context", "data-path" => spec.path %>
+ <%= content_tag :iframe, "", :src => iframe_path(spec.asset_name), :class => "test-context", "data-path" => spec.path %>
<% end %>
<div id="mocha"></div>
</body>
View
2 config/routes.rb
@@ -1,5 +1,5 @@
Konacha::Engine.routes.draw do
- get '/iframe/*name' => 'specs#iframe'
+ get '/iframe/*name' => 'specs#iframe', :as => :iframe
get '/' => 'specs#parent'
get '*path' => 'specs#parent'
end
View
2 spec/views/specs/parent.html.erb_spec.rb
@@ -6,6 +6,8 @@ def spec_double(asset_name)
end
it "renders an iframe tag for a spec" do
+ view.singleton_class.send(:include, Konacha::Engine.routes.url_helpers)
+
spec = spec_double("a_spec")
assign(:specs, [spec])

0 comments on commit 43731a4

Please sign in to comment.