ember-qunit-rails 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 201e8020ebf8b0355ceffc03778519e7e40cf43c
4
+ data.tar.gz: 6c7d9594afdac5490ea33118e455fd5843e860eb
5
+ SHA512:
6
+ metadata.gz: 536bfe945958bf39a0339171fb730eddfbc1d49f4fff0d00a978a8e4d3782e40e133b13fe3eb40969e928a4617e071a538b480e1ee29329b15bce81bef09559f
7
+ data.tar.gz: e5328a975b31f666bb4c4244b12b1e8180e6ce7486bc9d10a160dfd2234db280d629008a5da5cfd8510dd58772227e05de7980712af4967a4c8f17e83429fb57
@@ -0,0 +1,22 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in ember-qunit-rails.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Ben Colon
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,35 @@
1
+ # Ember-qunit-rails gem
2
+
3
+ Javascript [ember-qunit](https://github.com/rpflorence/ember-qunit) library in a Rails engine to use it with the Rails asset pipeline.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'ember-qunit-rails'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install ember-qunit-rails
18
+
19
+ ## Usage
20
+
21
+ Add this line to your JS manifest file:
22
+
23
+ //= require ember-qunit-rails
24
+
25
+ ## Version
26
+
27
+ Synced with [ember-qunit](https://github.com/rpflorence/ember-qunit) library version
28
+
29
+ ## Contributing
30
+
31
+ 1. Fork it ( https://github.com/[my-github-username]/ember-qunit-rails/fork )
32
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
33
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
34
+ 4. Push to the branch (`git push origin my-new-feature`)
35
+ 5. Create a new Pull Request
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'ember-qunit-rails/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "ember-qunit-rails"
8
+ spec.version = EmberQunitRails::VERSION
9
+ spec.authors = ["Ben Colon"]
10
+ spec.email = ["ben@colon.com.fr"]
11
+ spec.summary = "ember-qunit Javascript lib for Rails"
12
+ spec.description = "ember-qunit Javascript lib packaged for the Rails asset pipeline"
13
+ spec.homepage = "https://github.com/bencolon/ember-qunit-rails"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.6"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_dependency "railties", "> 3.1"
24
+ end
@@ -0,0 +1,6 @@
1
+ require "ember-qunit-rails/version"
2
+
3
+ module EmberQunitRails
4
+ class Engine < ::Rails::Engine
5
+ end
6
+ end
@@ -0,0 +1,3 @@
1
+ module EmberQunitRails
2
+ VERSION = "0.1.8"
3
+ end
@@ -0,0 +1,266 @@
1
+ !function(e){if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.emq=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
2
+ "use strict";
3
+ var testResolver = _dereq_("./test-resolver")["default"] || _dereq_("./test-resolver");
4
+ var Ember = window.Ember["default"] || window.Ember;
5
+
6
+ exports["default"] = function isolatedContainer(fullNames) {
7
+ var resolver = testResolver.get();
8
+ var container = new Ember.Container();
9
+ container.optionsForType('component', { singleton: false });
10
+ container.optionsForType('view', { singleton: false });
11
+ container.optionsForType('template', { instantiate: false });
12
+ container.optionsForType('helper', { instantiate: false });
13
+ container.register('component-lookup:main', Ember.ComponentLookup);
14
+ for (var i = fullNames.length; i > 0; i--) {
15
+ var fullName = fullNames[i - 1];
16
+ container.register(fullName, resolver.resolve(fullName));
17
+ }
18
+ return container;
19
+ }
20
+ },{"./test-resolver":7}],2:[function(_dereq_,module,exports){
21
+ "use strict";
22
+ var Ember = window.Ember["default"] || window.Ember;
23
+ var isolatedContainer = _dereq_("./isolated-container")["default"] || _dereq_("./isolated-container");
24
+ var moduleFor = _dereq_("./module-for")["default"] || _dereq_("./module-for");
25
+ var moduleForComponent = _dereq_("./module-for-component")["default"] || _dereq_("./module-for-component");
26
+ var moduleForModel = _dereq_("./module-for-model")["default"] || _dereq_("./module-for-model");
27
+ var test = _dereq_("./test")["default"] || _dereq_("./test");
28
+ var testResolver = _dereq_("./test-resolver")["default"] || _dereq_("./test-resolver");
29
+
30
+ Ember.testing = true;
31
+
32
+ function setResolver(resolver) {
33
+ testResolver.set(resolver);
34
+ }
35
+
36
+ function globalize() {
37
+ window.moduleFor = moduleFor;
38
+ window.moduleForComponent = moduleForComponent;
39
+ window.moduleForModel = moduleForModel;
40
+ window.test = test;
41
+ window.setResolver = setResolver;
42
+ }
43
+
44
+ exports.globalize = globalize;
45
+ exports.moduleFor = moduleFor;
46
+ exports.moduleForComponent = moduleForComponent;
47
+ exports.moduleForModel = moduleForModel;
48
+ exports.test = test;
49
+ exports.setResolver = setResolver;
50
+ },{"./isolated-container":1,"./module-for":5,"./module-for-component":3,"./module-for-model":4,"./test":8,"./test-resolver":7}],3:[function(_dereq_,module,exports){
51
+ "use strict";
52
+ var testResolver = _dereq_("./test-resolver")["default"] || _dereq_("./test-resolver");
53
+ var moduleFor = _dereq_("./module-for")["default"] || _dereq_("./module-for");
54
+ var Ember = window.Ember["default"] || window.Ember;
55
+
56
+ exports["default"] = function moduleForComponent(name, description, callbacks) {
57
+ var resolver = testResolver.get();
58
+
59
+ moduleFor('component:' + name, description, callbacks, function(container, context, defaultSubject) {
60
+ var layoutName = 'template:components/' + name;
61
+
62
+ var layout = resolver.resolve(layoutName);
63
+
64
+ if (layout) {
65
+ container.register(layoutName, layout);
66
+ container.injection('component:' + name, 'layout', layoutName);
67
+ }
68
+
69
+ context.dispatcher = Ember.EventDispatcher.create();
70
+ context.dispatcher.setup({}, '#ember-testing');
71
+
72
+ context.__setup_properties__.append = function(selector) {
73
+ var containerView = Ember.ContainerView.create({container: container});
74
+ var view = Ember.run(function(){
75
+ var subject = context.subject();
76
+ containerView.pushObject(subject);
77
+ // TODO: destory this somewhere
78
+ containerView.appendTo('#ember-testing');
79
+ return subject;
80
+ });
81
+
82
+ return view.$();
83
+ };
84
+ context.__setup_properties__.$ = context.__setup_properties__.append;
85
+ });
86
+ }
87
+ },{"./module-for":5,"./test-resolver":7}],4:[function(_dereq_,module,exports){
88
+ "use strict";
89
+ var moduleFor = _dereq_("./module-for")["default"] || _dereq_("./module-for");
90
+ var Ember = window.Ember["default"] || window.Ember;
91
+
92
+ exports["default"] = function moduleForModel(name, description, callbacks) {
93
+ moduleFor('model:' + name, description, callbacks, function(container, context, defaultSubject) {
94
+ if (DS._setupContainer) {
95
+ DS._setupContainer(container);
96
+ } else {
97
+ container.register('store:main', DS.Store);
98
+ }
99
+
100
+ var adapterFactory = container.lookupFactory('adapter:application');
101
+ if (!adapterFactory) {
102
+ container.register('adapter:application', DS.FixtureAdapter);
103
+ }
104
+
105
+ context.__setup_properties__.store = function(){
106
+ return container.lookup('store:main');
107
+ };
108
+
109
+ if (context.__setup_properties__.subject === defaultSubject) {
110
+ context.__setup_properties__.subject = function(options) {
111
+ return Ember.run(function() {
112
+ return container.lookup('store:main').createRecord(name, options);
113
+ });
114
+ };
115
+ }
116
+ });
117
+ }
118
+ },{"./module-for":5}],5:[function(_dereq_,module,exports){
119
+ "use strict";
120
+ var Ember = window.Ember["default"] || window.Ember;
121
+ //import QUnit from 'qunit'; // Assumed global in runner
122
+ var testContext = _dereq_("./test-context")["default"] || _dereq_("./test-context");
123
+ var isolatedContainer = _dereq_("./isolated-container")["default"] || _dereq_("./isolated-container");
124
+
125
+ exports["default"] = function moduleFor(fullName, description, callbacks, delegate) {
126
+ var container;
127
+ var context;
128
+
129
+ var _callbacks = {
130
+ setup: function(){
131
+ callbacks = callbacks || { };
132
+
133
+ var needs = [fullName].concat(callbacks.needs || []);
134
+ container = isolatedContainer(needs);
135
+
136
+ callbacks.subject = callbacks.subject || defaultSubject;
137
+
138
+ callbacks.setup = callbacks.setup || function() { };
139
+ callbacks.teardown = callbacks.teardown || function() { };
140
+
141
+ function factory() {
142
+ return container.lookupFactory(fullName);
143
+ }
144
+
145
+ testContext.set({
146
+ container: container,
147
+ factory: factory,
148
+ dispatcher: null,
149
+ __setup_properties__: callbacks
150
+ });
151
+
152
+ context = testContext.get();
153
+
154
+ if (delegate) {
155
+ delegate(container, context, defaultSubject);
156
+ }
157
+
158
+ if (Ember.$('#ember-testing').length === 0) {
159
+ Ember.$('<div id="ember-testing"/>').appendTo(document.body);
160
+ }
161
+
162
+ buildContextVariables(context);
163
+ callbacks.setup.call(context, container);
164
+ },
165
+
166
+ teardown: function(){
167
+ Ember.run(function(){
168
+ container.destroy();
169
+
170
+ if (context.dispatcher) {
171
+ context.dispatcher.destroy();
172
+ }
173
+ });
174
+
175
+ callbacks.teardown(container);
176
+ Ember.$('#ember-testing').empty();
177
+ }
178
+ };
179
+
180
+ QUnit.module(description || fullName, _callbacks);
181
+ }
182
+
183
+ function defaultSubject(options, factory) {
184
+ return factory.create(options);
185
+ }
186
+
187
+ // allow arbitrary named factories, like rspec let
188
+ function buildContextVariables(context) {
189
+ var cache = { };
190
+ var callbacks = context.__setup_properties__;
191
+ var container = context.container;
192
+ var factory = context.factory;
193
+
194
+ Ember.keys(callbacks).filter(function(key){
195
+ // ignore the default setup/teardown keys
196
+ return key !== 'setup' && key !== 'teardown';
197
+ }).forEach(function(key){
198
+ context[key] = function(options) {
199
+ if (cache[key]) { return cache[key]; }
200
+
201
+ var result = callbacks[key](options, factory(), container);
202
+ cache[key] = result;
203
+ return result;
204
+ };
205
+ });
206
+ }
207
+ },{"./isolated-container":1,"./test-context":6}],6:[function(_dereq_,module,exports){
208
+ "use strict";
209
+ var __test_context__;
210
+
211
+ function set(context) {
212
+ __test_context__ = context;
213
+ }
214
+
215
+ exports.set = set;function get() {
216
+ return __test_context__;
217
+ }
218
+
219
+ exports.get = get;
220
+ },{}],7:[function(_dereq_,module,exports){
221
+ "use strict";
222
+ var __resolver__;
223
+
224
+ function set(resolver) {
225
+ __resolver__ = resolver;
226
+ }
227
+
228
+ exports.set = set;function get() {
229
+ if (__resolver__ == null) throw new Error('you must set a resolver with `testResolver.set(resolver)`');
230
+ return __resolver__;
231
+ }
232
+
233
+ exports.get = get;
234
+ },{}],8:[function(_dereq_,module,exports){
235
+ "use strict";
236
+ var Ember = window.Ember["default"] || window.Ember;
237
+ //import QUnit from 'qunit'; // Assumed global in runner
238
+ var testContext = _dereq_("./test-context")["default"] || _dereq_("./test-context");
239
+
240
+ function resetViews() {
241
+ Ember.View.views = {};
242
+ }
243
+
244
+ exports["default"] = function test(testName, callback) {
245
+
246
+ function wrapper() {
247
+ var context = testContext.get();
248
+
249
+ resetViews();
250
+ var result = callback.call(context);
251
+
252
+ function failTestOnPromiseRejection(reason) {
253
+ ok(false, reason);
254
+ }
255
+
256
+ Ember.run(function(){
257
+ stop();
258
+ Ember.RSVP.Promise.cast(result)['catch'](failTestOnPromiseRejection)['finally'](start);
259
+ });
260
+ }
261
+
262
+ QUnit.test(testName, wrapper);
263
+ }
264
+ },{"./test-context":6}]},{},[2])
265
+ (2)
266
+ });
metadata ADDED
@@ -0,0 +1,95 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ember-qunit-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.8
5
+ platform: ruby
6
+ authors:
7
+ - Ben Colon
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-06-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: railties
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>'
46
+ - !ruby/object:Gem::Version
47
+ version: '3.1'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>'
53
+ - !ruby/object:Gem::Version
54
+ version: '3.1'
55
+ description: ember-qunit Javascript lib packaged for the Rails asset pipeline
56
+ email:
57
+ - ben@colon.com.fr
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - .gitignore
63
+ - Gemfile
64
+ - LICENSE.txt
65
+ - README.md
66
+ - Rakefile
67
+ - ember-qunit-rails.gemspec
68
+ - lib/ember-qunit-rails.rb
69
+ - lib/ember-qunit-rails/version.rb
70
+ - vendor/assets/javascripts/ember-qunit.js
71
+ homepage: https://github.com/bencolon/ember-qunit-rails
72
+ licenses:
73
+ - MIT
74
+ metadata: {}
75
+ post_install_message:
76
+ rdoc_options: []
77
+ require_paths:
78
+ - lib
79
+ required_ruby_version: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - '>='
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ required_rubygems_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ requirements: []
90
+ rubyforge_project:
91
+ rubygems_version: 2.2.2
92
+ signing_key:
93
+ specification_version: 4
94
+ summary: ember-qunit Javascript lib for Rails
95
+ test_files: []