Skip to content
This repository has been archived by the owner on Oct 19, 2018. It is now read-only.

Commit

Permalink
closes #12
Browse files Browse the repository at this point in the history
  • Loading branch information
catmando committed Mar 22, 2018
1 parent d1cca4f commit f3d57f7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
File renamed without changes.
11 changes: 6 additions & 5 deletions lib/hyper-spec/component_test_helpers.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# see component_test_helpers_spec.rb for examples

require 'parser/current'
require 'unparser'
require 'method_source'
require_relative '../../vendor/assets/javascripts/time_cop' # 'hyper-spec/time_cop'
require_relative '../../lib/assets/javascripts/time_cop.js.rb'

module HyperSpec
module ComponentTestHelpers
Expand Down Expand Up @@ -50,9 +49,11 @@ def build_test_url_for(controller)
page = "<script type='text/javascript'>\n#{TOP_LEVEL_COMPONENT_PATCH}\n</script>\n#{page}"

page = "<script type='text/javascript'>\n#{code}\n</script>\n#{page}" if code

page = "<%= javascript_include_tag 'time_cop' %>\n#{page}" if render_on != :server_only || Lolex.initialized?

if render_on != :server_only || Lolex.initialized?
page = "<script type='text/javascript'>\n"\
"<%= Rails.application.assets['time_cop.js'].source.html_safe %>\n"\
"</script>\n#{page}"
end
if (render_on != :server_only && !render_params[:layout]) || javascript
page = "<%= javascript_include_tag '#{javascript || 'application'}' %>\n#{page}"
end
Expand Down

0 comments on commit f3d57f7

Please sign in to comment.