Permalink
Browse files

Added Dummy application for tests

  • Loading branch information...
igor-alexandrov committed Dec 23, 2012
1 parent a43bcf2 commit 15c8a21fc60a05f29566e206eee5197f36aad50d
Showing with 81,088 additions and 24 deletions.
  1. +7 −0 Gemfile
  2. +71 −0 Gemfile.lock
  3. +29 −4 README.md
  4. +1 −1 Rakefile
  5. +1 −1 lib/assets/javascripts/wiselinks.js.coffee
  6. +35 −0 test/cases/application_controller_test.rb
  7. +261 −0 test/dummy/README.rdoc
  8. +7 −0 test/dummy/Rakefile
  9. +15 −0 test/dummy/app/assets/javascripts/application.js
  10. +1 −0 test/dummy/app/assets/javascripts/wisepdf.js
  11. +13 −0 test/dummy/app/assets/stylesheets/application.css
  12. +1 −0 test/dummy/app/assets/stylesheets/wisepdf.css
  13. +7 −0 test/dummy/app/controllers/application_controller.rb
  14. +2 −0 test/dummy/app/helpers/application_helper.rb
  15. 0 test/dummy/app/mailers/.gitkeep
  16. 0 test/dummy/app/models/.gitkeep
  17. +1 −0 test/dummy/app/views/application/index.pdf.erb
  18. +14 −0 test/dummy/app/views/layouts/application.html.erb
  19. +14 −0 test/dummy/app/views/layouts/pdf.html.erb
  20. +4 −0 test/dummy/config.ru
  21. +57 −0 test/dummy/config/application.rb
  22. +10 −0 test/dummy/config/boot.rb
  23. +7 −0 test/dummy/config/database.yml
  24. +5 −0 test/dummy/config/environment.rb
  25. +37 −0 test/dummy/config/environments/development.rb
  26. +67 −0 test/dummy/config/environments/production.rb
  27. +37 −0 test/dummy/config/environments/test.rb
  28. +7 −0 test/dummy/config/initializers/backtrace_silencers.rb
  29. +15 −0 test/dummy/config/initializers/inflections.rb
  30. +5 −0 test/dummy/config/initializers/mime_types.rb
  31. +7 −0 test/dummy/config/initializers/secret_token.rb
  32. +8 −0 test/dummy/config/initializers/session_store.rb
  33. +14 −0 test/dummy/config/initializers/wrap_parameters.rb
  34. +5 −0 test/dummy/config/locales/en.yml
  35. +3 −0 test/dummy/config/routes.rb
  36. 0 test/dummy/lib/assets/.gitkeep
  37. 0 test/dummy/log/.gitkeep
  38. +27,917 −0 test/dummy/log/development.log
  39. +52,308 −0 test/dummy/log/test.log
  40. +26 −0 test/dummy/public/404.html
  41. +26 −0 test/dummy/public/422.html
  42. +25 −0 test/dummy/public/500.html
  43. 0 test/dummy/public/favicon.ico
  44. +1 −0 test/dummy/public/javascripts/wisepdf.js
  45. +1 −0 test/dummy/public/stylesheets/wisepdf.css
  46. +6 −0 test/dummy/script/rails
  47. BIN test/dummy/tmp/cache/assets/CA9/590/sprockets%2F260d19b0714b39b217abfe83309458b7
  48. BIN test/dummy/tmp/cache/assets/D13/4A0/sprockets%2Fc857f4fea90e731182fa7000ea6833e9
  49. BIN test/dummy/tmp/cache/assets/D1C/0F0/sprockets%2F13dc05c787589dd73a669e0ad23d54e8
  50. BIN test/dummy/tmp/cache/assets/D6E/B20/sprockets%2F2669d77f5dd55e82ba092accac21871a
  51. BIN test/dummy/tmp/cache/assets/D93/BA0/sprockets%2Fe162e2a148480db4edf41c7ca8a527cb
  52. BIN test/dummy/tmp/cache/assets/E1B/1A0/sprockets%2Fbdc3a3ccd7d2f02dddd41712ed4c8e31
  53. +7 −11 test/helper.rb
  54. +0 −7 test/test_wiselinks.rb
  55. +3 −0 travis.yml
View
@@ -6,3 +6,10 @@ group :development do
gem "bundler"
gem "jeweler"
end
+
+group :test do
+ gem 'sqlite3'
+ gem "shoulda", ">= 0"
+
+ gem 'rails', '>= 3.2.0'
+end
View
@@ -1,23 +1,80 @@
GEM
remote: http://rubygems.org/
specs:
+ actionmailer (3.2.9)
+ actionpack (= 3.2.9)
+ mail (~> 2.4.4)
+ actionpack (3.2.9)
+ activemodel (= 3.2.9)
+ activesupport (= 3.2.9)
+ builder (~> 3.0.0)
+ erubis (~> 2.7.0)
+ journey (~> 1.0.4)
+ rack (~> 1.4.0)
+ rack-cache (~> 1.2)
+ rack-test (~> 0.6.1)
+ sprockets (~> 2.2.1)
+ activemodel (3.2.9)
+ activesupport (= 3.2.9)
+ builder (~> 3.0.0)
+ activerecord (3.2.9)
+ activemodel (= 3.2.9)
+ activesupport (= 3.2.9)
+ arel (~> 3.0.2)
+ tzinfo (~> 0.3.29)
+ activeresource (3.2.9)
+ activemodel (= 3.2.9)
+ activesupport (= 3.2.9)
activesupport (3.2.9)
i18n (~> 0.6)
multi_json (~> 1.0)
+ arel (3.0.2)
bourne (1.1.2)
mocha (= 0.10.5)
+ builder (3.0.4)
+ erubis (2.7.0)
git (1.2.5)
+ hike (1.2.1)
i18n (0.6.1)
jeweler (1.8.4)
bundler (~> 1.0)
git (>= 1.2.5)
rake
rdoc
+ journey (1.0.4)
json (1.7.5)
+ mail (2.4.4)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
metaclass (0.0.1)
+ mime-types (1.19)
mocha (0.10.5)
metaclass (~> 0.0.1)
multi_json (1.5.0)
+ polyglot (0.3.3)
+ rack (1.4.1)
+ rack-cache (1.2)
+ rack (>= 0.4)
+ rack-ssl (1.3.2)
+ rack
+ rack-test (0.6.2)
+ rack (>= 1.0)
+ rails (3.2.9)
+ actionmailer (= 3.2.9)
+ actionpack (= 3.2.9)
+ activerecord (= 3.2.9)
+ activeresource (= 3.2.9)
+ activesupport (= 3.2.9)
+ bundler (~> 1.0)
+ railties (= 3.2.9)
+ railties (3.2.9)
+ actionpack (= 3.2.9)
+ activesupport (= 3.2.9)
+ rack-ssl (~> 1.3.2)
+ rake (>= 0.8.7)
+ rdoc (~> 3.4)
+ thor (>= 0.14.6, < 2.0)
rake (10.0.3)
rdoc (3.12)
json (~> 1.4)
@@ -28,12 +85,26 @@ GEM
shoulda-matchers (1.4.2)
activesupport (>= 3.0.0)
bourne (~> 1.1.2)
+ sprockets (2.2.2)
+ hike (~> 1.2)
+ multi_json (~> 1.0)
+ rack (~> 1.0)
+ tilt (~> 1.1, != 1.3.0)
+ sqlite3 (1.3.6)
+ thor (0.16.0)
+ tilt (1.3.3)
+ treetop (1.4.12)
+ polyglot
+ polyglot (>= 0.3.1)
+ tzinfo (0.3.35)
PLATFORMS
ruby
DEPENDENCIES
bundler
jeweler
+ rails (>= 3.2.0)
rdoc (~> 3.12)
shoulda
+ sqlite3
View
@@ -1,3 +1,7 @@
+[![Build Status](https://travis-ci.org/igor-alexandrov/wiselinks.png?branch=master)](https://travis-ci.org/igor-alexandrov/wiselinks)
+[![Dependency Status](https://gemnasium.com/igor-alexandrov/wiselinks.png)](https://gemnasium.com/igor-alexandrov/wiselinks)
+[![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/igor-alexandrov/wiselinks)
+
#Wiselinks
Wiselinks makes following links and submitting some forms in your web application faster.
@@ -22,17 +26,17 @@ Wiselinks works in all major browsers including browsers that do not support HTM
</thead>
<tbody>
<tr>
- <td>Browsers with History API</td>
+ <td>Work in browsers with History API</td>
<td>Yes</td>
<td><strong>Yes</strong></td>
</tr>
<tr>
- <td>Browsers without History API</td>
+ <td>Work in browsers without History API</td>
<td>No, degrades to normal request processing.</td>
<td><strong>Yes</strong></td>
</tr>
<tr>
- <td>No JavaScript</td>
+ <td>Work without JavaScript</td>
<td>No, degrades to normal request processing.</td>
<td>No, degrades to normal request processing.</td>
</tr>
@@ -46,6 +50,11 @@ Wiselinks works in all major browsers including browsers that do not support HTM
<td>No</td>
<td><strong>Yes</strong></td>
</tr>
+ <tr>
+ <td>Asset change detection</td>
+ <td>Yes, by parsing document head on every request.</td>
+ <td><strong>Yes</strong>, by calculating assets MD5 hash on boot.</td>
+ </tr>
</tbody>
</table>
@@ -221,7 +230,9 @@ Event is triggered if the request fails.
* *status* – a string describing the type of error that occurred;
* *error* – optional exception object, if one occurred;
-## Request methods
+So if you wanted to have a client-side spinner, you could listen for `page:loading` to start it and `page:success` or `page:error` to stop it.
+
+## ActionDispatch::Request extensions
Wiselinks adds a couple of methods to `ActionDispatch::Request`. These methods are mostly syntax sugar and don't have any complex logic, so you can use them or not.
@@ -234,6 +245,20 @@ Method returns `true` if current request is initiated by Wiselinks and client wa
### #wiselinks_partial? ###
Method returns `true` if current request is initiated by Wiselinks and client want to render partial, `false` otherwise.
+## Title handling
+
+Wiselinks handles page titles by passing `X-Title` header with response. To do this you can use `wiselinks_title` helper.
+
+```html
+<% wiselinks_title("Wiselinks is awesome") %>
+
+<div>
+ <!-- your content -->
+ ...
+</div>
+```
+
+Of course you can use `wiselinks_title` helper in your own helpers too.
##Example
View
@@ -26,7 +26,7 @@ Jeweler::RubygemsDotOrgTasks.new
require 'rake/testtask'
Rake::TestTask.new(:test) do |test|
test.libs << 'lib' << 'test'
- test.pattern = 'test/**/test_*.rb'
+ test.pattern = 'test/**/*_test.rb'
test.verbose = true
end
@@ -5,7 +5,7 @@ String.prototype.ends_with = (suffix) ->
class Wiselinks
constructor: (@$target = $('body'), options = {}) ->
- # check that JQuery or Zepto.js are available
+ # Check that JQuery is available
throw "Load JQuery to use Wiselinks" unless window.jQuery?
self = this
@@ -0,0 +1,35 @@
+require 'helper'
+
+class ApplicationControllerTest < ActionController::TestCase
+ tests ApplicationController
+
+ context "Request" do
+ setup do
+ @request = @controller.request
+ end
+
+ should "respond to #wiselinks?" do
+ assert_respond_to @request, :wiselinks?
+ end
+
+ should "respond to #wiselinks_partial?" do
+ assert_respond_to @request, :wiselinks_partial?
+ end
+
+ should "respond to #wiselinks_template?" do
+ assert_respond_to @request, :wiselinks_template?
+ end
+ end
+
+ context "Layout" do
+ should "respond to #wiselinks_layout" do
+ assert_respond_to @controller, :wiselinks_layout
+ end
+ end
+
+ context "Title" do
+ should "respond to #wiselinks_title" do
+ assert_respond_to @controller, :wiselinks_title
+ end
+ end
+end
Oops, something went wrong.

0 comments on commit 15c8a21

Please sign in to comment.