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.
- data/Gemfile +5 -3
- data/Gemfile.lock +34 -8
- data/README.rdoc +76 -63
- data/Rakefile +3 -1
- data/VERSION +1 -1
- data/app/controllers/ajax_controller.rb +6 -0
- data/init.rb +6 -0
- data/lib/ajax.rb +13 -24
- data/lib/ajax/action_controller.rb +120 -65
- data/lib/ajax/application.rb +62 -0
- data/lib/ajax/helpers/request_helper.rb +2 -2
- data/lib/ajax/helpers/task_helper.rb +2 -2
- data/lib/ajax/railtie.rb +25 -1
- data/lib/ajax/routes.rb +7 -3
- data/lib/ajax/rspec.rb +2 -0
- data/lib/ajax/{spec → rspec}/extension.rb +4 -11
- data/lib/ajax/{spec → rspec}/helpers.rb +10 -10
- data/lib/ajax/rspec/integration.rb +24 -0
- data/lib/rack-ajax.rb +1 -1
- data/lib/rack-ajax/parser.rb +2 -2
- data/public/javascripts/{jquery.address-1.2rc.js → jquery.address-1.3.js} +340 -197
- data/public/javascripts/jquery.address-1.3.min.js +32 -0
- data/rails/init.rb +1 -4
- data/rails/install.rb +1 -1
- data/rails/routes.rb +6 -0
- data/tasks/ajax_tasks.rake +11 -2
- metadata +41 -25
- data/app/views/ajax/_redirect_with_fragment.html.erb +0 -19
- data/public/javascripts/jquery.address-1.1.js +0 -450
- data/public/javascripts/jquery.address-1.1.min.js +0 -11
- data/public/javascripts/jquery.address-1.2.js +0 -528
- data/public/javascripts/jquery.address-1.2.min.js +0 -25
- data/public/javascripts/jquery.address-1.2rc.min.js +0 -27
- data/rails/uninstall.rb +0 -1
- data/spec/ajax/ajax_spec.rb +0 -23
- data/spec/ajax/helpers_spec.rb +0 -121
- data/spec/ajax/request_helper_spec.rb +0 -52
- data/spec/ajax/tasks_spec.rb +0 -48
- data/spec/integration/ajax_spec.rb +0 -146
- data/spec/rack-ajax/parser_spec.rb +0 -62
- data/spec/spec.opts +0 -1
- data/spec/spec_helper.rb +0 -17
- data/spec/support/file_macros.rb +0 -28
- data/spec/support/query_count.rb +0 -0
- 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
|
data/spec/spec.opts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--color
|
data/spec/spec_helper.rb
DELETED
@@ -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
|
data/spec/support/file_macros.rb
DELETED
@@ -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
|
data/spec/support/query_count.rb
DELETED
File without changes
|