rails-js 0.1.0 → 0.1.1
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.
- checksums.yaml +4 -4
- metadata +7 -71
- data/.gitignore +0 -6
- data/.travis.yml +0 -3
- data/Gemfile +0 -14
- data/Gemfile.lock +0 -127
- data/MIT-LICENSE +0 -20
- data/README.md +0 -158
- data/Rakefile +0 -25
- data/VERSION +0 -1
- data/app/assets/javascripts/rails.js +0 -327
- data/lib/rails/js.rb +0 -8
- data/lib/rails/js/engine.rb +0 -10
- data/lib/rails/js/version.rb +0 -5
- data/lib/rails/js/view_helpers.rb +0 -23
- data/rails-js.gemspec +0 -24
- data/test/dummy/README.rdoc +0 -28
- data/test/dummy/Rakefile +0 -6
- data/test/dummy/app/assets/images/.keep +0 -0
- data/test/dummy/app/assets/javascripts/application.js +0 -14
- data/test/dummy/app/assets/javascripts/testing.js +0 -2
- data/test/dummy/app/assets/stylesheets/application.css +0 -15
- data/test/dummy/app/controllers/application_controller.rb +0 -5
- data/test/dummy/app/controllers/concerns/.keep +0 -0
- data/test/dummy/app/controllers/testing_controller.rb +0 -6
- data/test/dummy/app/helpers/application_helper.rb +0 -2
- data/test/dummy/app/helpers/testing_helper.rb +0 -2
- data/test/dummy/app/mailers/.keep +0 -0
- data/test/dummy/app/models/.keep +0 -0
- data/test/dummy/app/models/concerns/.keep +0 -0
- data/test/dummy/app/views/layouts/application.html.erb +0 -15
- data/test/dummy/app/views/testing/index.html.erb +0 -0
- data/test/dummy/bin/bundle +0 -3
- data/test/dummy/bin/rails +0 -4
- data/test/dummy/bin/rake +0 -4
- data/test/dummy/config.ru +0 -4
- data/test/dummy/config/application.rb +0 -22
- data/test/dummy/config/boot.rb +0 -5
- data/test/dummy/config/database.yml +0 -25
- data/test/dummy/config/environment.rb +0 -5
- data/test/dummy/config/environments/development.rb +0 -37
- data/test/dummy/config/environments/production.rb +0 -83
- data/test/dummy/config/environments/test.rb +0 -39
- data/test/dummy/config/initializers/assets.rb +0 -3
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/test/dummy/config/initializers/cookies_serializer.rb +0 -3
- data/test/dummy/config/initializers/filter_parameter_logging.rb +0 -4
- data/test/dummy/config/initializers/inflections.rb +0 -16
- data/test/dummy/config/initializers/mime_types.rb +0 -4
- data/test/dummy/config/initializers/session_store.rb +0 -3
- data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/test/dummy/config/locales/en.yml +0 -23
- data/test/dummy/config/routes.rb +0 -4
- data/test/dummy/config/secrets.yml +0 -22
- data/test/dummy/lib/assets/.keep +0 -0
- data/test/dummy/public/404.html +0 -67
- data/test/dummy/public/422.html +0 -67
- data/test/dummy/public/500.html +0 -66
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/spec/javascripts/rails-js_spec.js +0 -165
- data/test/dummy/spec/javascripts/spec_helper.js +0 -31
- data/test/dummy/spec/teaspoon_env.rb +0 -13
- data/test/dummy/test/helpers/testing_helper_test.rb +0 -4
- data/test/teaspoon_env.rb +0 -24
- data/test/test_helper.rb +0 -18
- data/test/testing_controller_test.rb +0 -12
@@ -1,22 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# Your secret key is used for verifying the integrity of signed cookies.
|
4
|
-
# If you change this key, all old signed cookies will become invalid!
|
5
|
-
|
6
|
-
# Make sure the secret is at least 30 characters and all random,
|
7
|
-
# no regular words or you'll be exposed to dictionary attacks.
|
8
|
-
# You can use `rake secret` to generate a secure secret key.
|
9
|
-
|
10
|
-
# Make sure the secrets in this file are kept private
|
11
|
-
# if you're sharing your code publicly.
|
12
|
-
|
13
|
-
development:
|
14
|
-
secret_key_base: 78846b64c741c1343375f567793baea08b47c4cc383fca18e7ea3de893e44e13650dc2fc41cbe49b84ea49cb6fb3b208bd0dd205cb9310a0bb00057a49756e8f
|
15
|
-
|
16
|
-
test:
|
17
|
-
secret_key_base: 122cf3ea286d1336eca8ff19eccdeee09a5b10b3118f9fe236557aa4595a820313bc5dc7f1796c377fd22f685306c9a17a2c06488d946f93152000aa03f669ff
|
18
|
-
|
19
|
-
# Do not keep production secrets in the repository,
|
20
|
-
# instead read values from the environment.
|
21
|
-
production:
|
22
|
-
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
|
data/test/dummy/lib/assets/.keep
DELETED
File without changes
|
data/test/dummy/public/404.html
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
-
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
-
<style>
|
7
|
-
body {
|
8
|
-
background-color: #EFEFEF;
|
9
|
-
color: #2E2F30;
|
10
|
-
text-align: center;
|
11
|
-
font-family: arial, sans-serif;
|
12
|
-
margin: 0;
|
13
|
-
}
|
14
|
-
|
15
|
-
div.dialog {
|
16
|
-
width: 95%;
|
17
|
-
max-width: 33em;
|
18
|
-
margin: 4em auto 0;
|
19
|
-
}
|
20
|
-
|
21
|
-
div.dialog > div {
|
22
|
-
border: 1px solid #CCC;
|
23
|
-
border-right-color: #999;
|
24
|
-
border-left-color: #999;
|
25
|
-
border-bottom-color: #BBB;
|
26
|
-
border-top: #B00100 solid 4px;
|
27
|
-
border-top-left-radius: 9px;
|
28
|
-
border-top-right-radius: 9px;
|
29
|
-
background-color: white;
|
30
|
-
padding: 7px 12% 0;
|
31
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
-
}
|
33
|
-
|
34
|
-
h1 {
|
35
|
-
font-size: 100%;
|
36
|
-
color: #730E15;
|
37
|
-
line-height: 1.5em;
|
38
|
-
}
|
39
|
-
|
40
|
-
div.dialog > p {
|
41
|
-
margin: 0 0 1em;
|
42
|
-
padding: 1em;
|
43
|
-
background-color: #F7F7F7;
|
44
|
-
border: 1px solid #CCC;
|
45
|
-
border-right-color: #999;
|
46
|
-
border-left-color: #999;
|
47
|
-
border-bottom-color: #999;
|
48
|
-
border-bottom-left-radius: 4px;
|
49
|
-
border-bottom-right-radius: 4px;
|
50
|
-
border-top-color: #DADADA;
|
51
|
-
color: #666;
|
52
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
-
}
|
54
|
-
</style>
|
55
|
-
</head>
|
56
|
-
|
57
|
-
<body>
|
58
|
-
<!-- This file lives in public/404.html -->
|
59
|
-
<div class="dialog">
|
60
|
-
<div>
|
61
|
-
<h1>The page you were looking for doesn't exist.</h1>
|
62
|
-
<p>You may have mistyped the address or the page may have moved.</p>
|
63
|
-
</div>
|
64
|
-
<p>If you are the application owner check the logs for more information.</p>
|
65
|
-
</div>
|
66
|
-
</body>
|
67
|
-
</html>
|
data/test/dummy/public/422.html
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>The change you wanted was rejected (422)</title>
|
5
|
-
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
-
<style>
|
7
|
-
body {
|
8
|
-
background-color: #EFEFEF;
|
9
|
-
color: #2E2F30;
|
10
|
-
text-align: center;
|
11
|
-
font-family: arial, sans-serif;
|
12
|
-
margin: 0;
|
13
|
-
}
|
14
|
-
|
15
|
-
div.dialog {
|
16
|
-
width: 95%;
|
17
|
-
max-width: 33em;
|
18
|
-
margin: 4em auto 0;
|
19
|
-
}
|
20
|
-
|
21
|
-
div.dialog > div {
|
22
|
-
border: 1px solid #CCC;
|
23
|
-
border-right-color: #999;
|
24
|
-
border-left-color: #999;
|
25
|
-
border-bottom-color: #BBB;
|
26
|
-
border-top: #B00100 solid 4px;
|
27
|
-
border-top-left-radius: 9px;
|
28
|
-
border-top-right-radius: 9px;
|
29
|
-
background-color: white;
|
30
|
-
padding: 7px 12% 0;
|
31
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
-
}
|
33
|
-
|
34
|
-
h1 {
|
35
|
-
font-size: 100%;
|
36
|
-
color: #730E15;
|
37
|
-
line-height: 1.5em;
|
38
|
-
}
|
39
|
-
|
40
|
-
div.dialog > p {
|
41
|
-
margin: 0 0 1em;
|
42
|
-
padding: 1em;
|
43
|
-
background-color: #F7F7F7;
|
44
|
-
border: 1px solid #CCC;
|
45
|
-
border-right-color: #999;
|
46
|
-
border-left-color: #999;
|
47
|
-
border-bottom-color: #999;
|
48
|
-
border-bottom-left-radius: 4px;
|
49
|
-
border-bottom-right-radius: 4px;
|
50
|
-
border-top-color: #DADADA;
|
51
|
-
color: #666;
|
52
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
-
}
|
54
|
-
</style>
|
55
|
-
</head>
|
56
|
-
|
57
|
-
<body>
|
58
|
-
<!-- This file lives in public/422.html -->
|
59
|
-
<div class="dialog">
|
60
|
-
<div>
|
61
|
-
<h1>The change you wanted was rejected.</h1>
|
62
|
-
<p>Maybe you tried to change something you didn't have access to.</p>
|
63
|
-
</div>
|
64
|
-
<p>If you are the application owner check the logs for more information.</p>
|
65
|
-
</div>
|
66
|
-
</body>
|
67
|
-
</html>
|
data/test/dummy/public/500.html
DELETED
@@ -1,66 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>We're sorry, but something went wrong (500)</title>
|
5
|
-
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
-
<style>
|
7
|
-
body {
|
8
|
-
background-color: #EFEFEF;
|
9
|
-
color: #2E2F30;
|
10
|
-
text-align: center;
|
11
|
-
font-family: arial, sans-serif;
|
12
|
-
margin: 0;
|
13
|
-
}
|
14
|
-
|
15
|
-
div.dialog {
|
16
|
-
width: 95%;
|
17
|
-
max-width: 33em;
|
18
|
-
margin: 4em auto 0;
|
19
|
-
}
|
20
|
-
|
21
|
-
div.dialog > div {
|
22
|
-
border: 1px solid #CCC;
|
23
|
-
border-right-color: #999;
|
24
|
-
border-left-color: #999;
|
25
|
-
border-bottom-color: #BBB;
|
26
|
-
border-top: #B00100 solid 4px;
|
27
|
-
border-top-left-radius: 9px;
|
28
|
-
border-top-right-radius: 9px;
|
29
|
-
background-color: white;
|
30
|
-
padding: 7px 12% 0;
|
31
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
-
}
|
33
|
-
|
34
|
-
h1 {
|
35
|
-
font-size: 100%;
|
36
|
-
color: #730E15;
|
37
|
-
line-height: 1.5em;
|
38
|
-
}
|
39
|
-
|
40
|
-
div.dialog > p {
|
41
|
-
margin: 0 0 1em;
|
42
|
-
padding: 1em;
|
43
|
-
background-color: #F7F7F7;
|
44
|
-
border: 1px solid #CCC;
|
45
|
-
border-right-color: #999;
|
46
|
-
border-left-color: #999;
|
47
|
-
border-bottom-color: #999;
|
48
|
-
border-bottom-left-radius: 4px;
|
49
|
-
border-bottom-right-radius: 4px;
|
50
|
-
border-top-color: #DADADA;
|
51
|
-
color: #666;
|
52
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
-
}
|
54
|
-
</style>
|
55
|
-
</head>
|
56
|
-
|
57
|
-
<body>
|
58
|
-
<!-- This file lives in public/500.html -->
|
59
|
-
<div class="dialog">
|
60
|
-
<div>
|
61
|
-
<h1>We're sorry, but something went wrong.</h1>
|
62
|
-
</div>
|
63
|
-
<p>If you are the application owner check the logs for more information.</p>
|
64
|
-
</div>
|
65
|
-
</body>
|
66
|
-
</html>
|
File without changes
|
@@ -1,165 +0,0 @@
|
|
1
|
-
|
2
|
-
/*
|
3
|
-
* Test for rails.js
|
4
|
-
*
|
5
|
-
* For more information see rails.js itself
|
6
|
-
*/
|
7
|
-
|
8
|
-
(function() {
|
9
|
-
describe('rails-js', function() {
|
10
|
-
|
11
|
-
/*
|
12
|
-
* define all functions spied on
|
13
|
-
*/
|
14
|
-
var spies = { beforeAll: function() {},
|
15
|
-
namespaceHook: function() {},
|
16
|
-
usersIndex: function() {},
|
17
|
-
entitiesNew: function() {},
|
18
|
-
adminUsersIndex: function() {},
|
19
|
-
aHelper: function() {}
|
20
|
-
};
|
21
|
-
|
22
|
-
beforeEach(function() {
|
23
|
-
|
24
|
-
// Set config normally set by view_helper
|
25
|
-
Rails.config = {
|
26
|
-
controller: 'users',
|
27
|
-
action: 'index'
|
28
|
-
};
|
29
|
-
|
30
|
-
|
31
|
-
/*
|
32
|
-
* Clean up
|
33
|
-
*/
|
34
|
-
Rails.clear();
|
35
|
-
|
36
|
-
spyOn(spies, 'beforeAll');
|
37
|
-
spyOn(spies, 'namespaceHook');
|
38
|
-
spyOn(spies, 'usersIndex');
|
39
|
-
spyOn(spies, 'entitiesNew');
|
40
|
-
spyOn(spies, 'adminUsersIndex');
|
41
|
-
spyOn(spies, 'aHelper');
|
42
|
-
|
43
|
-
/*
|
44
|
-
* Create an app
|
45
|
-
*/
|
46
|
-
Rails.app({
|
47
|
-
// global helpers
|
48
|
-
answer: function() {
|
49
|
-
return 42
|
50
|
-
}
|
51
|
-
}, {
|
52
|
-
// initial data
|
53
|
-
foo: 'bar'
|
54
|
-
}, spies.beforeAll);
|
55
|
-
|
56
|
-
/*
|
57
|
-
* Create a controller
|
58
|
-
*/
|
59
|
-
Rails.controller('users', {
|
60
|
-
index: spies.usersIndex,
|
61
|
-
new: function(h) {
|
62
|
-
// execute helper
|
63
|
-
h.aHelper();
|
64
|
-
}
|
65
|
-
}, {
|
66
|
-
aHelper: spies.aHelper
|
67
|
-
});
|
68
|
-
});
|
69
|
-
|
70
|
-
it('must be defined', function() {
|
71
|
-
expect(Rails).toBeDefined();
|
72
|
-
expect(R).toBeDefined();
|
73
|
-
});
|
74
|
-
|
75
|
-
it('must handle global variables', function() {
|
76
|
-
R('a.global.variable', 'foo');
|
77
|
-
|
78
|
-
expect(R('a')).toBeDefined();
|
79
|
-
expect(R('a.global')).toBeDefined();
|
80
|
-
expect(R('a.global.variable')).toBe('foo');
|
81
|
-
});
|
82
|
-
|
83
|
-
it('must be able to execute global helpers', function() {
|
84
|
-
expect(R.global('answer')).toBe(42);
|
85
|
-
});
|
86
|
-
|
87
|
-
it('must be able to read initial data', function() {
|
88
|
-
expect(R('foo')).toBe('bar');
|
89
|
-
});
|
90
|
-
|
91
|
-
it('must execute beforeAll hook', function() {
|
92
|
-
Rails.execute();
|
93
|
-
expect(spies.beforeAll).toHaveBeenCalled();
|
94
|
-
});
|
95
|
-
|
96
|
-
it('must execute right controller action', function() {
|
97
|
-
Rails.execute();
|
98
|
-
expect(spies.usersIndex).toHaveBeenCalled();
|
99
|
-
|
100
|
-
// Change action to users#new
|
101
|
-
Rails.config.action = 'new';
|
102
|
-
|
103
|
-
// A helper must be called from within users#new
|
104
|
-
Rails.execute();
|
105
|
-
expect(spies.aHelper).toHaveBeenCalled();
|
106
|
-
|
107
|
-
// Create entities controller
|
108
|
-
Rails.controller('entities', { new: spies.entitiesNew });
|
109
|
-
// Change controller to entities#new
|
110
|
-
Rails.config.controller = 'entities';
|
111
|
-
|
112
|
-
Rails.execute();
|
113
|
-
expect(spies.entitiesNew).toHaveBeenCalled();
|
114
|
-
});
|
115
|
-
|
116
|
-
it('must handle controller with same name but different namespace', function() {
|
117
|
-
Rails.controller('admin/users', {
|
118
|
-
index: spies.adminUsersIndex
|
119
|
-
});
|
120
|
-
|
121
|
-
Rails.config.namespace = 'admin';
|
122
|
-
Rails.execute();
|
123
|
-
expect(spies.adminUsersIndex).toHaveBeenCalled();
|
124
|
-
expect(spies.usersIndex).not.toHaveBeenCalled();
|
125
|
-
});
|
126
|
-
|
127
|
-
it('must execute foreign helper', function() {
|
128
|
-
Rails.controller('admin/users', {
|
129
|
-
index: function() {
|
130
|
-
R.helper('users', 'aHelper');
|
131
|
-
}
|
132
|
-
});
|
133
|
-
|
134
|
-
Rails.config.namespace = 'admin';
|
135
|
-
Rails.execute();
|
136
|
-
expect(spies.aHelper).toHaveBeenCalled();
|
137
|
-
});
|
138
|
-
|
139
|
-
it('must execute foreign action', function() {
|
140
|
-
Rails.controller('admin/users', {
|
141
|
-
index: function() {
|
142
|
-
R.action('users#index');
|
143
|
-
}
|
144
|
-
});
|
145
|
-
|
146
|
-
Rails.config.namespace = 'admin';
|
147
|
-
Rails.execute();
|
148
|
-
expect(spies.usersIndex).toHaveBeenCalled();
|
149
|
-
});
|
150
|
-
|
151
|
-
it('must execute namespace hook when in namespace', function() {
|
152
|
-
// Define namespace with hook
|
153
|
-
Rails.namespace('admin', spies.namespaceHook);
|
154
|
-
|
155
|
-
// First without namespace
|
156
|
-
Rails.execute();
|
157
|
-
expect(spies.namespaceHook).not.toHaveBeenCalled();
|
158
|
-
|
159
|
-
// Now with namespace
|
160
|
-
Rails.config.namespace = 'admin';
|
161
|
-
Rails.execute();
|
162
|
-
expect(spies.namespaceHook).toHaveBeenCalled();
|
163
|
-
});
|
164
|
-
});
|
165
|
-
})();
|
@@ -1,31 +0,0 @@
|
|
1
|
-
// Teaspoon includes some support files, but you can use anything from your own support path too.
|
2
|
-
// require support/jasmine-jquery-1.7.0
|
3
|
-
// require support/jasmine-jquery-2.0.0
|
4
|
-
// require support/sinon
|
5
|
-
// require support/your-support-file
|
6
|
-
//
|
7
|
-
// PhantomJS (Teaspoons default driver) doesn't have support for Function.prototype.bind, which has caused confusion.
|
8
|
-
// Use this polyfill to avoid the confusion.
|
9
|
-
//= require support/bind-poly
|
10
|
-
//
|
11
|
-
// Deferring execution
|
12
|
-
// If you're using CommonJS, RequireJS or some other asynchronous library you can defer execution. Call
|
13
|
-
// Teaspoon.execute() after everything has been loaded. Simple example of a timeout:
|
14
|
-
//
|
15
|
-
// Teaspoon.defer = true
|
16
|
-
// setTimeout(Teaspoon.execute, 1000)
|
17
|
-
//
|
18
|
-
// Matching files
|
19
|
-
// By default Teaspoon will look for files that match _spec.{js,js.coffee,.coffee}. Add a filename_spec.js file in your
|
20
|
-
// spec path and it'll be included in the default suite automatically. If you want to customize suites, check out the
|
21
|
-
// configuration in config/initializers/teaspoon.rb
|
22
|
-
//
|
23
|
-
// Manifest
|
24
|
-
// If you'd rather require your spec files manually (to control order for instance) you can disable the suite matcher in
|
25
|
-
// the configuration and use this file as a manifest.
|
26
|
-
//
|
27
|
-
// For more information: http://github.com/modeset/teaspoon
|
28
|
-
//
|
29
|
-
// You can require your own javascript files here. By default this will include everything in application, however you
|
30
|
-
// may get better load performance if you require the specific files that are being used in the spec that tests them.
|
31
|
-
//= require application
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# Set RAILS_ROOT and load the environment if it's not already loaded.
|
2
|
-
unless defined?(Rails)
|
3
|
-
ENV["RAILS_ROOT"] = File.expand_path("../../", __FILE__)
|
4
|
-
require File.expand_path("../../config/environment", __FILE__)
|
5
|
-
end
|
6
|
-
|
7
|
-
Teaspoon.configure do |config|
|
8
|
-
|
9
|
-
config.suite do |suite|
|
10
|
-
suite.use_framework :jasmine, "1.3.1"
|
11
|
-
suite.matcher = "{spec/javascripts,app/assets}/**/*_spec.{js,js.coffee,coffee}"
|
12
|
-
end
|
13
|
-
end
|