magic_carpet 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +202 -0
- data/README.md +232 -0
- data/Rakefile +15 -0
- data/app/assets/javascripts/magic_carpet/application.js +13 -0
- data/app/assets/javascripts/magic_carpet/magic_carpet.js +80 -0
- data/app/assets/stylesheets/magic_carpet/application.css +13 -0
- data/app/controllers/magic_carpet/application_controller.rb +4 -0
- data/app/controllers/magic_carpet/js_fixtures_controller.rb +110 -0
- data/app/helpers/magic_carpet/application_helper.rb +4 -0
- data/app/helpers/magic_carpet/js_fixtures_helper.rb +139 -0
- data/config/routes.rb +3 -0
- data/lib/magic_carpet/engine.rb +12 -0
- data/lib/magic_carpet/version.rb +3 -0
- data/lib/magic_carpet.rb +4 -0
- data/lib/tasks/magic_carpet_tasks.rake +4 -0
- data/spec/controllers/magic_carpet/js_fixtures_controller_spec.rb +275 -0
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/javascripts/jquery-2.1.0.js +9111 -0
- data/spec/dummy/app/assets/javascripts/users.js +2 -0
- data/spec/dummy/app/assets/javascripts/wishes.js +2 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/assets/stylesheets/scaffold.css +56 -0
- data/spec/dummy/app/assets/stylesheets/users.css +4 -0
- data/spec/dummy/app/assets/stylesheets/wishes.css +4 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/controllers/users_controller.rb +58 -0
- data/spec/dummy/app/controllers/wishes_controller.rb +70 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/helpers/users_helper.rb +2 -0
- data/spec/dummy/app/helpers/wishes_helper.rb +2 -0
- data/spec/dummy/app/models/user.rb +3 -0
- data/spec/dummy/app/models/wish.rb +4 -0
- data/spec/dummy/app/views/layouts/application.html.erb +19 -0
- data/spec/dummy/app/views/layouts/other_layout.html.erb +15 -0
- data/spec/dummy/app/views/shared/_id_able.html.erb +5 -0
- data/spec/dummy/app/views/users/_form.html.erb +29 -0
- data/spec/dummy/app/views/users/edit.html.erb +6 -0
- data/spec/dummy/app/views/users/index.html.erb +31 -0
- data/spec/dummy/app/views/users/new.html.erb +5 -0
- data/spec/dummy/app/views/users/show.html.erb +19 -0
- data/spec/dummy/app/views/wishes/_form.html.erb +21 -0
- data/spec/dummy/app/views/wishes/_some_partial.html.erb +1 -0
- data/spec/dummy/app/views/wishes/_wish.html.erb +6 -0
- data/spec/dummy/app/views/wishes/_wish_list_item.html.erb +3 -0
- data/spec/dummy/app/views/wishes/edit.html.erb +6 -0
- data/spec/dummy/app/views/wishes/index.html.erb +22 -0
- data/spec/dummy/app/views/wishes/local_models.html.erb +3 -0
- data/spec/dummy/app/views/wishes/locals.html.erb +6 -0
- data/spec/dummy/app/views/wishes/new.html.erb +5 -0
- data/spec/dummy/app/views/wishes/numbers.html.erb +4 -0
- data/spec/dummy/app/views/wishes/plain.html.erb +1 -0
- data/spec/dummy/app/views/wishes/show.html.erb +9 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/config/application.rb +28 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +29 -0
- data/spec/dummy/config/environments/production.rb +80 -0
- data/spec/dummy/config/environments/test.rb +36 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +12 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +9 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/20140201230228_create_wishes.rb +9 -0
- data/spec/dummy/db/migrate/20140201230247_create_users.rb +11 -0
- data/spec/dummy/db/migrate/20140208042514_associate_users_and_wishes.rb +5 -0
- data/spec/dummy/db/schema.rb +31 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +21112 -0
- data/spec/dummy/log/test.log +33634 -0
- data/spec/dummy/public/404.html +58 -0
- data/spec/dummy/public/422.html +58 -0
- data/spec/dummy/public/500.html +57 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/spec/javascripts/helpers/spec_helper.js +367 -0
- data/spec/dummy/spec/javascripts/magic_carpet_spec.js +314 -0
- data/spec/dummy/spec/javascripts/support/jasmine.yml +29 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/0743af5c3f490550c6a448f45e6889b4 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/0800f54ee19cf3cee10b956fa9786799 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/082245bc7cce1345893a81643f76284a +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/08b0d9573e11dc361c93563cec2a0106 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/09f277e17472af932cda6f7dd86ff943 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/0e3142f2ae2a0b8902383f65b86a5299 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/0f87038bb320b83592e071bff83e4195 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/10925724a66880466e7f3b4e158196cb +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/10fb651bf6e564ad505e391670c11a8d +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/12090b2e7e2e9ac2632e486d02ee346a +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/142047722c23a8e9a96c6355d224b67e +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/1b4c56479f40fe3f7fc8daf684f4f71c +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/1c3579416ea74586464f5969c6949d5d +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/1e259f0863fa6da47ded59eef77ac351 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/21d2c592e1570709ecd1208a030cfc66 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/220ab8240fd9e0712b64dd9ff515f5df +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/277a51802284d997817fcaca55211243 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/28c409c3bba590030a8074120aa781db +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/35906b4cd565b14db8ba786fc66c7eb3 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/371bf96e99717688ed7313a0c53f4212 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/388a1d725ffd01cc06a34d720ea97775 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/4050a4e5062ab95c9f32e9b6940821ea +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/442917e5b534e0e7ac0a3bac0c5299e7 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/45ccf991e042a7cf7abe52d1125eeae3 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/469198efe71fedae413489ff2fad66e4 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/4817f65b5fc5c2042e04af7eb83a4c99 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/497ff8927ce695e3febb3cdfd3e4a74e +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/510da110ae528e2d22533be39ff696c5 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/51202fde1d49c04c5d5588ca203b7b1e +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/55ea602f40a0ad2185e22964a16b4d42 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/596788b2d37e650dd4cf582b185f9d37 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/5c09faba4e454de97f078861e82db15c +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/5f1a0d05e77ca8b9a1fc2a47e17a8174 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/64de9e1fa2dd01768d6e85552dcdb18a +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/68c5fa1f98ca79274b1f6750d8611af5 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/6bcea01ea8389e9a2ee296904803a01c +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/6fc757c2c8329244ca95d6909865bbc2 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/7406b6e2ecfc7b024db7822fb753c796 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/744bda5bad4a3b9b9b244a4583fb6e29 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/786804147f5da16b37ef8932e422797c +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/793dc2ede21315a9eabfe2b0a0ff13d4 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/7b1c8fbfabc405ee6e5c8887095e6b43 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/7c2edc3a2733a7bc22c572af66983a2e +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/7cd1032c2c1fa8a02016ac207cd9c76f +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/7d4bf0f7a6d67ade27f05b9bbdfaa13f +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/809136388a8f6d7a862b20361fad205c +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/80ba335c5610df2a1defeab247d03cc9 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/817b43e6477d4059b9006261356b7147 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/81b537f4760199f4030b928268605909 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/83521bb0fd5da34426e16d8825eb314e +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/85b590662faa5956a7cb3a38390f16ca +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/8733ef9be8fb368ac9aa5b1ccbfce14c +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/87b209c0c9da28094a8d5581a21262c6 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/8931ae3296ab13e8eed90f434208887f +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/8cb4c1afbd9a270155d8cdd697a8b20d +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/8d1f1fbd708160b30af96a108fef6c0d +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/91ef1ca0ef363be62f4a38fb3fbc2291 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/9a25637a28779d7c49c40044188bd0e5 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/a0d10779d647db6ab1328734733a0e4d +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/a0e04aab47dc3631152c26632687f898 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/a74883b193a8e72f27cba5703a696a89 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/a839288628913e4533ef8cba740de1eb +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/a95ead461bd72142ffb3040f8cd7cfa0 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/ac47afc414ae67e366a330dc003edf1a +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/b1d1383958868d6f0e9e05c848682d70 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/b4ff5ac95c02b56ca97786b337f8b845 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/b718bc4e8c8146520d982e086897fe24 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/b848029d2fa6db3db28ccbce818b399b +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/ba05f15307eb6d2c7e31e50768867139 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/c1a8bdfcb2dca842a48acc85d3ff658a +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/c2eb6c5cabed0e6b333c035ac8400bbc +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/c3dbe303660d299b488648fc157fd32b +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/c45af704cb234484a8e1d0852f8fe0bc +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/c4868ba5188e0672b480e24d979224d0 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/caa2f86bb055636b69e292f2ae993914 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/ce4b669883cb8df0ccd1c6aca12e0434 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/cebc6db0bbb8120f430da3970b173d2f +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/d8a7bed1e7150777f59a9e107c1acaa8 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/db4f843f0e597f7ba079bec345a91d58 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/dd5a838f402c1f78ff0f6e43b3ce6624 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/dfd7187ca1d53815395570d20d933e13 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/e4092eb95487a855cb730373c97b8756 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/e41b3d9532b5ef87c246ef6eb88417ed +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/e8266bddb6510ce3a2bc5ae1469ab3f6 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/e86f67e739e4d85d5b8b1830b327ee67 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/efc1c13c84f6f8686ade375b47913c8d +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/f1e3cae1b4d4c1085b32f88d26fd1f89 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/f21b1a83f2c41f61ba73c424b057ee19 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/f25cc7f3223a9259336cb2dd38df220e +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/f56253b5f374fff1a33fbbc9881c9124 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/10fb651bf6e564ad505e391670c11a8d +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/142047722c23a8e9a96c6355d224b67e +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/371bf96e99717688ed7313a0c53f4212 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/4050a4e5062ab95c9f32e9b6940821ea +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/51202fde1d49c04c5d5588ca203b7b1e +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/596788b2d37e650dd4cf582b185f9d37 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/5f1a0d05e77ca8b9a1fc2a47e17a8174 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/6fc757c2c8329244ca95d6909865bbc2 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/81b537f4760199f4030b928268605909 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/87b209c0c9da28094a8d5581a21262c6 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/8cb4c1afbd9a270155d8cdd697a8b20d +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/f56253b5f374fff1a33fbbc9881c9124 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/spec/dummy/tmp/jasmine/assets/application.js +9132 -0
- data/spec/dummy/tmp/jasmine/assets/boot.js +204 -0
- data/spec/dummy/tmp/jasmine/assets/helpers/spec_helper.js +462 -0
- data/spec/dummy/tmp/jasmine/assets/jasmine-console-reporter.js +125 -0
- data/spec/dummy/tmp/jasmine/assets/jasmine-console-shims.js +31 -0
- data/spec/dummy/tmp/jasmine/assets/jasmine-html.js +360 -0
- data/spec/dummy/tmp/jasmine/assets/jasmine-specs.js +0 -0
- data/spec/dummy/tmp/jasmine/assets/jasmine.css +55 -0
- data/spec/dummy/tmp/jasmine/assets/jasmine.js +2403 -0
- data/spec/dummy/tmp/jasmine/assets/jquery-2.1.0.js +9112 -0
- data/spec/dummy/tmp/jasmine/assets/json2.js +479 -0
- data/spec/dummy/tmp/jasmine/assets/magic_carpet/application.js +95 -0
- data/spec/dummy/tmp/jasmine/assets/magic_carpet/magic_carpet.js +81 -0
- data/spec/dummy/tmp/jasmine/assets/magic_carpet_spec.js +317 -0
- data/spec/dummy/tmp/jasmine/assets/users.js +3 -0
- data/spec/dummy/tmp/jasmine/assets/wishes.js +3 -0
- data/spec/dummy/tmp/jasmine/runner.html +28 -0
- data/spec/dummy/tmp/pids/server.pid +1 -0
- data/spec/helpers/magic_carpet/js_fixtures_helper_spec.rb +249 -0
- data/spec/spec_helper.rb +14 -0
- metadata +590 -0
@@ -0,0 +1,317 @@
|
|
1
|
+
describe("MagicCarpet", function() {
|
2
|
+
var subject;
|
3
|
+
|
4
|
+
beforeEach(function() {
|
5
|
+
subject = MagicCarpet;
|
6
|
+
});
|
7
|
+
|
8
|
+
afterEach(function() {
|
9
|
+
$("#magic-carpet").remove();
|
10
|
+
});
|
11
|
+
|
12
|
+
it("has its async property set to false by default", function(){
|
13
|
+
expect(subject.async).toBeFalse();
|
14
|
+
});
|
15
|
+
|
16
|
+
it("has its asyncComplete property set to true by default", function(){
|
17
|
+
expect(subject.asyncComplete).toBeTrue();
|
18
|
+
});
|
19
|
+
|
20
|
+
it("has an object for caching request results", function(){
|
21
|
+
expect(subject.cache).toBeObject();
|
22
|
+
});
|
23
|
+
|
24
|
+
describe("initialize", function() {
|
25
|
+
beforeEach(function() {
|
26
|
+
spyOn(subject, "cacheElements");
|
27
|
+
spyOn(subject, "appendSandbox");
|
28
|
+
spyOn(subject, "bindAll");
|
29
|
+
subject.initialize();
|
30
|
+
});
|
31
|
+
|
32
|
+
it("caches the necessary elements", function() {
|
33
|
+
expect(subject.cacheElements).toHaveBeenCalled();
|
34
|
+
});
|
35
|
+
|
36
|
+
it("appends the sandbox", function(){
|
37
|
+
expect(subject.appendSandbox).toHaveBeenCalled();
|
38
|
+
});
|
39
|
+
|
40
|
+
it("binds all of its functions", function(){
|
41
|
+
expect(subject.bindAll).toHaveBeenCalled();
|
42
|
+
});
|
43
|
+
});
|
44
|
+
|
45
|
+
describe("bindAll", function(){
|
46
|
+
var dummyFunction;
|
47
|
+
beforeEach(function() {
|
48
|
+
subject.dummyOption = false;
|
49
|
+
dummyFunction = function() { this.dummyOption = true; };
|
50
|
+
subject.dummy = dummyFunction;
|
51
|
+
subject.bindAll();
|
52
|
+
});
|
53
|
+
|
54
|
+
afterEach(function() {
|
55
|
+
delete subject.dummy;
|
56
|
+
delete subject.dummyOption;
|
57
|
+
});
|
58
|
+
|
59
|
+
it("binds all methods", function(){
|
60
|
+
expect(subject.dummy).not.toEqual(dummyFunction);
|
61
|
+
subject.dummy();
|
62
|
+
expect(subject.dummyOption).toBeTrue();
|
63
|
+
});
|
64
|
+
});
|
65
|
+
|
66
|
+
describe("bind", function(){
|
67
|
+
it("binds the function to the context", function(){
|
68
|
+
var obj = {};
|
69
|
+
obj.func = function(arg) { this.funcArg = arg; };
|
70
|
+
subject.bind(obj, "func");
|
71
|
+
var func = obj.func;
|
72
|
+
func("arg");
|
73
|
+
expect(obj.funcArg).toEqual("arg");
|
74
|
+
});
|
75
|
+
});
|
76
|
+
|
77
|
+
describe("cacheElements", function() {
|
78
|
+
beforeEach(function() {
|
79
|
+
spyOn(subject, "createSandbox").and.returnValue("sandbox");
|
80
|
+
subject.cacheElements();
|
81
|
+
});
|
82
|
+
|
83
|
+
it("caches a sandbox", function() {
|
84
|
+
expect(subject.sandbox).toEqual("sandbox");
|
85
|
+
});
|
86
|
+
});
|
87
|
+
|
88
|
+
describe("createSandbox", function() {
|
89
|
+
it("returns a div", function() {
|
90
|
+
expect(subject.createSandbox().tagName).toEqual("DIV");
|
91
|
+
});
|
92
|
+
|
93
|
+
it("returns a div with an ID of #magic-carpet", function() {
|
94
|
+
expect(subject.createSandbox().getAttribute("id")).toEqual("magic-carpet");
|
95
|
+
});
|
96
|
+
});
|
97
|
+
|
98
|
+
describe("appendSandbox", function() {
|
99
|
+
beforeEach(function() {
|
100
|
+
subject.cacheElements();
|
101
|
+
subject.appendSandbox();
|
102
|
+
});
|
103
|
+
|
104
|
+
it("appends the sandbox to the body", function() {
|
105
|
+
expect(subject.sandbox).toBeDefined();
|
106
|
+
expect(subject.sandbox).toEqual($("body #magic-carpet")[0]);
|
107
|
+
});
|
108
|
+
});
|
109
|
+
|
110
|
+
describe("emptySandbox", function(){
|
111
|
+
beforeEach(function() {
|
112
|
+
subject.cacheElements();
|
113
|
+
subject.sandbox.innerHTML = '<div id="dummy"></div>';
|
114
|
+
subject.emptySandbox();
|
115
|
+
});
|
116
|
+
|
117
|
+
it("empties the sandbox", function(){
|
118
|
+
expect($("#dummy")[0]).toBeUndefined();
|
119
|
+
expect(subject.sandbox.innerHTML).toEqual("");
|
120
|
+
});
|
121
|
+
});
|
122
|
+
|
123
|
+
describe("request", function(){
|
124
|
+
var requestData;
|
125
|
+
beforeEach(function() {
|
126
|
+
subject.cacheElements();
|
127
|
+
spyOn(subject, "fetch");
|
128
|
+
requestData = { some: "template" };
|
129
|
+
});
|
130
|
+
|
131
|
+
it("fetches the markup if the request isn't cached", function(){
|
132
|
+
subject.cache = {};
|
133
|
+
subject.request(requestData);
|
134
|
+
expect(subject.fetch).toHaveBeenCalledWith(requestData);
|
135
|
+
expect(subject.sandbox.innerHTML).toEqual("");
|
136
|
+
});
|
137
|
+
|
138
|
+
it("puts the markup on the page when it's already cached", function(){
|
139
|
+
subject.cache[$.param(requestData)] = "markup";
|
140
|
+
subject.request(requestData);
|
141
|
+
expect(subject.fetch).not.toHaveBeenCalled();
|
142
|
+
expect(subject.sandbox.innerHTML).toEqual("markup");
|
143
|
+
});
|
144
|
+
});
|
145
|
+
|
146
|
+
describe("fetch", function(){
|
147
|
+
var arg;
|
148
|
+
beforeEach(function() {
|
149
|
+
subject.asyncComplete = true;
|
150
|
+
subject.lastRequest = undefined;
|
151
|
+
spyOn($, "ajax").and.returnValue(promiseStub);
|
152
|
+
subject.async = "default async setting";
|
153
|
+
subject.fetch("data");
|
154
|
+
arg = $.ajax.calls.argsFor(0)[0];
|
155
|
+
});
|
156
|
+
|
157
|
+
it("makes a get request to /magic_carpet", function(){
|
158
|
+
expect(arg.url).toEqual("/magic_carpet");
|
159
|
+
expect(arg.method).toEqual("get");
|
160
|
+
});
|
161
|
+
|
162
|
+
it("uses the global magic carpet async setting", function(){
|
163
|
+
expect(arg.async).toEqual("default async setting");
|
164
|
+
});
|
165
|
+
|
166
|
+
it("passes its argument as data", function(){
|
167
|
+
expect(arg.data).toEqual("data");
|
168
|
+
});
|
169
|
+
|
170
|
+
it("sets asyncComplete to false", function(){
|
171
|
+
expect(subject.asyncComplete).toBeFalse();
|
172
|
+
});
|
173
|
+
|
174
|
+
it("handles success", function(){
|
175
|
+
expect(promiseStub.done).toHaveBeenCalledWith(subject.handleSuccess);
|
176
|
+
});
|
177
|
+
|
178
|
+
it("handles failure", function(){
|
179
|
+
expect(promiseStub.fail).toHaveBeenCalledWith(subject.handleFailure);
|
180
|
+
});
|
181
|
+
|
182
|
+
it("cleans up after itself", function(){
|
183
|
+
expect(promiseStub.always).toHaveBeenCalledWith(subject.afterRequest);
|
184
|
+
});
|
185
|
+
|
186
|
+
it("caches the request object", function(){
|
187
|
+
expect(subject.lastRequest).toEqual("data");
|
188
|
+
});
|
189
|
+
});
|
190
|
+
|
191
|
+
describe("handleSuccess", function(){
|
192
|
+
var lastRequest;
|
193
|
+
var markup;
|
194
|
+
beforeEach(function() {
|
195
|
+
subject.appendSandbox();
|
196
|
+
lastRequest = { some: "template" };
|
197
|
+
subject.lastRequest = lastRequest;
|
198
|
+
subject.cache = {};
|
199
|
+
markup = '<div id="fresh-markup"></div>';
|
200
|
+
subject.handleSuccess(markup);
|
201
|
+
});
|
202
|
+
|
203
|
+
it("puts the markup in the sandbox", function(){
|
204
|
+
expect($("#magic-carpet #fresh-markup")[0]).toBeDefined();
|
205
|
+
});
|
206
|
+
|
207
|
+
it("caches the markup", function(){
|
208
|
+
expect(subject.cache[$.param(lastRequest)]).toEqual(markup);
|
209
|
+
});
|
210
|
+
});
|
211
|
+
|
212
|
+
describe("handleFailure", function(){
|
213
|
+
it("throws an error with a message", function(){
|
214
|
+
var errorObj = { error: "There was a problem" };
|
215
|
+
var response = { responseJSON: errorObj };
|
216
|
+
expect(function() {
|
217
|
+
subject.handleFailure(response);
|
218
|
+
}).toThrow(new Error(errorObj.error));
|
219
|
+
});
|
220
|
+
});
|
221
|
+
|
222
|
+
describe("afterRequest", function(){
|
223
|
+
beforeEach(function() {
|
224
|
+
subject.asyncComplete = false;
|
225
|
+
subject.afterRequest();
|
226
|
+
});
|
227
|
+
|
228
|
+
it("sets asyncComplete to true", function(){
|
229
|
+
expect(subject.asyncComplete).toBeTrue();
|
230
|
+
});
|
231
|
+
});
|
232
|
+
|
233
|
+
describe("integration specs", function(){
|
234
|
+
beforeEach(function() {
|
235
|
+
subject.async = false;
|
236
|
+
subject.initialize();
|
237
|
+
console.log("*********************************************");
|
238
|
+
console.log(window.location);
|
239
|
+
console.log("*********************************************");
|
240
|
+
});
|
241
|
+
|
242
|
+
describe("templates", function(){
|
243
|
+
it("renders templates", function(){
|
244
|
+
subject.request({
|
245
|
+
controller_name: "Wishes",
|
246
|
+
template: "plain"
|
247
|
+
});
|
248
|
+
expect($("#magic-carpet h1")[0]).toBeDefined();
|
249
|
+
});
|
250
|
+
|
251
|
+
it("action_name can be used instead of template", function(){
|
252
|
+
subject.request({
|
253
|
+
controller_name: "Wishes",
|
254
|
+
action_name: "plain"
|
255
|
+
});
|
256
|
+
expect($("#magic-carpet h1")[0]).toBeDefined();
|
257
|
+
});
|
258
|
+
|
259
|
+
it("renders partials", function(){
|
260
|
+
subject.request({
|
261
|
+
controller_name: "Wishes",
|
262
|
+
partial: "some_partial"
|
263
|
+
});
|
264
|
+
expect($("#magic-carpet h1")[0]).toBeDefined();
|
265
|
+
});
|
266
|
+
|
267
|
+
it("renders local variables", function(){
|
268
|
+
subject.request({
|
269
|
+
controller_name: "Wishes",
|
270
|
+
partial: "wish_list_item",
|
271
|
+
locals: {
|
272
|
+
wish: { id: 1, model: "Wish", text: "some wish text" }
|
273
|
+
}
|
274
|
+
});
|
275
|
+
expect($("#magic-carpet li")[0]).toBeDefined();
|
276
|
+
});
|
277
|
+
|
278
|
+
it("renders collections (with 'as' option)", function(){
|
279
|
+
subject.request({
|
280
|
+
controller_name: "Wishes",
|
281
|
+
partial: "wish_list_item",
|
282
|
+
collection: [
|
283
|
+
{ id: 1, model: "Wish", text: "wish text" },
|
284
|
+
{ id: 2, model: "Wish", text: "wish text" },
|
285
|
+
{ id: 3, model: "Wish", text: "wish text" }
|
286
|
+
],
|
287
|
+
as: "wish"
|
288
|
+
});
|
289
|
+
expect($("#magic-carpet li").length).toEqual(3);
|
290
|
+
});
|
291
|
+
|
292
|
+
it("renders templates with instance variables", function(){
|
293
|
+
subject.request({
|
294
|
+
controller_name: "Wishes",
|
295
|
+
template: "new",
|
296
|
+
instance_variables: {
|
297
|
+
wish: {
|
298
|
+
model: "Wish"
|
299
|
+
}
|
300
|
+
}
|
301
|
+
});
|
302
|
+
expect($("#magic-carpet #new_wish")[0]).toBeDefined();
|
303
|
+
});
|
304
|
+
|
305
|
+
describe("errors", function(){
|
306
|
+
it("renders missing controller errors", function(){
|
307
|
+
expect(function() {
|
308
|
+
subject.request({
|
309
|
+
controller_name: "blort",
|
310
|
+
action_name: "new"
|
311
|
+
});
|
312
|
+
}).toThrow(new Error("Magic Carpet Error: wrong constant name blortController for 'new' template."));
|
313
|
+
});
|
314
|
+
});
|
315
|
+
});
|
316
|
+
});
|
317
|
+
});
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type"/>
|
5
|
+
<title>Jasmine Specs</title>
|
6
|
+
|
7
|
+
<link href="./assets/jasmine.css" media="screen" rel="stylesheet" />
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
<div id="jasmine_content"></div>
|
11
|
+
|
12
|
+
<script src="./assets/jasmine.js"></script>
|
13
|
+
<script src="./assets/jasmine-html.js"></script>
|
14
|
+
<script src="./assets/json2.js"></script>
|
15
|
+
<script src="./assets/boot.js"></script>
|
16
|
+
<script src="./assets/jasmine-console-shims.js"></script>
|
17
|
+
<script src="./assets/jasmine-console-reporter.js"></script>
|
18
|
+
<script src="./assets/jquery-2.1.0.js"></script>
|
19
|
+
<script src="./assets/users.js"></script>
|
20
|
+
<script src="./assets/wishes.js"></script>
|
21
|
+
<script src="./assets/application.js"></script>
|
22
|
+
<script src="./assets/magic_carpet/magic_carpet.js"></script>
|
23
|
+
<script src="./assets/magic_carpet/application.js"></script>
|
24
|
+
<script src="./assets/helpers/spec_helper.js"></script>
|
25
|
+
<script src="./assets/magic_carpet_spec.js"></script>
|
26
|
+
<script src="./assets/jasmine-specs.js"></script>
|
27
|
+
</body>
|
28
|
+
</html>
|
@@ -0,0 +1 @@
|
|
1
|
+
936
|
@@ -0,0 +1,249 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "ostruct"
|
3
|
+
|
4
|
+
module MagicCarpet
|
5
|
+
describe JsFixturesHelper do
|
6
|
+
describe "#hydrate" do
|
7
|
+
context "hashes" do
|
8
|
+
it "doesn't change the true values" do
|
9
|
+
original = { truncate: true }.with_indifferent_access
|
10
|
+
actual = helper.hydrate(original)
|
11
|
+
expect(actual[:truncate]).to be_true
|
12
|
+
end
|
13
|
+
|
14
|
+
it "doesn't change the false values" do
|
15
|
+
original = { truncate: false }.with_indifferent_access
|
16
|
+
actual = helper.hydrate(original)
|
17
|
+
expect(actual[:truncate]).to be_false
|
18
|
+
end
|
19
|
+
|
20
|
+
it "doesn't change the nil values" do
|
21
|
+
original = { truncate: nil }.with_indifferent_access
|
22
|
+
actual = helper.hydrate(original)
|
23
|
+
expect(actual[:truncate]).to be_nil
|
24
|
+
end
|
25
|
+
|
26
|
+
it "converts model hashes to models" do
|
27
|
+
hash = {
|
28
|
+
user: {
|
29
|
+
model: "User",
|
30
|
+
username: "username"
|
31
|
+
}.with_indifferent_access
|
32
|
+
}.with_indifferent_access
|
33
|
+
actual = helper.hydrate(hash)
|
34
|
+
expect(actual[:user].username).to eq("username")
|
35
|
+
end
|
36
|
+
|
37
|
+
it "converts numbers" do
|
38
|
+
hash = { some_number: { number: "1.2" } }
|
39
|
+
actual = helper.hydrate(hash)
|
40
|
+
expect(actual[:some_number]).to eq(1.2)
|
41
|
+
end
|
42
|
+
|
43
|
+
it "processes all values in an array" do
|
44
|
+
expected = [1, 2, 3].map { |num| "wish text #{num}" }
|
45
|
+
hash = {
|
46
|
+
wishes: [
|
47
|
+
{ model: "Wish", text: expected.first }.with_indifferent_access,
|
48
|
+
{ model: "Wish", text: expected.second }.with_indifferent_access,
|
49
|
+
{ model: "Wish", text: expected.last }.with_indifferent_access
|
50
|
+
]
|
51
|
+
}.with_indifferent_access
|
52
|
+
wishes = helper.hydrate(hash)[:wishes].map(&:text)
|
53
|
+
expect(wishes).to eq(expected)
|
54
|
+
end
|
55
|
+
|
56
|
+
it "processes all values in a nested hash" do
|
57
|
+
hash = {
|
58
|
+
numbers: [{ number: "5" }.with_indifferent_access],
|
59
|
+
named_wishes: {
|
60
|
+
favorite_wish: { model: "Wish", text: "fave" }.with_indifferent_access,
|
61
|
+
other_wishes: [
|
62
|
+
{ model: "Wish", text: "not fave" }.with_indifferent_access,
|
63
|
+
{ model: "Wish", text: "something silly" }.with_indifferent_access
|
64
|
+
]
|
65
|
+
}.with_indifferent_access
|
66
|
+
}.with_indifferent_access
|
67
|
+
|
68
|
+
actual = helper.hydrate(hash)
|
69
|
+
named_wishes = actual[:named_wishes]
|
70
|
+
expect(actual[:numbers]).to eq([5])
|
71
|
+
expect(named_wishes[:favorite_wish].text).to eq("fave")
|
72
|
+
expect(named_wishes[:other_wishes].map(&:text)).to eq(["not fave", "something silly"])
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
context "'numbers'" do
|
77
|
+
it "returns a float by default" do
|
78
|
+
hash = { number: "1.5" }.with_indifferent_access
|
79
|
+
actual = helper.hydrate(hash)
|
80
|
+
expect(actual).to eq(1.5)
|
81
|
+
expect(actual.class).to eq(Float)
|
82
|
+
end
|
83
|
+
|
84
|
+
it "returns an integer when 'integer' is set to true" do
|
85
|
+
hash = { number: "1.5", integer: true }.with_indifferent_access
|
86
|
+
actual = helper.hydrate(hash)
|
87
|
+
expect(actual).to eq(1)
|
88
|
+
expect(actual).to be_kind_of(Integer)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
context "dates and times" do
|
93
|
+
let(:now) { Time.now }
|
94
|
+
|
95
|
+
context "'dates'" do
|
96
|
+
it "returns a date" do
|
97
|
+
hash = { date: now.to_s }.with_indifferent_access
|
98
|
+
actual = helper.hydrate(hash)
|
99
|
+
expect(actual).to eq(Date.today)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
context "'times'" do
|
104
|
+
it "returns a time" do
|
105
|
+
hash = { time: now.to_s }.with_indifferent_access
|
106
|
+
actual = helper.hydrate(hash)
|
107
|
+
expect(actual.to_i).to eq(now.to_i)
|
108
|
+
end
|
109
|
+
|
110
|
+
it "returns a utc time when specified" do
|
111
|
+
hash = { time: now.to_s, utc: "true" }.with_indifferent_access
|
112
|
+
actual = helper.hydrate(hash)
|
113
|
+
expect(actual).to be_utc
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
context "'date times'" do
|
118
|
+
it "returns a date time" do
|
119
|
+
hash = { datetime: now.to_s }.with_indifferent_access
|
120
|
+
actual = helper.hydrate(hash)
|
121
|
+
expect(actual.class).to eq(DateTime)
|
122
|
+
expect(actual.to_time.to_i).to eq(now.to_time.to_i)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
context "nil" do
|
128
|
+
it "converts a string of 'nil' to nil" do
|
129
|
+
expect(helper.hydrate("nil")).to be_nil
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
context "false" do
|
134
|
+
it "converts a string of 'false' to false" do
|
135
|
+
expect(helper.hydrate("false")).to eq(false)
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
context "true" do
|
140
|
+
it "converts a string of 'true' to true" do
|
141
|
+
expect(helper.hydrate("true")).to eq(true)
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
context "'models'" do
|
146
|
+
it "converts the hash into the model specified by 'model'" do
|
147
|
+
hash = { model: "Wish", text: "wish text" }.with_indifferent_access
|
148
|
+
actual = helper.hydrate(hash)
|
149
|
+
expect(actual.attributes).to eq(Wish.new(text: "wish text").attributes)
|
150
|
+
end
|
151
|
+
|
152
|
+
it "converts nested associations into specified models" do
|
153
|
+
hash = {
|
154
|
+
model: "Wish",
|
155
|
+
text: "wish text",
|
156
|
+
user: {
|
157
|
+
username: "username",
|
158
|
+
model: "User"
|
159
|
+
}
|
160
|
+
}
|
161
|
+
wish = helper.hydrate(hash)
|
162
|
+
expect(wish.text).to eq("wish text")
|
163
|
+
expect(wish.user.username).to eq("username")
|
164
|
+
end
|
165
|
+
|
166
|
+
it "converts nested numbers" do
|
167
|
+
hash = {
|
168
|
+
model: "Wish",
|
169
|
+
id: "5",
|
170
|
+
text: "wish text",
|
171
|
+
user: {
|
172
|
+
username: "username",
|
173
|
+
model: "User",
|
174
|
+
id: "1"
|
175
|
+
}
|
176
|
+
}
|
177
|
+
wish = helper.hydrate(hash)
|
178
|
+
expect(wish.id).to eq(5)
|
179
|
+
expect(wish.user.id).to eq(1)
|
180
|
+
end
|
181
|
+
|
182
|
+
it "converts nested hashes and arrays" do
|
183
|
+
hash = {
|
184
|
+
model: "OpenStruct",
|
185
|
+
text: "ostruct",
|
186
|
+
array: [{ number: "5" }.with_indifferent_access],
|
187
|
+
my_hash: {
|
188
|
+
wish: { model: "Wish", text: "wish text" }
|
189
|
+
}
|
190
|
+
}
|
191
|
+
actual = helper.hydrate(hash)
|
192
|
+
expect(actual.text).to eq("ostruct")
|
193
|
+
expect(actual.array).to eq([5])
|
194
|
+
expect(actual.my_hash[:wish].text).to eq("wish text")
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
context "arrays" do
|
199
|
+
it "converts each element of the array" do
|
200
|
+
array = [
|
201
|
+
"hello",
|
202
|
+
{ number: "5" }.with_indifferent_access,
|
203
|
+
{ model: "Wish", text: "wish text" }.with_indifferent_access
|
204
|
+
]
|
205
|
+
string, number, wish = helper.hydrate(array)
|
206
|
+
expect(string).to eq("hello")
|
207
|
+
expect(number).to eq(5)
|
208
|
+
expect(wish.text).to eq("wish text")
|
209
|
+
end
|
210
|
+
|
211
|
+
it "converts nested arrays" do
|
212
|
+
array = [
|
213
|
+
[{ model: "Wish", text: "wish text" }.with_indifferent_access],
|
214
|
+
{ number: "5" }.with_indifferent_access
|
215
|
+
]
|
216
|
+
sub_array, number = helper.hydrate(array)
|
217
|
+
expect(sub_array.first.text).to eq("wish text")
|
218
|
+
expect(number).to eq(5)
|
219
|
+
end
|
220
|
+
|
221
|
+
it "converts hashes the array contains" do
|
222
|
+
array = [
|
223
|
+
{
|
224
|
+
my_wish: { model: "Wish", text: "my wish" }.with_indifferent_access,
|
225
|
+
my_number: { number: "5" }
|
226
|
+
}.with_indifferent_access
|
227
|
+
]
|
228
|
+
actual = helper.hydrate(array).first
|
229
|
+
expect(actual[:my_wish].text).to eq("my wish")
|
230
|
+
expect(actual[:my_number]).to eq(5)
|
231
|
+
end
|
232
|
+
end
|
233
|
+
|
234
|
+
context "'arrays'" do
|
235
|
+
it "converts each element of the 'array'" do
|
236
|
+
pretend_array = {
|
237
|
+
"0" => "hello",
|
238
|
+
"1" => { number: "5" }.with_indifferent_access,
|
239
|
+
"2" => { model: "Wish", text: "wish text" }.with_indifferent_access
|
240
|
+
}
|
241
|
+
string, number, wish = helper.hydrate(pretend_array)
|
242
|
+
expect(string).to eq("hello")
|
243
|
+
expect(number).to eq(5)
|
244
|
+
expect(wish.text).to eq("wish text")
|
245
|
+
end
|
246
|
+
end
|
247
|
+
end
|
248
|
+
end
|
249
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
ENV["RAILS_ENV"] ||= "test"
|
2
|
+
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
3
|
+
require "rspec/rails"
|
4
|
+
require "rspec/autorun"
|
5
|
+
Rails.backtrace_cleaner.remove_silencers!
|
6
|
+
# Load support files
|
7
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
8
|
+
|
9
|
+
RSpec.configure do |config|
|
10
|
+
config.mock_with :rspec
|
11
|
+
config.use_transactional_fixtures = true
|
12
|
+
config.infer_base_class_for_anonymous_controllers = false
|
13
|
+
config.order = "random"
|
14
|
+
end
|