ajax 1.0.8 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. data/Gemfile +5 -3
  2. data/Gemfile.lock +34 -8
  3. data/README.rdoc +76 -63
  4. data/Rakefile +3 -1
  5. data/VERSION +1 -1
  6. data/app/controllers/ajax_controller.rb +6 -0
  7. data/init.rb +6 -0
  8. data/lib/ajax.rb +13 -24
  9. data/lib/ajax/action_controller.rb +120 -65
  10. data/lib/ajax/application.rb +62 -0
  11. data/lib/ajax/helpers/request_helper.rb +2 -2
  12. data/lib/ajax/helpers/task_helper.rb +2 -2
  13. data/lib/ajax/railtie.rb +25 -1
  14. data/lib/ajax/routes.rb +7 -3
  15. data/lib/ajax/rspec.rb +2 -0
  16. data/lib/ajax/{spec → rspec}/extension.rb +4 -11
  17. data/lib/ajax/{spec → rspec}/helpers.rb +10 -10
  18. data/lib/ajax/rspec/integration.rb +24 -0
  19. data/lib/rack-ajax.rb +1 -1
  20. data/lib/rack-ajax/parser.rb +2 -2
  21. data/public/javascripts/{jquery.address-1.2rc.js → jquery.address-1.3.js} +340 -197
  22. data/public/javascripts/jquery.address-1.3.min.js +32 -0
  23. data/rails/init.rb +1 -4
  24. data/rails/install.rb +1 -1
  25. data/rails/routes.rb +6 -0
  26. data/tasks/ajax_tasks.rake +11 -2
  27. metadata +41 -25
  28. data/app/views/ajax/_redirect_with_fragment.html.erb +0 -19
  29. data/public/javascripts/jquery.address-1.1.js +0 -450
  30. data/public/javascripts/jquery.address-1.1.min.js +0 -11
  31. data/public/javascripts/jquery.address-1.2.js +0 -528
  32. data/public/javascripts/jquery.address-1.2.min.js +0 -25
  33. data/public/javascripts/jquery.address-1.2rc.min.js +0 -27
  34. data/rails/uninstall.rb +0 -1
  35. data/spec/ajax/ajax_spec.rb +0 -23
  36. data/spec/ajax/helpers_spec.rb +0 -121
  37. data/spec/ajax/request_helper_spec.rb +0 -52
  38. data/spec/ajax/tasks_spec.rb +0 -48
  39. data/spec/integration/ajax_spec.rb +0 -146
  40. data/spec/rack-ajax/parser_spec.rb +0 -62
  41. data/spec/spec.opts +0 -1
  42. data/spec/spec_helper.rb +0 -17
  43. data/spec/support/file_macros.rb +0 -28
  44. data/spec/support/query_count.rb +0 -0
  45. data/spec/support/response_helpers.rb +0 -7
@@ -1,62 +0,0 @@
1
- # Test Rack middleware using integration tests because the Spec controller tests
2
- # do not invoke Rack.
3
- require 'spec_helper'
4
- require 'ajax/spec/helpers'
5
- require 'uri'
6
-
7
- include Ajax::Spec::Helpers
8
-
9
- # Test the Rack::Ajax::Parser. See <tt>lib/rack-ajax-parser.rb</tt>
10
- #
11
- # Test Rack middleware using integration tests because the Spec controller tests
12
- # do not invoke Rack.
13
- describe Rack::Ajax::Parser, :type => :integration do
14
- before :all do
15
- mock_ajax
16
- create_app
17
- end
18
-
19
- it "should recognize robots" do
20
- call_rack('/', 'GET', { 'HTTP_USER_AGENT' => 'Googlebot' }) do
21
- rack_response(user_is_robot?)
22
- end
23
- should_set_ajax_request_header('robot', true)
24
- end
25
-
26
- it "should recognize regular users" do
27
- call_rack('/', { 'HTTP_USER_AGENT' => 'Safari' }) do
28
- rack_response(user_is_robot?)
29
- end
30
- should_set_ajax_request_header('robot', false)
31
- end
32
-
33
- it "should be able to tell if a url is root" do
34
- call_rack('/') { rack_response(url_is_root?) }
35
- should_respond_with('true')
36
-
37
- call_rack('/Beyonce') { rack_response(url_is_root?) }
38
- should_respond_with('false')
39
-
40
- call_rack('/#/Beyonce?query2') { rack_response(url_is_root?) }
41
- should_respond_with('true')
42
- end
43
-
44
- it "should redirect to hashed url from fragment" do
45
- call_rack('/Beyonce?page=1#/Akon') do
46
- redirect_to_hashed_url_from_fragment
47
- end
48
- should_redirect_to('/#/Akon', 302)
49
- end
50
-
51
- it "should rewrite to traditional url from fragment" do
52
- call_rack('/Beyonce?page=1#/Akon?query2') do
53
- rewrite_to_traditional_url_from_fragment
54
- end
55
- should_rewrite_to('/Akon?query2')
56
- end
57
-
58
- it "should return a valid rack response" do
59
- call_rack('/') { rack_response('test') }
60
- should_respond_with('test')
61
- end
62
- end
@@ -1 +0,0 @@
1
- --color
@@ -1,17 +0,0 @@
1
- require 'bundler/setup'
2
- Bundler.require
3
-
4
- require 'spec/autorun'
5
- require 'ajax/spec/extension'
6
-
7
- $: << File.join(File.dirname(__FILE__), '..', 'lib')
8
- require File.join(File.dirname(__FILE__), '..', 'rails', 'init')
9
-
10
- # Requires supporting files with custom matchers and macros, etc,
11
- # in ./support/ and its subdirectories.
12
- Dir[File.expand_path(File.join(File.dirname(__FILE__),'support','**','*.rb'))].each {|f| require f}
13
-
14
- Spec::Runner.configure do |config|
15
- include Ajax::Spec::Extension
16
- config.include(FileMacros)
17
- end
@@ -1,28 +0,0 @@
1
- module FileMacros
2
- module ExampleMethods
3
-
4
- def files_should_be_identical(first, second)
5
- identical_files?(first, second).should be(true)
6
- end
7
-
8
- def files_should_not_be_identical(first, second)
9
- identical_files?(first, second).should be(false)
10
- end
11
-
12
- def file_should_exist(file)
13
- File.exists?(file).should be(true)
14
- end
15
-
16
- def file_should_not_exist(file)
17
- File.exists?(file).should be(false)
18
- end
19
-
20
- def identical_files?(first, second)
21
- open(second, 'r').read.should == open(first, 'r').read
22
- end
23
- end
24
-
25
- def self.included(receiver)
26
- receiver.send :include, ExampleMethods
27
- end
28
- end
File without changes
@@ -1,7 +0,0 @@
1
- module ResponseHelpers
2
- def should_redirect_to(location, code=302)
3
- should_be_a_valid_response
4
- response_code.should == code
5
- response_headers['Location'].should == location
6
- end
7
- end