merb_screw_unit 0.9.8 → 0.9.9
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/Rakefile +4 -4
- data/public/javascripts/application.js +0 -0
- data/public/javascripts/jquery-1.2.6.js +15 -0
- data/public/javascripts/jquery.print.js +5 -2
- data/public/javascripts/livequery.jquery.js +250 -0
- data/public/javascripts/metadata.jquery.js +129 -0
- data/public/javascripts/screw.builder.js +2 -1
- data/public/javascripts/screw.events.js +3 -1
- data/public/javascripts/screw.matchers.js +1 -3
- metadata +7 -8
- data/spec/controllers/main_spec.rb +0 -61
- data/spec/merb_screw_unit_spec.rb +0 -130
- data/spec/spec_helper.rb +0 -44
data/Rakefile
CHANGED
@@ -18,7 +18,7 @@ GEM_EMAIL = "ykatz@engineyard.com"
|
|
18
18
|
|
19
19
|
GEM_NAME = "merb_screw_unit"
|
20
20
|
PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
|
21
|
-
GEM_VERSION = (Merb::MORE_VERSION rescue "0.9.
|
21
|
+
GEM_VERSION = (Merb::MORE_VERSION rescue "0.9.9") + PKG_BUILD
|
22
22
|
|
23
23
|
RELEASE_NAME = "REL #{GEM_VERSION}"
|
24
24
|
|
@@ -36,10 +36,10 @@ spec = Gem::Specification.new do |s|
|
|
36
36
|
s.author = GEM_AUTHOR
|
37
37
|
s.email = GEM_EMAIL
|
38
38
|
s.homepage = PROJECT_URL
|
39
|
-
s.add_dependency('merb-core', '>= 0.9.
|
40
|
-
s.add_dependency('merb-slices', '>= 0.9.
|
39
|
+
s.add_dependency('merb-core', '>= 0.9.9')
|
40
|
+
s.add_dependency('merb-slices', '>= 0.9.9')
|
41
41
|
s.require_path = 'lib'
|
42
|
-
s.files = %w(LICENSE README Rakefile TODO) + Dir.glob("{lib,
|
42
|
+
s.files = %w(LICENSE README Rakefile TODO) + Dir.glob("{lib,app,public,stubs}/**/*")
|
43
43
|
end
|
44
44
|
|
45
45
|
Rake::GemPackageTask.new(spec) do |pkg|
|
File without changes
|
@@ -17,7 +17,13 @@ var _jQuery = window.jQuery,
|
|
17
17
|
|
18
18
|
var jQuery = window.jQuery = window.$ = function( selector, context ) {
|
19
19
|
// The jQuery object is actually just the init constructor 'enhanced'
|
20
|
+
<<<<<<< HEAD:merb_screw_unit/public/javascripts/jquery-1.2.3.js
|
21
|
+
var jquery = new jQuery.prototype.init( selector, context );
|
22
|
+
jquery.selector = selector;
|
23
|
+
return jquery;
|
24
|
+
=======
|
20
25
|
return new jQuery.fn.init( selector, context );
|
26
|
+
>>>>>>> 42c99eacbd1f6489bca5f62103695de90c6a30b0:merb_screw_unit/public/javascripts/jquery-1.2.6.js
|
21
27
|
};
|
22
28
|
|
23
29
|
// A simple way to check for HTML strings or ID strings
|
@@ -42,7 +48,12 @@ jQuery.fn = jQuery.prototype = {
|
|
42
48
|
return this;
|
43
49
|
}
|
44
50
|
// Handle HTML strings
|
51
|
+
<<<<<<< HEAD:merb_screw_unit/public/javascripts/jquery-1.2.3.js
|
52
|
+
} else if ( typeof selector == "string" ) {
|
53
|
+
|
54
|
+
=======
|
45
55
|
if ( typeof selector == "string" ) {
|
56
|
+
>>>>>>> 42c99eacbd1f6489bca5f62103695de90c6a30b0:merb_screw_unit/public/javascripts/jquery-1.2.6.js
|
46
57
|
// Are we dealing with HTML string or an ID?
|
47
58
|
var match = quickExpr.exec( selector );
|
48
59
|
|
@@ -3455,6 +3466,9 @@ jQuery.fn.offset = function() {
|
|
3455
3466
|
return results;
|
3456
3467
|
};
|
3457
3468
|
|
3469
|
+
<<<<<<< HEAD:merb_screw_unit/public/javascripts/jquery-1.2.3.js
|
3470
|
+
})();
|
3471
|
+
=======
|
3458
3472
|
|
3459
3473
|
jQuery.fn.extend({
|
3460
3474
|
position: function() {
|
@@ -3547,3 +3561,4 @@ jQuery.each([ "Height", "Width" ], function(i, name){
|
|
3547
3561
|
};
|
3548
3562
|
|
3549
3563
|
});})();
|
3564
|
+
>>>>>>> 42c99eacbd1f6489bca5f62103695de90c6a30b0:merb_screw_unit/public/javascripts/jquery-1.2.6.js
|
@@ -95,8 +95,11 @@
|
|
95
95
|
return print_array(obj, opts);
|
96
96
|
else if (obj.nodeType)
|
97
97
|
return print_element(obj);
|
98
|
-
else if (obj
|
99
|
-
|
98
|
+
else if (obj.jquery)
|
99
|
+
if(obj.length)
|
100
|
+
return "$(" + $.print(obj.get()) + ")";
|
101
|
+
else
|
102
|
+
return "$(\"" + obj.selector + "\")";
|
100
103
|
else if (obj instanceof Error)
|
101
104
|
return print_object(obj, $.extend({}, options, { max_string: 200 }));
|
102
105
|
else if (obj instanceof Object)
|
@@ -0,0 +1,250 @@
|
|
1
|
+
/* Copyright (c) 2007 Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
|
2
|
+
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
|
3
|
+
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
|
4
|
+
*
|
5
|
+
* Version: @VERSION
|
6
|
+
* Requires jQuery 1.1.3+
|
7
|
+
* Docs: http://docs.jquery.com/Plugins/livequery
|
8
|
+
*/
|
9
|
+
|
10
|
+
(function($) {
|
11
|
+
|
12
|
+
$.extend($.fn, {
|
13
|
+
livequery: function(type, fn, fn2) {
|
14
|
+
var self = this, q;
|
15
|
+
|
16
|
+
// Handle different call patterns
|
17
|
+
if ($.isFunction(type))
|
18
|
+
fn2 = fn, fn = type, type = undefined;
|
19
|
+
|
20
|
+
// See if Live Query already exists
|
21
|
+
$.each( $.livequery.queries, function(i, query) {
|
22
|
+
if ( self.selector == query.selector && self.context == query.context &&
|
23
|
+
type == query.type && (!fn || fn.$lqguid == query.fn.$lqguid) && (!fn2 || fn2.$lqguid == query.fn2.$lqguid) )
|
24
|
+
// Found the query, exit the each loop
|
25
|
+
return (q = query) && false;
|
26
|
+
});
|
27
|
+
|
28
|
+
// Create new Live Query if it wasn't found
|
29
|
+
q = q || new $.livequery(this.selector, this.context, type, fn, fn2);
|
30
|
+
|
31
|
+
// Make sure it is running
|
32
|
+
q.stopped = false;
|
33
|
+
|
34
|
+
// Run it
|
35
|
+
$.livequery.run( q.id );
|
36
|
+
|
37
|
+
// Contnue the chain
|
38
|
+
return this;
|
39
|
+
},
|
40
|
+
|
41
|
+
expire: function(type, fn, fn2) {
|
42
|
+
var self = this;
|
43
|
+
|
44
|
+
// Handle different call patterns
|
45
|
+
if ($.isFunction(type))
|
46
|
+
fn2 = fn, fn = type, type = undefined;
|
47
|
+
|
48
|
+
// Find the Live Query based on arguments and stop it
|
49
|
+
$.each( $.livequery.queries, function(i, query) {
|
50
|
+
if ( self.selector == query.selector && self.context == query.context &&
|
51
|
+
(!type || type == query.type) && (!fn || fn.$lqguid == query.fn.$lqguid) && (!fn2 || fn2.$lqguid == query.fn2.$lqguid) && !this.stopped )
|
52
|
+
$.livequery.stop(query.id);
|
53
|
+
});
|
54
|
+
|
55
|
+
// Continue the chain
|
56
|
+
return this;
|
57
|
+
}
|
58
|
+
});
|
59
|
+
|
60
|
+
$.livequery = function(selector, context, type, fn, fn2) {
|
61
|
+
this.selector = selector;
|
62
|
+
this.context = context || document;
|
63
|
+
this.type = type;
|
64
|
+
this.fn = fn;
|
65
|
+
this.fn2 = fn2;
|
66
|
+
this.elements = [];
|
67
|
+
this.stopped = false;
|
68
|
+
|
69
|
+
// The id is the index of the Live Query in $.livequery.queries
|
70
|
+
this.id = $.livequery.queries.push(this)-1;
|
71
|
+
|
72
|
+
// Mark the functions for matching later on
|
73
|
+
fn.$lqguid = fn.$lqguid || $.livequery.guid++;
|
74
|
+
if (fn2) fn2.$lqguid = fn2.$lqguid || $.livequery.guid++;
|
75
|
+
|
76
|
+
// Return the Live Query
|
77
|
+
return this;
|
78
|
+
};
|
79
|
+
|
80
|
+
$.livequery.prototype = {
|
81
|
+
stop: function() {
|
82
|
+
var query = this;
|
83
|
+
|
84
|
+
if ( this.type )
|
85
|
+
// Unbind all bound events
|
86
|
+
this.elements.unbind(this.type, this.fn);
|
87
|
+
else if (this.fn2)
|
88
|
+
// Call the second function for all matched elements
|
89
|
+
this.elements.each(function(i, el) {
|
90
|
+
query.fn2.apply(el);
|
91
|
+
});
|
92
|
+
|
93
|
+
// Clear out matched elements
|
94
|
+
this.elements = [];
|
95
|
+
|
96
|
+
// Stop the Live Query from running until restarted
|
97
|
+
this.stopped = true;
|
98
|
+
},
|
99
|
+
|
100
|
+
run: function() {
|
101
|
+
// Short-circuit if stopped
|
102
|
+
if ( this.stopped ) return;
|
103
|
+
var query = this;
|
104
|
+
|
105
|
+
var oEls = this.elements,
|
106
|
+
els = $(this.selector, this.context),
|
107
|
+
nEls = els.not(oEls);
|
108
|
+
|
109
|
+
// Set elements to the latest set of matched elements
|
110
|
+
this.elements = els;
|
111
|
+
|
112
|
+
if (this.type) {
|
113
|
+
// Bind events to newly matched elements
|
114
|
+
nEls.bind(this.type, this.fn);
|
115
|
+
|
116
|
+
// Unbind events to elements no longer matched
|
117
|
+
if (oEls.length > 0)
|
118
|
+
$.each(oEls, function(i, el) {
|
119
|
+
if ( $.inArray(el, els) < 0 )
|
120
|
+
$.event.remove(el, query.type, query.fn);
|
121
|
+
});
|
122
|
+
}
|
123
|
+
else {
|
124
|
+
// Call the first function for newly matched elements
|
125
|
+
nEls.each(function() {
|
126
|
+
query.fn.apply(this);
|
127
|
+
});
|
128
|
+
|
129
|
+
// Call the second function for elements no longer matched
|
130
|
+
if ( this.fn2 && oEls.length > 0 )
|
131
|
+
$.each(oEls, function(i, el) {
|
132
|
+
if ( $.inArray(el, els) < 0 )
|
133
|
+
query.fn2.apply(el);
|
134
|
+
});
|
135
|
+
}
|
136
|
+
}
|
137
|
+
};
|
138
|
+
|
139
|
+
$.extend($.livequery, {
|
140
|
+
guid: 0,
|
141
|
+
queries: [],
|
142
|
+
queue: [],
|
143
|
+
running: false,
|
144
|
+
timeout: null,
|
145
|
+
|
146
|
+
checkQueue: function() {
|
147
|
+
if ( $.livequery.running && $.livequery.queue.length ) {
|
148
|
+
var length = $.livequery.queue.length;
|
149
|
+
// Run each Live Query currently in the queue
|
150
|
+
while ( length-- )
|
151
|
+
$.livequery.queries[ $.livequery.queue.shift() ].run();
|
152
|
+
}
|
153
|
+
},
|
154
|
+
|
155
|
+
pause: function() {
|
156
|
+
// Don't run anymore Live Queries until restarted
|
157
|
+
$.livequery.running = false;
|
158
|
+
},
|
159
|
+
|
160
|
+
play: function() {
|
161
|
+
// Restart Live Queries
|
162
|
+
$.livequery.running = true;
|
163
|
+
// Request a run of the Live Queries
|
164
|
+
$.livequery.run();
|
165
|
+
},
|
166
|
+
|
167
|
+
registerPlugin: function() {
|
168
|
+
$.each( arguments, function(i,n) {
|
169
|
+
// Short-circuit if the method doesn't exist
|
170
|
+
if (!$.fn[n]) return;
|
171
|
+
|
172
|
+
// Save a reference to the original method
|
173
|
+
var old = $.fn[n];
|
174
|
+
|
175
|
+
// Create a new method
|
176
|
+
$.fn[n] = function() {
|
177
|
+
// Call the original method
|
178
|
+
var r = old.apply(this, arguments);
|
179
|
+
|
180
|
+
// Request a run of the Live Queries
|
181
|
+
$.livequery.run();
|
182
|
+
|
183
|
+
// Return the original methods result
|
184
|
+
return r;
|
185
|
+
}
|
186
|
+
});
|
187
|
+
},
|
188
|
+
|
189
|
+
run: function(id) {
|
190
|
+
if (id != undefined) {
|
191
|
+
// Put the particular Live Query in the queue if it doesn't already exist
|
192
|
+
if ( $.inArray(id, $.livequery.queue) < 0 )
|
193
|
+
$.livequery.queue.push( id );
|
194
|
+
}
|
195
|
+
else
|
196
|
+
// Put each Live Query in the queue if it doesn't already exist
|
197
|
+
$.each( $.livequery.queries, function(id) {
|
198
|
+
if ( $.inArray(id, $.livequery.queue) < 0 )
|
199
|
+
$.livequery.queue.push( id );
|
200
|
+
});
|
201
|
+
|
202
|
+
// Clear timeout if it already exists
|
203
|
+
if ($.livequery.timeout) clearTimeout($.livequery.timeout);
|
204
|
+
// Create a timeout to check the queue and actually run the Live Queries
|
205
|
+
$.livequery.timeout = setTimeout($.livequery.checkQueue, 20);
|
206
|
+
},
|
207
|
+
|
208
|
+
stop: function(id) {
|
209
|
+
if (id != undefined)
|
210
|
+
// Stop are particular Live Query
|
211
|
+
$.livequery.queries[ id ].stop();
|
212
|
+
else
|
213
|
+
// Stop all Live Queries
|
214
|
+
$.each( $.livequery.queries, function(id) {
|
215
|
+
$.livequery.queries[ id ].stop();
|
216
|
+
});
|
217
|
+
}
|
218
|
+
});
|
219
|
+
|
220
|
+
// Register core DOM manipulation methods
|
221
|
+
$.livequery.registerPlugin('append', 'prepend', 'after', 'before', 'wrap', 'attr', 'removeAttr', 'addClass', 'removeClass', 'toggleClass', 'empty', 'remove');
|
222
|
+
|
223
|
+
// Run Live Queries when the Document is ready
|
224
|
+
$(function() { $.livequery.play(); });
|
225
|
+
|
226
|
+
|
227
|
+
// Save a reference to the original init method
|
228
|
+
var init = $.prototype.init;
|
229
|
+
|
230
|
+
// Create a new init method that exposes two new properties: selector and context
|
231
|
+
$.prototype.init = function(a,c) {
|
232
|
+
// Call the original init and save the result
|
233
|
+
var r = init.apply(this, arguments);
|
234
|
+
|
235
|
+
// Copy over properties if they exist already
|
236
|
+
if (a && a.selector)
|
237
|
+
r.context = a.context, r.selector = a.selector;
|
238
|
+
|
239
|
+
// Set properties
|
240
|
+
if ( typeof a == 'string' )
|
241
|
+
r.context = c || document, r.selector = a;
|
242
|
+
|
243
|
+
// Return the result
|
244
|
+
return r;
|
245
|
+
};
|
246
|
+
|
247
|
+
// Give the init function the jQuery prototype for later instantiation (needed after Rev 4091)
|
248
|
+
$.prototype.init.prototype = $.prototype;
|
249
|
+
|
250
|
+
})(jQuery);
|
@@ -0,0 +1,129 @@
|
|
1
|
+
/*
|
2
|
+
* Metadata - jQuery plugin for parsing metadata from elements
|
3
|
+
*
|
4
|
+
* Copyright (c) 2006 John Resig, Yehuda Katz, J�örn Zaefferer, Paul McLanahan
|
5
|
+
*
|
6
|
+
* Dual licensed under the MIT and GPL licenses:
|
7
|
+
* http://www.opensource.org/licenses/mit-license.php
|
8
|
+
* http://www.gnu.org/licenses/gpl.html
|
9
|
+
*
|
10
|
+
* Revision: $Id$
|
11
|
+
*
|
12
|
+
*/
|
13
|
+
|
14
|
+
/**
|
15
|
+
* Sets the type of metadata to use. Metadata is encoded in JSON, and each property
|
16
|
+
* in the JSON will become a property of the element itself.
|
17
|
+
*
|
18
|
+
* There are three supported types of metadata storage:
|
19
|
+
*
|
20
|
+
* attr: Inside an attribute. The name parameter indicates *which* attribute.
|
21
|
+
*
|
22
|
+
* class: Inside the class attribute, wrapped in curly braces: { }
|
23
|
+
*
|
24
|
+
* elem: Inside a child element (e.g. a script tag). The
|
25
|
+
* name parameter indicates *which* element.
|
26
|
+
*
|
27
|
+
* The metadata for an element is loaded the first time the element is accessed via jQuery.
|
28
|
+
*
|
29
|
+
* As a result, you can define the metadata type, use $(expr) to load the metadata into the elements
|
30
|
+
* matched by expr, then redefine the metadata type and run another $(expr) for other elements.
|
31
|
+
*
|
32
|
+
* @name $.metadata.setType
|
33
|
+
*
|
34
|
+
* @example <p id="one" class="some_class {item_id: 1, item_label: 'Label'}">This is a p</p>
|
35
|
+
* @before $.metadata.setType("class")
|
36
|
+
* @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
|
37
|
+
* @desc Reads metadata from the class attribute
|
38
|
+
*
|
39
|
+
* @example <p id="one" class="some_class" data="{item_id: 1, item_label: 'Label'}">This is a p</p>
|
40
|
+
* @before $.metadata.setType("attr", "data")
|
41
|
+
* @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
|
42
|
+
* @desc Reads metadata from a "data" attribute
|
43
|
+
*
|
44
|
+
* @example <p id="one" class="some_class"><script>{item_id: 1, item_label: 'Label'}</script>This is a p</p>
|
45
|
+
* @before $.metadata.setType("elem", "script")
|
46
|
+
* @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
|
47
|
+
* @desc Reads metadata from a nested script element
|
48
|
+
*
|
49
|
+
* @param String type The encoding type
|
50
|
+
* @param String name The name of the attribute to be used to get metadata (optional)
|
51
|
+
* @cat Plugins/Metadata
|
52
|
+
* @descr Sets the type of encoding to be used when loading metadata for the first time
|
53
|
+
* @type undefined
|
54
|
+
* @see metadata()
|
55
|
+
*/
|
56
|
+
|
57
|
+
(function($) {
|
58
|
+
|
59
|
+
$.extend({
|
60
|
+
metadata : {
|
61
|
+
defaults : {
|
62
|
+
type: 'class',
|
63
|
+
name: 'metadata',
|
64
|
+
cre: /({.*})/,
|
65
|
+
single: 'metadata'
|
66
|
+
},
|
67
|
+
setType: function( type, name ){
|
68
|
+
this.defaults.type = type;
|
69
|
+
this.defaults.name = name;
|
70
|
+
},
|
71
|
+
get: function( elem, opts ){
|
72
|
+
var settings = $.extend({},this.defaults,opts);
|
73
|
+
// check for empty string in single property
|
74
|
+
if ( !settings.single.length ) settings.single = 'metadata';
|
75
|
+
|
76
|
+
var data = $.data(elem, settings.single);
|
77
|
+
// returned cached data if it already exists
|
78
|
+
if ( data ) return data;
|
79
|
+
|
80
|
+
data = "{}";
|
81
|
+
|
82
|
+
if ( settings.type == "class" ) {
|
83
|
+
var m = settings.cre.exec( elem.className );
|
84
|
+
if ( m )
|
85
|
+
data = m[1];
|
86
|
+
} else if ( settings.type == "elem" ) {
|
87
|
+
if( !elem.getElementsByTagName ) return;
|
88
|
+
var e = elem.getElementsByTagName(settings.name);
|
89
|
+
if ( e.length )
|
90
|
+
data = $.trim(e[0].innerHTML);
|
91
|
+
} else if ( elem.getAttribute != undefined ) {
|
92
|
+
var attr = elem.getAttribute( settings.name );
|
93
|
+
if ( attr )
|
94
|
+
data = attr;
|
95
|
+
}
|
96
|
+
|
97
|
+
if ( data.indexOf( '{' ) <0 )
|
98
|
+
data = "{" + data + "}";
|
99
|
+
|
100
|
+
data = eval("(" + data + ")");
|
101
|
+
|
102
|
+
$.data( elem, settings.single, data );
|
103
|
+
return data;
|
104
|
+
}
|
105
|
+
}
|
106
|
+
});
|
107
|
+
|
108
|
+
/**
|
109
|
+
* Returns the metadata object for the first member of the jQuery object.
|
110
|
+
*
|
111
|
+
* @name metadata
|
112
|
+
* @descr Returns element's metadata object
|
113
|
+
* @param Object opts An object contianing settings to override the defaults
|
114
|
+
* @type jQuery
|
115
|
+
* @cat Plugins/Metadata
|
116
|
+
*/
|
117
|
+
$.fn.metadata = function( opts ){
|
118
|
+
if(this[0])
|
119
|
+
return $.metadata.get( this[0], opts );
|
120
|
+
};
|
121
|
+
|
122
|
+
$.fn.setMetadata = function( val ) {
|
123
|
+
return this.each(function() {
|
124
|
+
if(!this) return true;
|
125
|
+
$.data( this, $.metadata.defaults.single, val );
|
126
|
+
});
|
127
|
+
}
|
128
|
+
|
129
|
+
})(jQuery);
|
@@ -24,9 +24,11 @@
|
|
24
24
|
$(this).addClass('passed');
|
25
25
|
})
|
26
26
|
.bind('failed', function(e, reason) {
|
27
|
+
reasonText = "<p>" + reason.toString() + "</p>";
|
28
|
+
if(reason.stack) reasonText += ("<pre>" + reason.stack + "</pre>");
|
27
29
|
$(this)
|
28
30
|
.addClass('failed')
|
29
|
-
.append($('<p class="error">').
|
31
|
+
.append($('<p class="error">').html(reasonText));
|
30
32
|
})
|
31
33
|
})
|
32
34
|
.bind('before', function() {
|
@@ -37,7 +37,6 @@ Screw.Matchers = (function($) {
|
|
37
37
|
return 'expected ' + $.print(jquerize(actual)) + (not ? ' to not have ' : ' to have ') + $.print(expected);
|
38
38
|
}
|
39
39
|
},
|
40
|
-
|
41
40
|
have: {
|
42
41
|
match: function(expected, actual) {
|
43
42
|
return jquerize(actual).find(expected).length > 0;
|
@@ -46,7 +45,6 @@ Screw.Matchers = (function($) {
|
|
46
45
|
return 'expected ' + $.print(jquerize(actual)) + (not ? ' to not have ' : ' to have ') + $.print(expected);
|
47
46
|
}
|
48
47
|
},
|
49
|
-
|
50
48
|
be_visible: {
|
51
49
|
match: function(expected, actual) {
|
52
50
|
return jquerize(actual).is(":visible");
|
@@ -93,7 +91,7 @@ Screw.Matchers = (function($) {
|
|
93
91
|
|
94
92
|
be_empty: {
|
95
93
|
match: function(expected, actual) {
|
96
|
-
if (jquerize(actual).length == undefined)
|
94
|
+
if (jquerize(actual).length == undefined)
|
97
95
|
throw($.print(jquerize(actual)) + " does not respond to length");
|
98
96
|
|
99
97
|
return actual.length == 0;
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: merb_screw_unit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yehuda Katz
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-10-
|
12
|
+
date: 2008-10-14 00:00:00 +03:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 0.9.
|
23
|
+
version: 0.9.9
|
24
24
|
version:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: merb-slices
|
@@ -30,7 +30,7 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.9.
|
33
|
+
version: 0.9.9
|
34
34
|
version:
|
35
35
|
description: Merb Slice that provides support for Screw.Unit testing
|
36
36
|
email: ykatz@engineyard.com
|
@@ -50,10 +50,6 @@ files:
|
|
50
50
|
- lib/merb_screw_unit/merbtasks.rb
|
51
51
|
- lib/merb_screw_unit/slicetasks.rb
|
52
52
|
- lib/merb_screw_unit.rb
|
53
|
-
- spec/controllers
|
54
|
-
- spec/controllers/main_spec.rb
|
55
|
-
- spec/merb_screw_unit_spec.rb
|
56
|
-
- spec/spec_helper.rb
|
57
53
|
- app/controllers
|
58
54
|
- app/controllers/application.rb
|
59
55
|
- app/controllers/main.rb
|
@@ -65,10 +61,13 @@ files:
|
|
65
61
|
- app/views/main
|
66
62
|
- app/views/main/index.html.erb
|
67
63
|
- public/javascripts
|
64
|
+
- public/javascripts/application.js
|
68
65
|
- public/javascripts/jquery-1.2.6.js
|
69
66
|
- public/javascripts/jquery.fn.js
|
70
67
|
- public/javascripts/jquery.print.js
|
68
|
+
- public/javascripts/livequery.jquery.js
|
71
69
|
- public/javascripts/master.js
|
70
|
+
- public/javascripts/metadata.jquery.js
|
72
71
|
- public/javascripts/screw.behaviors.js
|
73
72
|
- public/javascripts/screw.builder.js
|
74
73
|
- public/javascripts/screw.events.js
|
@@ -1,61 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
-
|
3
|
-
describe "MerbScrewUnit::Main (controller)" do
|
4
|
-
|
5
|
-
# Feel free to remove the specs below
|
6
|
-
|
7
|
-
before :all do
|
8
|
-
Merb::Router.prepare { |r| r.add_slice(:MerbScrewUnit) } if standalone?
|
9
|
-
end
|
10
|
-
|
11
|
-
after :all do
|
12
|
-
Merb::Router.reset! if standalone?
|
13
|
-
end
|
14
|
-
|
15
|
-
it "should have access to the slice module" do
|
16
|
-
controller = dispatch_to(MerbScrewUnit::Main, :index)
|
17
|
-
controller.slice.should == MerbScrewUnit
|
18
|
-
controller.slice.should == MerbScrewUnit::Main.slice
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should have an index action" do
|
22
|
-
controller = dispatch_to(MerbScrewUnit::Main, :index)
|
23
|
-
controller.status.should == 200
|
24
|
-
controller.body.should contain('MerbScrewUnit')
|
25
|
-
end
|
26
|
-
|
27
|
-
it "should work with the default route" do
|
28
|
-
controller = get("/merb_screw_unit/main/index")
|
29
|
-
controller.should be_kind_of(MerbScrewUnit::Main)
|
30
|
-
controller.action_name.should == 'index'
|
31
|
-
end
|
32
|
-
|
33
|
-
it "should work with the example named route" do
|
34
|
-
controller = get("/merb_screw_unit/index.html")
|
35
|
-
controller.should be_kind_of(MerbScrewUnit::Main)
|
36
|
-
controller.action_name.should == 'index'
|
37
|
-
end
|
38
|
-
|
39
|
-
it "should have routes in MerbScrewUnit.routes" do
|
40
|
-
MerbScrewUnit.routes.should_not be_empty
|
41
|
-
end
|
42
|
-
|
43
|
-
it "should have a slice_url helper method for slice-specific routes" do
|
44
|
-
controller = dispatch_to(MerbScrewUnit::Main, 'index')
|
45
|
-
controller.slice_url(:action => 'show', :format => 'html').should == "/merb_screw_unit/main/show.html"
|
46
|
-
controller.slice_url(:merb_screw_unit_index, :format => 'html').should == "/merb_screw_unit/index.html"
|
47
|
-
end
|
48
|
-
|
49
|
-
it "should have helper methods for dealing with public paths" do
|
50
|
-
controller = dispatch_to(MerbScrewUnit::Main, :index)
|
51
|
-
controller.public_path_for(:image).should == "/slices/merb_screw_unit/images"
|
52
|
-
controller.public_path_for(:javascript).should == "/slices/merb_screw_unit/javascripts"
|
53
|
-
controller.public_path_for(:stylesheet).should == "/slices/merb_screw_unit/stylesheets"
|
54
|
-
end
|
55
|
-
|
56
|
-
it "should have a slice-specific _template_root" do
|
57
|
-
MerbScrewUnit::Main._template_root.should == MerbScrewUnit.dir_for(:view)
|
58
|
-
MerbScrewUnit::Main._template_root.should == MerbScrewUnit::Application._template_root
|
59
|
-
end
|
60
|
-
|
61
|
-
end
|
@@ -1,130 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/spec_helper'
|
2
|
-
|
3
|
-
describe "MerbScrewUnit (module)" do
|
4
|
-
|
5
|
-
it "should have proper specs"
|
6
|
-
|
7
|
-
# Feel free to remove the specs below
|
8
|
-
|
9
|
-
before :all do
|
10
|
-
Merb::Router.prepare { |r| r.add_slice(:MerbScrewUnit) } if standalone?
|
11
|
-
end
|
12
|
-
|
13
|
-
after :all do
|
14
|
-
Merb::Router.reset! if standalone?
|
15
|
-
end
|
16
|
-
|
17
|
-
it "should be registered in Merb::Slices.slices" do
|
18
|
-
Merb::Slices.slices.should include(MerbScrewUnit)
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should be registered in Merb::Slices.paths" do
|
22
|
-
Merb::Slices.paths[MerbScrewUnit.name].should == current_slice_root
|
23
|
-
end
|
24
|
-
|
25
|
-
it "should have an :identifier property" do
|
26
|
-
MerbScrewUnit.identifier.should == "merb_screw_unit"
|
27
|
-
end
|
28
|
-
|
29
|
-
it "should have an :identifier_sym property" do
|
30
|
-
MerbScrewUnit.identifier_sym.should == :merb_screw_unit
|
31
|
-
end
|
32
|
-
|
33
|
-
it "should have a :root property" do
|
34
|
-
MerbScrewUnit.root.should == Merb::Slices.paths[MerbScrewUnit.name]
|
35
|
-
MerbScrewUnit.root_path('app').should == current_slice_root / 'app'
|
36
|
-
end
|
37
|
-
|
38
|
-
it "should have a :file property" do
|
39
|
-
MerbScrewUnit.file.should == current_slice_root / 'lib' / 'merb_screw_unit.rb'
|
40
|
-
end
|
41
|
-
|
42
|
-
it "should have metadata properties" do
|
43
|
-
MerbScrewUnit.description.should == "MerbScrewUnit is a chunky Merb slice!"
|
44
|
-
MerbScrewUnit.version.should == "0.0.1"
|
45
|
-
MerbScrewUnit.author.should == "YOUR NAME"
|
46
|
-
end
|
47
|
-
|
48
|
-
it "should have :routes and :named_routes properties" do
|
49
|
-
MerbScrewUnit.routes.should_not be_empty
|
50
|
-
MerbScrewUnit.named_routes[:merb_screw_unit_index].should be_kind_of(Merb::Router::Route)
|
51
|
-
end
|
52
|
-
|
53
|
-
it "should have an url helper method for slice-specific routes" do
|
54
|
-
MerbScrewUnit.url(:controller => 'main', :action => 'show', :format => 'html').should == "/merb_screw_unit/main/show.html"
|
55
|
-
MerbScrewUnit.url(:merb_screw_unit_index, :format => 'html').should == "/merb_screw_unit/index.html"
|
56
|
-
end
|
57
|
-
|
58
|
-
it "should have a config property (Hash)" do
|
59
|
-
MerbScrewUnit.config.should be_kind_of(Hash)
|
60
|
-
end
|
61
|
-
|
62
|
-
it "should have bracket accessors as shortcuts to the config" do
|
63
|
-
MerbScrewUnit[:foo] = 'bar'
|
64
|
-
MerbScrewUnit[:foo].should == 'bar'
|
65
|
-
MerbScrewUnit[:foo].should == MerbScrewUnit.config[:foo]
|
66
|
-
end
|
67
|
-
|
68
|
-
it "should have a :layout config option set" do
|
69
|
-
MerbScrewUnit.config[:layout].should == :merb_screw_unit
|
70
|
-
end
|
71
|
-
|
72
|
-
it "should have a dir_for method" do
|
73
|
-
app_path = MerbScrewUnit.dir_for(:application)
|
74
|
-
app_path.should == current_slice_root / 'app'
|
75
|
-
[:view, :model, :controller, :helper, :mailer, :part].each do |type|
|
76
|
-
MerbScrewUnit.dir_for(type).should == app_path / "#{type}s"
|
77
|
-
end
|
78
|
-
public_path = MerbScrewUnit.dir_for(:public)
|
79
|
-
public_path.should == current_slice_root / 'public'
|
80
|
-
[:stylesheet, :javascript, :image].each do |type|
|
81
|
-
MerbScrewUnit.dir_for(type).should == public_path / "#{type}s"
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
it "should have a app_dir_for method" do
|
86
|
-
root_path = MerbScrewUnit.app_dir_for(:root)
|
87
|
-
root_path.should == Merb.root / 'slices' / 'merb_screw_unit'
|
88
|
-
app_path = MerbScrewUnit.app_dir_for(:application)
|
89
|
-
app_path.should == root_path / 'app'
|
90
|
-
[:view, :model, :controller, :helper, :mailer, :part].each do |type|
|
91
|
-
MerbScrewUnit.app_dir_for(type).should == app_path / "#{type}s"
|
92
|
-
end
|
93
|
-
public_path = MerbScrewUnit.app_dir_for(:public)
|
94
|
-
public_path.should == Merb.dir_for(:public) / 'slices' / 'merb_screw_unit'
|
95
|
-
[:stylesheet, :javascript, :image].each do |type|
|
96
|
-
MerbScrewUnit.app_dir_for(type).should == public_path / "#{type}s"
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
it "should have a public_dir_for method" do
|
101
|
-
public_path = MerbScrewUnit.public_dir_for(:public)
|
102
|
-
public_path.should == '/slices' / 'merb_screw_unit'
|
103
|
-
[:stylesheet, :javascript, :image].each do |type|
|
104
|
-
MerbScrewUnit.public_dir_for(type).should == public_path / "#{type}s"
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
it "should have a public_path_for method" do
|
109
|
-
public_path = MerbScrewUnit.public_dir_for(:public)
|
110
|
-
MerbScrewUnit.public_path_for("path", "to", "file").should == public_path / "path" / "to" / "file"
|
111
|
-
[:stylesheet, :javascript, :image].each do |type|
|
112
|
-
MerbScrewUnit.public_path_for(type, "path", "to", "file").should == public_path / "#{type}s" / "path" / "to" / "file"
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
it "should have a app_path_for method" do
|
117
|
-
MerbScrewUnit.app_path_for("path", "to", "file").should == MerbScrewUnit.app_dir_for(:root) / "path" / "to" / "file"
|
118
|
-
MerbScrewUnit.app_path_for(:controller, "path", "to", "file").should == MerbScrewUnit.app_dir_for(:controller) / "path" / "to" / "file"
|
119
|
-
end
|
120
|
-
|
121
|
-
it "should have a slice_path_for method" do
|
122
|
-
MerbScrewUnit.slice_path_for("path", "to", "file").should == MerbScrewUnit.dir_for(:root) / "path" / "to" / "file"
|
123
|
-
MerbScrewUnit.slice_path_for(:controller, "path", "to", "file").should == MerbScrewUnit.dir_for(:controller) / "path" / "to" / "file"
|
124
|
-
end
|
125
|
-
|
126
|
-
it "should keep a list of path component types to use when copying files" do
|
127
|
-
(MerbScrewUnit.mirrored_components & MerbScrewUnit.slice_paths.keys).length.should == MerbScrewUnit.mirrored_components.length
|
128
|
-
end
|
129
|
-
|
130
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'merb-core'
|
3
|
-
require 'merb-slices'
|
4
|
-
require 'spec'
|
5
|
-
|
6
|
-
# Add merb_screw_unit.rb to the search path
|
7
|
-
Merb::Plugins.config[:merb_slices][:auto_register] = true
|
8
|
-
Merb::Plugins.config[:merb_slices][:search_path] = File.join(File.dirname(__FILE__), '..', 'lib', 'merb_screw_unit.rb')
|
9
|
-
|
10
|
-
# Using Merb.root below makes sure that the correct root is set for
|
11
|
-
# - testing standalone, without being installed as a gem and no host application
|
12
|
-
# - testing from within the host application; its root will be used
|
13
|
-
Merb.start_environment(
|
14
|
-
:testing => true,
|
15
|
-
:adapter => 'runner',
|
16
|
-
:environment => ENV['MERB_ENV'] || 'test',
|
17
|
-
:merb_root => Merb.root,
|
18
|
-
:session_store => 'memory'
|
19
|
-
)
|
20
|
-
|
21
|
-
module Merb
|
22
|
-
module Test
|
23
|
-
module SliceHelper
|
24
|
-
|
25
|
-
# The absolute path to the current slice
|
26
|
-
def current_slice_root
|
27
|
-
@current_slice_root ||= File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
28
|
-
end
|
29
|
-
|
30
|
-
# Whether the specs are being run from a host application or standalone
|
31
|
-
def standalone?
|
32
|
-
Merb.root == ::MerbScrewUnit.root
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
Spec::Runner.configure do |config|
|
40
|
-
config.include(Merb::Test::ViewHelper)
|
41
|
-
config.include(Merb::Test::RouteHelper)
|
42
|
-
config.include(Merb::Test::ControllerHelper)
|
43
|
-
config.include(Merb::Test::SliceHelper)
|
44
|
-
end
|