paloma 4.2.1 → 6.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/app/views/paloma/_hook.html.erb +10 -13
- data/lib/paloma/action_controller_extension.rb +4 -4
- data/lib/paloma/controller.rb +13 -4
- data/lib/paloma/test_helper.rb +7 -0
- data/vendor/assets/javascripts/paloma/base_controller.js +8 -0
- data/vendor/assets/javascripts/paloma/before_callback_performer.js +69 -0
- data/vendor/assets/javascripts/paloma/controller_builder.js +36 -0
- data/vendor/assets/javascripts/paloma/controller_class_factory.js +62 -0
- data/vendor/assets/javascripts/paloma/engine.js +59 -53
- data/vendor/assets/javascripts/paloma/index.js +5 -4
- data/vendor/assets/javascripts/paloma/init.js +5 -10
- data/vendor/assets/javascripts/paloma/paloma.js +20 -21
- metadata +18 -88
- data/.gitignore +0 -5
- data/Changelog.md +0 -42
- data/DEVELOPMENT.md +0 -15
- data/Gemfile +0 -2
- data/License +0 -22
- data/README.md +0 -353
- data/TODO.md +0 -1
- data/paloma.gemspec +0 -22
- data/test_app/.gitignore +0 -15
- data/test_app/.rspec +0 -1
- data/test_app/Gemfile +0 -5
- data/test_app/README.rdoc +0 -261
- data/test_app/Rakefile +0 -11
- data/test_app/app/assets/images/rails.png +0 -0
- data/test_app/app/assets/javascripts/admin/bar.js +0 -2
- data/test_app/app/assets/javascripts/application.js +0 -68
- data/test_app/app/assets/stylesheets/admin/bar.css +0 -4
- data/test_app/app/assets/stylesheets/application.css +0 -13
- data/test_app/app/assets/stylesheets/foo.css +0 -4
- data/test_app/app/assets/stylesheets/main.css +0 -4
- data/test_app/app/assets/stylesheets/multiple_names.css +0 -4
- data/test_app/app/controllers/admin/foos_controller.rb +0 -29
- data/test_app/app/controllers/application_controller.rb +0 -3
- data/test_app/app/controllers/main_controller.rb +0 -111
- data/test_app/app/helpers/admin/bar_helper.rb +0 -2
- data/test_app/app/helpers/application_helper.rb +0 -2
- data/test_app/app/helpers/foo_helper.rb +0 -2
- data/test_app/app/helpers/main_helper.rb +0 -2
- data/test_app/app/helpers/multiple_names_helper.rb +0 -2
- data/test_app/app/mailers/.gitkeep +0 -0
- data/test_app/app/models/.gitkeep +0 -0
- data/test_app/app/views/layouts/application.html.erb +0 -40
- data/test_app/app/views/main/ajax.html.erb +0 -2
- data/test_app/config.ru +0 -4
- data/test_app/config/application.rb +0 -69
- data/test_app/config/boot.rb +0 -6
- data/test_app/config/environment.rb +0 -5
- data/test_app/config/environments/development.rb +0 -37
- data/test_app/config/environments/production.rb +0 -67
- data/test_app/config/environments/test.rb +0 -37
- data/test_app/config/initializers/backtrace_silencers.rb +0 -7
- data/test_app/config/initializers/inflections.rb +0 -15
- data/test_app/config/initializers/mime_types.rb +0 -5
- data/test_app/config/initializers/secret_token.rb +0 -7
- data/test_app/config/initializers/session_store.rb +0 -8
- data/test_app/config/initializers/wrap_parameters.rb +0 -14
- data/test_app/config/locales/en.yml +0 -5
- data/test_app/config/routes.rb +0 -28
- data/test_app/db/seeds.rb +0 -7
- data/test_app/doc/README_FOR_APP +0 -2
- data/test_app/lib/assets/.gitkeep +0 -0
- data/test_app/lib/tasks/.gitkeep +0 -0
- data/test_app/log/.gitkeep +0 -0
- data/test_app/public/404.html +0 -26
- data/test_app/public/422.html +0 -26
- data/test_app/public/500.html +0 -25
- data/test_app/public/favicon.ico +0 -0
- data/test_app/public/robots.txt +0 -5
- data/test_app/script/rails +0 -6
- data/test_app/spec/integration/advanced_spec.rb +0 -64
- data/test_app/spec/integration/basic_spec.rb +0 -195
- data/test_app/spec/javascripts/controller_factory_spec.js +0 -48
- data/test_app/spec/javascripts/router_spec.js +0 -52
- data/test_app/spec/javascripts/support/jasmine.yml +0 -20
- data/test_app/spec/spec_helper.rb +0 -37
- data/test_app/spec/units/controller_spec.rb +0 -109
- data/test_app/spec/units/utilities_spec.rb +0 -114
- data/test_app/test/fixtures/.gitkeep +0 -0
- data/test_app/test/functional/.gitkeep +0 -0
- data/test_app/test/integration/.gitkeep +0 -0
- data/test_app/test/performance/browsing_test.rb +0 -12
- data/test_app/test/test_helper.rb +0 -13
- data/test_app/test/unit/.gitkeep +0 -0
- data/test_app/vendor/assets/javascripts/.gitkeep +0 -0
- data/test_app/vendor/assets/stylesheets/.gitkeep +0 -0
- data/test_app/vendor/plugins/.gitkeep +0 -0
- data/vendor/assets/javascripts/paloma/controller.js +0 -10
- data/vendor/assets/javascripts/paloma/controller_factory.js +0 -55
- data/vendor/assets/javascripts/paloma/router.js +0 -23
@@ -1,7 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# Your secret key for verifying the integrity of signed cookies.
|
4
|
-
# If you change this key, all old signed cookies will become invalid!
|
5
|
-
# Make sure the secret is at least 30 characters and all random,
|
6
|
-
# no regular words or you'll be exposed to dictionary attacks.
|
7
|
-
TestApp::Application.config.secret_token = '0bf46521767b4f6b133f6465e3b380a8cc29cc6823770680aad8b6c34d1bce73b0aa7582d4988e2018762e90ab968e7d49477b78d197c6b7b523de6938fba964'
|
@@ -1,8 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
TestApp::Application.config.session_store :cookie_store, key: '_test_app_session'
|
4
|
-
|
5
|
-
# Use the database for sessions instead of the cookie-based default,
|
6
|
-
# which shouldn't be used to store highly confidential information
|
7
|
-
# (create the session table with "rails generate session_migration")
|
8
|
-
# TestApp::Application.config.session_store :active_record_store
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
#
|
3
|
-
# This file contains settings for ActionController::ParamsWrapper which
|
4
|
-
# is enabled by default.
|
5
|
-
|
6
|
-
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
|
-
ActiveSupport.on_load(:action_controller) do
|
8
|
-
wrap_parameters format: [:json]
|
9
|
-
end
|
10
|
-
|
11
|
-
# Disable root element in JSON by default.
|
12
|
-
ActiveSupport.on_load(:active_record) do
|
13
|
-
self.include_root_in_json = false
|
14
|
-
end
|
data/test_app/config/routes.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
TestApp::Application.routes.draw do
|
2
|
-
|
3
|
-
mount JasmineRails::Engine => "/specs" if defined?(JasmineRails)
|
4
|
-
|
5
|
-
root :to => 'main#index'
|
6
|
-
|
7
|
-
resources :main, :controller => 'Main' do
|
8
|
-
collection do
|
9
|
-
get :prevent
|
10
|
-
get :basic_params
|
11
|
-
get :json_response
|
12
|
-
get :js_response
|
13
|
-
get :xml_response
|
14
|
-
get :file_response
|
15
|
-
get :ajax
|
16
|
-
get :multiple_calls_1
|
17
|
-
get :multiple_calls_2
|
18
|
-
get :multiple_calls_3
|
19
|
-
get :multiple_calls_4
|
20
|
-
get :multiple_calls_5
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
|
25
|
-
namespace :admin do
|
26
|
-
resources :foos
|
27
|
-
end
|
28
|
-
end
|
data/test_app/db/seeds.rb
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
# This file should contain all the record creation needed to seed the database with its default values.
|
2
|
-
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
|
3
|
-
#
|
4
|
-
# Examples:
|
5
|
-
#
|
6
|
-
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
|
7
|
-
# Mayor.create(name: 'Emanuel', city: cities.first)
|
data/test_app/doc/README_FOR_APP
DELETED
File without changes
|
data/test_app/lib/tasks/.gitkeep
DELETED
File without changes
|
data/test_app/log/.gitkeep
DELETED
File without changes
|
data/test_app/public/404.html
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
-
<style type="text/css">
|
6
|
-
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
-
div.dialog {
|
8
|
-
width: 25em;
|
9
|
-
padding: 0 4em;
|
10
|
-
margin: 4em auto 0 auto;
|
11
|
-
border: 1px solid #ccc;
|
12
|
-
border-right-color: #999;
|
13
|
-
border-bottom-color: #999;
|
14
|
-
}
|
15
|
-
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
-
</style>
|
17
|
-
</head>
|
18
|
-
|
19
|
-
<body>
|
20
|
-
<!-- This file lives in public/404.html -->
|
21
|
-
<div class="dialog">
|
22
|
-
<h1>The page you were looking for doesn't exist.</h1>
|
23
|
-
<p>You may have mistyped the address or the page may have moved.</p>
|
24
|
-
</div>
|
25
|
-
</body>
|
26
|
-
</html>
|
data/test_app/public/422.html
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>The change you wanted was rejected (422)</title>
|
5
|
-
<style type="text/css">
|
6
|
-
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
-
div.dialog {
|
8
|
-
width: 25em;
|
9
|
-
padding: 0 4em;
|
10
|
-
margin: 4em auto 0 auto;
|
11
|
-
border: 1px solid #ccc;
|
12
|
-
border-right-color: #999;
|
13
|
-
border-bottom-color: #999;
|
14
|
-
}
|
15
|
-
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
-
</style>
|
17
|
-
</head>
|
18
|
-
|
19
|
-
<body>
|
20
|
-
<!-- This file lives in public/422.html -->
|
21
|
-
<div class="dialog">
|
22
|
-
<h1>The change you wanted was rejected.</h1>
|
23
|
-
<p>Maybe you tried to change something you didn't have access to.</p>
|
24
|
-
</div>
|
25
|
-
</body>
|
26
|
-
</html>
|
data/test_app/public/500.html
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>We're sorry, but something went wrong (500)</title>
|
5
|
-
<style type="text/css">
|
6
|
-
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
-
div.dialog {
|
8
|
-
width: 25em;
|
9
|
-
padding: 0 4em;
|
10
|
-
margin: 4em auto 0 auto;
|
11
|
-
border: 1px solid #ccc;
|
12
|
-
border-right-color: #999;
|
13
|
-
border-bottom-color: #999;
|
14
|
-
}
|
15
|
-
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
-
</style>
|
17
|
-
</head>
|
18
|
-
|
19
|
-
<body>
|
20
|
-
<!-- This file lives in public/500.html -->
|
21
|
-
<div class="dialog">
|
22
|
-
<h1>We're sorry, but something went wrong.</h1>
|
23
|
-
</div>
|
24
|
-
</body>
|
25
|
-
</html>
|
data/test_app/public/favicon.ico
DELETED
File without changes
|
data/test_app/public/robots.txt
DELETED
data/test_app/script/rails
DELETED
@@ -1,6 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
-
|
4
|
-
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
5
|
-
require File.expand_path('../../config/boot', __FILE__)
|
6
|
-
require 'rails/commands'
|
@@ -1,64 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# All examples are using namespaces
|
6
|
-
#
|
7
|
-
#
|
8
|
-
|
9
|
-
feature 'executing Paloma controller', :js => true do
|
10
|
-
|
11
|
-
|
12
|
-
context 'default behavior' do
|
13
|
-
it 'executes the same namespace/controller/action' do
|
14
|
-
visit admin_foos_path
|
15
|
-
|
16
|
-
expect(
|
17
|
-
request['controller'] == 'Admin/Foos' &&
|
18
|
-
request['action'] == 'index' &&
|
19
|
-
request['params'] == {}
|
20
|
-
).to be_truthy
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
|
25
|
-
context 'override default controller' do
|
26
|
-
it 'executes the specified controller' do
|
27
|
-
visit admin_foo_path(1)
|
28
|
-
|
29
|
-
expect(
|
30
|
-
request['controller'] == 'NotAdmin/Foos' &&
|
31
|
-
request['action'] == 'show' &&
|
32
|
-
request['params'] == {'x' => 99}
|
33
|
-
).to be_truthy
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
|
38
|
-
context 'override default action' do
|
39
|
-
it 'executes the specified action' do
|
40
|
-
visit new_admin_foo_path
|
41
|
-
|
42
|
-
expect(
|
43
|
-
request['controller'] == 'Admin/Foos' &&
|
44
|
-
request['action'] == 'otherAction' &&
|
45
|
-
request['params'] == {'x' => 99}
|
46
|
-
).to be_truthy
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
|
51
|
-
context 'override default controller/action' do
|
52
|
-
it 'executes the specified controller/action' do
|
53
|
-
visit edit_admin_foo_path(1)
|
54
|
-
|
55
|
-
expect(
|
56
|
-
request['controller'] == 'NotAdmin/Foos' &&
|
57
|
-
request['action'] == 'otherAction' &&
|
58
|
-
request['params'] == {'x' => 99}
|
59
|
-
).to be_truthy
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
|
64
|
-
end
|
@@ -1,195 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# All examples are not using namespaces.
|
6
|
-
#
|
7
|
-
#
|
8
|
-
|
9
|
-
feature 'executing Paloma controller', :js => true do
|
10
|
-
|
11
|
-
#
|
12
|
-
#
|
13
|
-
# Basic
|
14
|
-
# All except for basic_params and index action will pass :x => 1 parameter
|
15
|
-
#
|
16
|
-
#
|
17
|
-
|
18
|
-
context 'default behavior' do
|
19
|
-
it 'executes the same controller/action' do
|
20
|
-
visit main_index_path
|
21
|
-
|
22
|
-
expect(
|
23
|
-
request['controller'] == 'Main' &&
|
24
|
-
request['action'] == 'index' &&
|
25
|
-
request['params'] == {}
|
26
|
-
).to be_truthy
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
|
31
|
-
context 'override default controller' do
|
32
|
-
it 'executes the specified controller' do
|
33
|
-
visit main_path(1)
|
34
|
-
|
35
|
-
expect(
|
36
|
-
request['controller'] == 'OtherMain' &&
|
37
|
-
request['action'] == 'show' &&
|
38
|
-
request['params'] == {'x' => 1}
|
39
|
-
).to be_truthy
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
|
44
|
-
context 'override default action' do
|
45
|
-
it 'executes the specified action' do
|
46
|
-
visit new_main_path
|
47
|
-
|
48
|
-
expect(
|
49
|
-
request['controller'] == 'Main' &&
|
50
|
-
request['action'] == 'otherAction' &&
|
51
|
-
request['params'] == {'x' => 1}
|
52
|
-
).to be_truthy
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
|
57
|
-
context 'override default controller/action' do
|
58
|
-
it 'executes the specified controller/action' do
|
59
|
-
visit edit_main_path(1)
|
60
|
-
|
61
|
-
expect(
|
62
|
-
request['controller'] == 'OtherMain' &&
|
63
|
-
request['action'] == 'otherAction' &&
|
64
|
-
request['params'] == {'x' => 1}
|
65
|
-
).to be_truthy
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
|
70
|
-
context 'parameter passed' do
|
71
|
-
it 'passes the parameter' do
|
72
|
-
visit basic_params_main_index_path
|
73
|
-
|
74
|
-
expect(request['params']).to eq({'x' => 1, 'y' => 2})
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
#
|
83
|
-
#
|
84
|
-
# Multiple Calls
|
85
|
-
#
|
86
|
-
#
|
87
|
-
|
88
|
-
context 'false at first then pass a parameter' do
|
89
|
-
it 'executes default controller#action plus the parameter' do
|
90
|
-
visit multiple_calls_1_main_index_path
|
91
|
-
|
92
|
-
expect(
|
93
|
-
request['controller'] == 'Main' &&
|
94
|
-
request['action'] == 'multiple_calls_1' &&
|
95
|
-
request['params'] == {'x' => 70}
|
96
|
-
).to be_truthy
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
|
101
|
-
context 'false at first then pass a controller string' do
|
102
|
-
it 'executes passed controller and default action' do
|
103
|
-
visit multiple_calls_2_main_index_path
|
104
|
-
|
105
|
-
expect(
|
106
|
-
request['controller'] == 'OtherMain' &&
|
107
|
-
request['action'] == 'multiple_calls_2'
|
108
|
-
).to be_truthy
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
|
113
|
-
context 'controller at first then action' do
|
114
|
-
it 'executes the controller and action' do
|
115
|
-
visit multiple_calls_3_main_index_path
|
116
|
-
|
117
|
-
expect(
|
118
|
-
request['controller'] == 'OtherMain' &&
|
119
|
-
request['action'] == 'show'
|
120
|
-
).to be_truthy
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
|
-
|
125
|
-
context 'controller#action at first then false' do
|
126
|
-
it 'does not execute any js' do
|
127
|
-
visit multiple_calls_4_main_index_path
|
128
|
-
expect(request).to be_nil
|
129
|
-
end
|
130
|
-
end
|
131
|
-
|
132
|
-
|
133
|
-
context 'false at first then true' do
|
134
|
-
it 'executes default controller#action' do
|
135
|
-
visit multiple_calls_5_main_index_path
|
136
|
-
|
137
|
-
expect(
|
138
|
-
request['controller'] == 'Main' &&
|
139
|
-
request['action'] == 'multiple_calls_5'
|
140
|
-
).to be_truthy
|
141
|
-
end
|
142
|
-
end
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
#
|
148
|
-
#
|
149
|
-
# Prevent Paloma
|
150
|
-
#
|
151
|
-
#
|
152
|
-
|
153
|
-
shared_examples 'no paloma' do
|
154
|
-
it 'does not add paloma hook' do
|
155
|
-
expect(page.has_selector?('.js-paloma-hook')).to be_falsy
|
156
|
-
end
|
157
|
-
end
|
158
|
-
|
159
|
-
|
160
|
-
context 'js(false)' do
|
161
|
-
before { visit prevent_main_index_path }
|
162
|
-
|
163
|
-
include_examples 'no paloma'
|
164
|
-
|
165
|
-
it 'prevents execution of Paloma controller' do
|
166
|
-
expect(request).to be_nil
|
167
|
-
end
|
168
|
-
end
|
169
|
-
|
170
|
-
context 'json response' do
|
171
|
-
before { visit json_response_main_index_path }
|
172
|
-
include_examples 'no paloma'
|
173
|
-
end
|
174
|
-
|
175
|
-
context 'js response' do
|
176
|
-
before { visit js_response_main_index_path }
|
177
|
-
include_examples 'no paloma'
|
178
|
-
end
|
179
|
-
|
180
|
-
context 'xml response' do
|
181
|
-
before { visit xml_response_main_index_path }
|
182
|
-
|
183
|
-
it 'does not add paloma hook' do
|
184
|
-
# TODO: implement this
|
185
|
-
# XML is not supported by capybara.
|
186
|
-
end
|
187
|
-
end
|
188
|
-
|
189
|
-
context 'file response' do
|
190
|
-
before { visit file_response_main_index_path }
|
191
|
-
include_examples 'no paloma'
|
192
|
-
end
|
193
|
-
|
194
|
-
|
195
|
-
end
|