Skip to content

Commit

Permalink
Support for testing against a specified jQuery version
Browse files Browse the repository at this point in the history
  • Loading branch information
mislav committed May 19, 2017
1 parent 77babd2 commit ba3e362
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions test/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
set :public_folder, File.dirname(settings.root)
enable :static

jquery_version = '3.2'

helpers do
def pjax?
env['HTTP_X_PJAX'] && !params[:layout]
Expand All @@ -17,6 +19,10 @@ def title(str)
nil
end
end

define_method(:jquery_version) do
jquery_version
end
end

after do
Expand All @@ -28,6 +34,7 @@ def title(str)


get '/' do
jquery_version = params[:jquery] if params[:jquery]
erb :qunit
end

Expand Down
2 changes: 1 addition & 1 deletion test/views/layout.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<title><%= @title %></title>
<script type="text/javascript" src="/vendor/jquery-3.2.js"></script>
<script type="text/javascript" src="/vendor/jquery-<%= jquery_version %>.js"></script>
<script type="text/javascript" src="/jquery.pjax.js"></script>
</head>
<body>
Expand Down
2 changes: 1 addition & 1 deletion test/views/qunit.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<link rel="stylesheet" href="/vendor/qunit.css">
<meta name="viewport" content="initial-scale=1.0,width=device-width">

<script type="text/javascript" src="/vendor/jquery-3.2.js"></script>
<script type="text/javascript" src="/vendor/jquery-<%= jquery_version %>.js"></script>
<script type="text/javascript" src="/vendor/qunit.js"></script>
<script type="text/javascript">QUnit.config.testTimeout = 10000</script>
<script type="text/javascript" src="/jquery.pjax.js"></script>
Expand Down

0 comments on commit ba3e362

Please sign in to comment.