simple_update_field 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +0 -19
- data/Gemfile.lock +0 -150
- data/README.creole +102 -0
- data/Rakefile +3 -9
- data/VERSION +1 -1
- data/lib/simple_update_field.rb +0 -8
- data/simple_update_field.gemspec +7 -81
- data/spec/{lib/simple_update_field_spec.rb → simple_update_field_spec.rb} +2 -1
- data/spec/spec_helper.rb +8 -28
- metadata +16 -162
- data/.rvmrc +0 -1
- data/README.rdoc +0 -25
- data/app/assets/images/rails.png +0 -0
- data/app/assets/javascripts/application.js +0 -14
- data/app/assets/stylesheets/application.css +0 -7
- data/app/controllers/application_controller.rb +0 -3
- data/app/controllers/phrases_controller.rb +0 -12
- data/app/helpers/application_helper.rb +0 -2
- data/app/mailers/.gitkeep +0 -0
- data/app/models/.gitkeep +0 -0
- data/app/models/phrase.rb +0 -4
- data/app/views/layouts/application.html.erb +0 -14
- data/app/views/phrases/_phrase.html.erb +0 -8
- data/app/views/phrases/index.html.erb +0 -1
- data/config.ru +0 -4
- data/config/application.rb +0 -54
- data/config/boot.rb +0 -6
- data/config/database.yml +0 -25
- data/config/environment.rb +0 -5
- data/config/environments/development.rb +0 -30
- data/config/environments/production.rb +0 -60
- data/config/environments/test.rb +0 -42
- data/config/initializers/backtrace_silencers.rb +0 -7
- data/config/initializers/inflections.rb +0 -10
- data/config/initializers/mime_types.rb +0 -5
- data/config/initializers/secret_token.rb +0 -7
- data/config/initializers/session_store.rb +0 -8
- data/config/initializers/wrap_parameters.rb +0 -14
- data/config/locales/en.yml +0 -5
- data/config/routes.rb +0 -4
- data/db/migrate/20120213182817_create_phrases.rb +0 -9
- data/db/schema.rb +0 -22
- data/db/seeds.rb +0 -7
- data/lib/assets/.gitkeep +0 -0
- data/lib/tasks/.gitkeep +0 -0
- data/lib/tasks/admin.rake +0 -9
- data/lib/tasks/jasmine.rake +0 -8
- data/script/rails +0 -6
- data/spec/controllers/phrases_controller_spec.rb +0 -22
- data/spec/javascripts/editable_list_spec.js +0 -411
- data/spec/javascripts/helpers/mock-ajax.js +0 -207
- data/spec/javascripts/spec.css +0 -3
- data/spec/javascripts/spec.js +0 -2
- data/spec/models/phrase_spec.rb +0 -11
- data/spec/routing/phrase_spec.rb +0 -12
- data/spec/routing/root_spec.rb +0 -7
- data/spec/views/_phrase.html.erb_spec.rb +0 -9
- data/spec/views/index.html.erb_spec.rb +0 -10
@@ -1,207 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
Jasmine-Ajax : a set of helpers for testing AJAX requests under the Jasmine
|
3
|
-
BDD framework for JavaScript.
|
4
|
-
|
5
|
-
Supports both Prototype.js and jQuery.
|
6
|
-
|
7
|
-
http://github.com/pivotal/jasmine-ajax
|
8
|
-
|
9
|
-
Jasmine Home page: http://pivotal.github.com/jasmine
|
10
|
-
|
11
|
-
Copyright (c) 2008-2010 Pivotal Labs
|
12
|
-
|
13
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
14
|
-
a copy of this software and associated documentation files (the
|
15
|
-
"Software"), to deal in the Software without restriction, including
|
16
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
17
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
18
|
-
permit persons to whom the Software is furnished to do so, subject to
|
19
|
-
the following conditions:
|
20
|
-
|
21
|
-
The above copyright notice and this permission notice shall be
|
22
|
-
included in all copies or substantial portions of the Software.
|
23
|
-
|
24
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
25
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
26
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
27
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
28
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
29
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
30
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
31
|
-
|
32
|
-
*/
|
33
|
-
|
34
|
-
// Jasmine-Ajax interface
|
35
|
-
var ajaxRequests = [];
|
36
|
-
|
37
|
-
function mostRecentAjaxRequest() {
|
38
|
-
if (ajaxRequests.length > 0) {
|
39
|
-
return ajaxRequests[ajaxRequests.length - 1];
|
40
|
-
} else {
|
41
|
-
return null;
|
42
|
-
}
|
43
|
-
}
|
44
|
-
|
45
|
-
function clearAjaxRequests() {
|
46
|
-
ajaxRequests = [];
|
47
|
-
}
|
48
|
-
|
49
|
-
// Fake XHR for mocking Ajax Requests & Responses
|
50
|
-
function FakeXMLHttpRequest() {
|
51
|
-
var extend = Object.extend || $.extend;
|
52
|
-
extend(this, {
|
53
|
-
requestHeaders: {},
|
54
|
-
|
55
|
-
open: function() {
|
56
|
-
this.method = arguments[0];
|
57
|
-
this.url = arguments[1];
|
58
|
-
this.readyState = 1;
|
59
|
-
},
|
60
|
-
|
61
|
-
setRequestHeader: function(header, value) {
|
62
|
-
this.requestHeaders[header] = value;
|
63
|
-
},
|
64
|
-
|
65
|
-
abort: function() {
|
66
|
-
this.readyState = 0;
|
67
|
-
},
|
68
|
-
|
69
|
-
readyState: 0,
|
70
|
-
|
71
|
-
onreadystatechange: function(isTimeout) {
|
72
|
-
},
|
73
|
-
|
74
|
-
status: null,
|
75
|
-
|
76
|
-
send: function(data) {
|
77
|
-
this.params = data;
|
78
|
-
this.readyState = 2;
|
79
|
-
},
|
80
|
-
|
81
|
-
getResponseHeader: function(name) {
|
82
|
-
return this.responseHeaders[name];
|
83
|
-
},
|
84
|
-
|
85
|
-
getAllResponseHeaders: function() {
|
86
|
-
var responseHeaders = [];
|
87
|
-
for (var i in this.responseHeaders) {
|
88
|
-
if (this.responseHeaders.hasOwnProperty(i)) {
|
89
|
-
responseHeaders.push(i + ': ' + this.responseHeaders[i]);
|
90
|
-
}
|
91
|
-
}
|
92
|
-
return responseHeaders.join('\r\n');
|
93
|
-
},
|
94
|
-
|
95
|
-
responseText: null,
|
96
|
-
|
97
|
-
response: function(response) {
|
98
|
-
this.status = response.status;
|
99
|
-
this.responseText = response.responseText || "";
|
100
|
-
this.readyState = 4;
|
101
|
-
this.responseHeaders = response.responseHeaders ||
|
102
|
-
{"Content-type": response.contentType || "application/json" };
|
103
|
-
// uncomment for jquery 1.3.x support
|
104
|
-
// jasmine.Clock.tick(20);
|
105
|
-
|
106
|
-
this.onreadystatechange();
|
107
|
-
},
|
108
|
-
responseTimeout: function() {
|
109
|
-
this.readyState = 4;
|
110
|
-
jasmine.Clock.tick(jQuery.ajaxSettings.timeout || 30000);
|
111
|
-
this.onreadystatechange('timeout');
|
112
|
-
}
|
113
|
-
});
|
114
|
-
|
115
|
-
return this;
|
116
|
-
}
|
117
|
-
|
118
|
-
|
119
|
-
jasmine.Ajax = {
|
120
|
-
|
121
|
-
isInstalled: function() {
|
122
|
-
return jasmine.Ajax.installed == true;
|
123
|
-
},
|
124
|
-
|
125
|
-
assertInstalled: function() {
|
126
|
-
if (!jasmine.Ajax.isInstalled()) {
|
127
|
-
throw new Error("Mock ajax is not installed, use jasmine.Ajax.useMock()")
|
128
|
-
}
|
129
|
-
},
|
130
|
-
|
131
|
-
useMock: function() {
|
132
|
-
if (!jasmine.Ajax.isInstalled()) {
|
133
|
-
var spec = jasmine.getEnv().currentSpec;
|
134
|
-
spec.after(jasmine.Ajax.uninstallMock);
|
135
|
-
|
136
|
-
jasmine.Ajax.installMock();
|
137
|
-
}
|
138
|
-
},
|
139
|
-
|
140
|
-
installMock: function() {
|
141
|
-
if (typeof jQuery != 'undefined') {
|
142
|
-
jasmine.Ajax.installJquery();
|
143
|
-
} else if (typeof Prototype != 'undefined') {
|
144
|
-
jasmine.Ajax.installPrototype();
|
145
|
-
} else {
|
146
|
-
throw new Error("jasmine.Ajax currently only supports jQuery and Prototype");
|
147
|
-
}
|
148
|
-
jasmine.Ajax.installed = true;
|
149
|
-
},
|
150
|
-
|
151
|
-
installJquery: function() {
|
152
|
-
jasmine.Ajax.mode = 'jQuery';
|
153
|
-
jasmine.Ajax.real = jQuery.ajaxSettings.xhr;
|
154
|
-
jQuery.ajaxSettings.xhr = jasmine.Ajax.jQueryMock;
|
155
|
-
|
156
|
-
},
|
157
|
-
|
158
|
-
installPrototype: function() {
|
159
|
-
jasmine.Ajax.mode = 'Prototype';
|
160
|
-
jasmine.Ajax.real = Ajax.getTransport;
|
161
|
-
|
162
|
-
Ajax.getTransport = jasmine.Ajax.prototypeMock;
|
163
|
-
},
|
164
|
-
|
165
|
-
uninstallMock: function() {
|
166
|
-
jasmine.Ajax.assertInstalled();
|
167
|
-
if (jasmine.Ajax.mode == 'jQuery') {
|
168
|
-
jQuery.ajaxSettings.xhr = jasmine.Ajax.real;
|
169
|
-
} else if (jasmine.Ajax.mode == 'Prototype') {
|
170
|
-
Ajax.getTransport = jasmine.Ajax.real;
|
171
|
-
}
|
172
|
-
jasmine.Ajax.reset();
|
173
|
-
},
|
174
|
-
|
175
|
-
reset: function() {
|
176
|
-
jasmine.Ajax.installed = false;
|
177
|
-
jasmine.Ajax.mode = null;
|
178
|
-
jasmine.Ajax.real = null;
|
179
|
-
},
|
180
|
-
|
181
|
-
jQueryMock: function() {
|
182
|
-
var newXhr = new FakeXMLHttpRequest();
|
183
|
-
ajaxRequests.push(newXhr);
|
184
|
-
return newXhr;
|
185
|
-
},
|
186
|
-
|
187
|
-
prototypeMock: function() {
|
188
|
-
return new FakeXMLHttpRequest();
|
189
|
-
},
|
190
|
-
|
191
|
-
installed: false,
|
192
|
-
mode: null
|
193
|
-
}
|
194
|
-
|
195
|
-
|
196
|
-
// Jasmine-Ajax Glue code for Prototype.js
|
197
|
-
if (typeof Prototype != 'undefined' && Ajax && Ajax.Request) {
|
198
|
-
Ajax.Request.prototype.originalRequest = Ajax.Request.prototype.request;
|
199
|
-
Ajax.Request.prototype.request = function(url) {
|
200
|
-
this.originalRequest(url);
|
201
|
-
ajaxRequests.push(this);
|
202
|
-
};
|
203
|
-
|
204
|
-
Ajax.Request.prototype.response = function(responseOptions) {
|
205
|
-
return this.transport.response(responseOptions);
|
206
|
-
};
|
207
|
-
}
|
data/spec/javascripts/spec.css
DELETED
data/spec/javascripts/spec.js
DELETED
data/spec/models/phrase_spec.rb
DELETED
data/spec/routing/phrase_spec.rb
DELETED
data/spec/routing/root_spec.rb
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
describe "phrases/index.html.erb" do
|
3
|
-
it "renders a phrase template for each phrase" do
|
4
|
-
my_phrases = [Phrase.create!(:text => 'snuggly'),
|
5
|
-
Phrase.create!(:text => 'bear')]
|
6
|
-
assign(:phrases, my_phrases) # @phrases = my_phrases in view
|
7
|
-
render
|
8
|
-
view.should render_template(:partial => "_phrase", :count => 2)
|
9
|
-
end
|
10
|
-
end
|