unsakini 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +28 -0
- data/Rakefile +34 -0
- data/angular/README.md +31 -0
- data/angular/angular-cli.json +59 -0
- data/angular/karma.conf.js +45 -0
- data/angular/package.json +49 -0
- data/angular/protractor.conf.js +32 -0
- data/angular/src/app/app.component.css +0 -0
- data/angular/src/app/app.component.html +4 -0
- data/angular/src/app/app.component.spec.ts +47 -0
- data/angular/src/app/app.component.ts +10 -0
- data/angular/src/app/app.module.ts +29 -0
- data/angular/src/app/app.routes.module.ts +29 -0
- data/angular/src/app/index.ts +2 -0
- data/angular/src/app/registration/registration.component.css +0 -0
- data/angular/src/app/registration/registration.component.html +14 -0
- data/angular/src/app/registration/registration.component.spec.ts +157 -0
- data/angular/src/app/registration/registration.component.ts +42 -0
- data/angular/src/environments/environment.prod.ts +3 -0
- data/angular/src/environments/environment.ts +8 -0
- data/angular/src/favicon.ico +0 -0
- data/angular/src/index.html +14 -0
- data/angular/src/main.ts +12 -0
- data/angular/src/polyfills.ts +19 -0
- data/angular/src/styles.css +1 -0
- data/angular/src/test.ts +31 -0
- data/angular/src/tsconfig.json +18 -0
- data/angular/src/typings.d.ts +2 -0
- data/angular/tslint.json +114 -0
- data/angular/typings.json +4 -0
- data/app/controllers/api/boards_controller.rb +67 -0
- data/app/controllers/api/comments_controller.rb +51 -0
- data/app/controllers/api/posts_controller.rb +58 -0
- data/app/controllers/api/share_board_controller.rb +118 -0
- data/app/controllers/api/users_controller.rb +27 -0
- data/app/controllers/application_controller.rb +5 -0
- data/app/controllers/concerns/board_owner_controller_concern.rb +38 -0
- data/app/controllers/concerns/comment_owner_controller_concern.rb +33 -0
- data/app/controllers/concerns/logged_in_controller_concern.rb +21 -0
- data/app/controllers/concerns/post_owner_controller_concern.rb +36 -0
- data/app/controllers/concerns/serializer_controller_concern.rb +11 -0
- data/app/controllers/user_token_controller.rb +2 -0
- data/app/controllers/web_base_controller.rb +11 -0
- data/app/models/application_record.rb +5 -0
- data/app/models/board.rb +14 -0
- data/app/models/comment.rb +9 -0
- data/app/models/concerns/encryptable_model_concern.rb +96 -0
- data/app/models/post.rb +12 -0
- data/app/models/user.rb +6 -0
- data/app/models/user_board.rb +71 -0
- data/app/serializers/board_serializer.rb +5 -0
- data/app/serializers/comment_serializer.rb +10 -0
- data/app/serializers/post_serializer.rb +23 -0
- data/app/serializers/user_board_serializer.rb +10 -0
- data/app/serializers/user_serializer.rb +6 -0
- data/config/initializers/unsakini.rb +4 -0
- data/config/routes.rb +22 -0
- data/db/migrate/20161116114222_create_boards.rb +9 -0
- data/db/migrate/20161116200034_create_user_boards.rb +11 -0
- data/db/migrate/20161118031023_create_posts.rb +12 -0
- data/db/migrate/20161118100454_create_comments.rb +11 -0
- data/db/migrate/20161118221508_add_encrypted_password_to_user_board.rb +5 -0
- data/db/migrate/20161122211105_create_users.rb +12 -0
- data/lib/generators/unsakini/angular/USAGE +8 -0
- data/lib/generators/unsakini/angular/angular_generator.rb +7 -0
- data/lib/generators/unsakini/config/USAGE +8 -0
- data/lib/generators/unsakini/config/config_generator.rb +7 -0
- data/lib/generators/unsakini/config/templates/unsakini.rb +4 -0
- data/lib/tasks/unsakini_tasks.rake +33 -0
- data/lib/unsakini/engine.rb +30 -0
- data/lib/unsakini/version.rb +3 -0
- data/lib/unsakini.rb +5 -0
- data/spec/concerns/models/encryptable_concern.rb +40 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/angular/README.md +31 -0
- data/spec/dummy/angular/angular-cli.json +59 -0
- data/spec/dummy/angular/e2e/app.e2e-spec.ts +14 -0
- data/spec/dummy/angular/e2e/app.po.ts +11 -0
- data/spec/dummy/angular/e2e/signup.e2e-spec.ts +28 -0
- data/spec/dummy/angular/e2e/signup.po.ts +31 -0
- data/spec/dummy/angular/e2e/tsconfig.json +16 -0
- data/spec/dummy/angular/karma.conf.js +45 -0
- data/spec/dummy/angular/package.json +50 -0
- data/spec/dummy/angular/protractor.conf.js +32 -0
- data/spec/dummy/angular/src/app/app.component.css +0 -0
- data/spec/dummy/angular/src/app/app.component.html +4 -0
- data/spec/dummy/angular/src/app/app.component.spec.ts +47 -0
- data/spec/dummy/angular/src/app/app.component.ts +10 -0
- data/spec/dummy/angular/src/app/app.module.ts +29 -0
- data/spec/dummy/angular/src/app/app.routes.module.ts +29 -0
- data/spec/dummy/angular/src/app/index.ts +2 -0
- data/spec/dummy/angular/src/app/registration/registration.component.css +0 -0
- data/spec/dummy/angular/src/app/registration/registration.component.html +14 -0
- data/spec/dummy/angular/src/app/registration/registration.component.spec.ts +157 -0
- data/spec/dummy/angular/src/app/registration/registration.component.ts +42 -0
- data/spec/dummy/angular/src/environments/environment.prod.ts +3 -0
- data/spec/dummy/angular/src/environments/environment.ts +8 -0
- data/spec/dummy/angular/src/favicon.ico +0 -0
- data/spec/dummy/angular/src/index.html +14 -0
- data/spec/dummy/angular/src/main.ts +12 -0
- data/spec/dummy/angular/src/polyfills.ts +19 -0
- data/spec/dummy/angular/src/styles.css +1 -0
- data/spec/dummy/angular/src/test.ts +31 -0
- data/spec/dummy/angular/src/tsconfig.json +18 -0
- data/spec/dummy/angular/src/typings.d.ts +2 -0
- data/spec/dummy/angular/tslint.json +114 -0
- data/spec/dummy/angular/typings.json +4 -0
- data/spec/dummy/app/assets/config/manifest.js +3 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/channels/application_cable/channel.rb +4 -0
- data/spec/dummy/app/channels/application_cable/connection.rb +4 -0
- data/spec/dummy/app/controllers/application_controller.rb +2 -0
- data/spec/dummy/app/jobs/application_job.rb +2 -0
- data/spec/dummy/app/mailers/application_mailer.rb +4 -0
- data/spec/dummy/app/models/application_record.rb +3 -0
- data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/spec/dummy/app/views/layouts/mailer.text.erb +1 -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/bin/setup +34 -0
- data/spec/dummy/bin/update +29 -0
- data/spec/dummy/config/application.rb +22 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/cable.yml +9 -0
- data/spec/dummy/config/crypto.yml +7 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +47 -0
- data/spec/dummy/config/environments/production.rb +78 -0
- data/spec/dummy/config/environments/test.rb +42 -0
- data/spec/dummy/config/initializers/application_controller_renderer.rb +6 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cors.rb +16 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/new_framework_defaults.rb +18 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/puma.rb +47 -0
- data/spec/dummy/config/routes.rb +3 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/config/spring.rb +6 -0
- data/spec/dummy/config.ru +5 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/schema.rb +56 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/public/app/favicon.ico +0 -0
- data/spec/dummy/public/app/index.html +14 -0
- data/spec/dummy/public/app/inline.bundle.js +139 -0
- data/spec/dummy/public/app/inline.map +1 -0
- data/spec/dummy/public/app/main.bundle.js +64689 -0
- data/spec/dummy/public/app/main.map +1 -0
- data/spec/dummy/public/app/styles.bundle.js +364 -0
- data/spec/dummy/public/app/styles.map +1 -0
- data/spec/factories/boards.rb +5 -0
- data/spec/factories/comments.rb +7 -0
- data/spec/factories/posts.rb +8 -0
- data/spec/factories/user_boards.rb +9 -0
- data/spec/factories/users.rb +10 -0
- data/spec/models/board_spec.rb +19 -0
- data/spec/models/comment_spec.rb +26 -0
- data/spec/models/post_spec.rb +19 -0
- data/spec/models/user_board_spec.rb +193 -0
- data/spec/models/user_spec.rb +5 -0
- data/spec/rails_helper.rb +58 -0
- data/spec/requests/api/api_boards_spec.rb +238 -0
- data/spec/requests/api/api_share_board_spec.rb +167 -0
- data/spec/requests/api/api_users_spec.rb +52 -0
- data/spec/requests/api/board/api_board_posts_spec.rb +299 -0
- data/spec/requests/api/board/post/api_board_post_comments_spec.rb +370 -0
- data/spec/requests/render_app_index_spec.rb +19 -0
- data/spec/schema/board.json +39 -0
- data/spec/schema/comment.json +51 -0
- data/spec/schema/post.json +87 -0
- data/spec/schema/user.json +27 -0
- data/spec/spec_helper.rb +67 -0
- data/spec/support/auth_helper.rb +17 -0
- data/spec/support/scenario_helper.rb +134 -0
- data/spec/support/serialize_helper.rb +37 -0
- metadata +540 -0
@@ -0,0 +1,364 @@
|
|
1
|
+
webpackJsonp([1,2],{
|
2
|
+
|
3
|
+
/***/ 379:
|
4
|
+
/***/ function(module, exports, __webpack_require__) {
|
5
|
+
|
6
|
+
// style-loader: Adds some css to the DOM by adding a <style> tag
|
7
|
+
|
8
|
+
// load the styles
|
9
|
+
var content = __webpack_require__(652);
|
10
|
+
if(typeof content === 'string') content = [[module.i, content, '']];
|
11
|
+
// add the styles to the DOM
|
12
|
+
var update = __webpack_require__(695)(content, {});
|
13
|
+
if(content.locals) module.exports = content.locals;
|
14
|
+
// Hot Module Replacement
|
15
|
+
if(false) {
|
16
|
+
// When the styles change, update the <style> tags
|
17
|
+
if(!content.locals) {
|
18
|
+
module.hot.accept("!!./../node_modules/css-loader/index.js?sourcemap!./../node_modules/postcss-loader/index.js!./styles.css", function() {
|
19
|
+
var newContent = require("!!./../node_modules/css-loader/index.js?sourcemap!./../node_modules/postcss-loader/index.js!./styles.css");
|
20
|
+
if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
|
21
|
+
update(newContent);
|
22
|
+
});
|
23
|
+
}
|
24
|
+
// When the module is disposed, remove the <style> tags
|
25
|
+
module.hot.dispose(function() { update(); });
|
26
|
+
}
|
27
|
+
|
28
|
+
/***/ },
|
29
|
+
|
30
|
+
/***/ 652:
|
31
|
+
/***/ function(module, exports, __webpack_require__) {
|
32
|
+
|
33
|
+
exports = module.exports = __webpack_require__(653)();
|
34
|
+
// imports
|
35
|
+
|
36
|
+
|
37
|
+
// module
|
38
|
+
exports.push([module.i, "/* You can add global styles to this file, and also import other style files */\n", ""]);
|
39
|
+
|
40
|
+
// exports
|
41
|
+
|
42
|
+
|
43
|
+
/***/ },
|
44
|
+
|
45
|
+
/***/ 653:
|
46
|
+
/***/ function(module, exports) {
|
47
|
+
|
48
|
+
/*
|
49
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
50
|
+
Author Tobias Koppers @sokra
|
51
|
+
*/
|
52
|
+
// css base code, injected by the css-loader
|
53
|
+
module.exports = function() {
|
54
|
+
var list = [];
|
55
|
+
|
56
|
+
// return the list of modules as css string
|
57
|
+
list.toString = function toString() {
|
58
|
+
var result = [];
|
59
|
+
for(var i = 0; i < this.length; i++) {
|
60
|
+
var item = this[i];
|
61
|
+
if(item[2]) {
|
62
|
+
result.push("@media " + item[2] + "{" + item[1] + "}");
|
63
|
+
} else {
|
64
|
+
result.push(item[1]);
|
65
|
+
}
|
66
|
+
}
|
67
|
+
return result.join("");
|
68
|
+
};
|
69
|
+
|
70
|
+
// import a list of modules into the list
|
71
|
+
list.i = function(modules, mediaQuery) {
|
72
|
+
if(typeof modules === "string")
|
73
|
+
modules = [[null, modules, ""]];
|
74
|
+
var alreadyImportedModules = {};
|
75
|
+
for(var i = 0; i < this.length; i++) {
|
76
|
+
var id = this[i][0];
|
77
|
+
if(typeof id === "number")
|
78
|
+
alreadyImportedModules[id] = true;
|
79
|
+
}
|
80
|
+
for(i = 0; i < modules.length; i++) {
|
81
|
+
var item = modules[i];
|
82
|
+
// skip already imported module
|
83
|
+
// this implementation is not 100% perfect for weird media query combinations
|
84
|
+
// when a module is imported multiple times with different media queries.
|
85
|
+
// I hope this will never occur (Hey this way we have smaller bundles)
|
86
|
+
if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {
|
87
|
+
if(mediaQuery && !item[2]) {
|
88
|
+
item[2] = mediaQuery;
|
89
|
+
} else if(mediaQuery) {
|
90
|
+
item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";
|
91
|
+
}
|
92
|
+
list.push(item);
|
93
|
+
}
|
94
|
+
}
|
95
|
+
};
|
96
|
+
return list;
|
97
|
+
};
|
98
|
+
|
99
|
+
|
100
|
+
/***/ },
|
101
|
+
|
102
|
+
/***/ 695:
|
103
|
+
/***/ function(module, exports) {
|
104
|
+
|
105
|
+
/*
|
106
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
107
|
+
Author Tobias Koppers @sokra
|
108
|
+
*/
|
109
|
+
var stylesInDom = {},
|
110
|
+
memoize = function(fn) {
|
111
|
+
var memo;
|
112
|
+
return function () {
|
113
|
+
if (typeof memo === "undefined") memo = fn.apply(this, arguments);
|
114
|
+
return memo;
|
115
|
+
};
|
116
|
+
},
|
117
|
+
isOldIE = memoize(function() {
|
118
|
+
return /msie [6-9]\b/.test(window.navigator.userAgent.toLowerCase());
|
119
|
+
}),
|
120
|
+
getHeadElement = memoize(function () {
|
121
|
+
return document.head || document.getElementsByTagName("head")[0];
|
122
|
+
}),
|
123
|
+
singletonElement = null,
|
124
|
+
singletonCounter = 0,
|
125
|
+
styleElementsInsertedAtTop = [];
|
126
|
+
|
127
|
+
module.exports = function(list, options) {
|
128
|
+
if(typeof DEBUG !== "undefined" && DEBUG) {
|
129
|
+
if(typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");
|
130
|
+
}
|
131
|
+
|
132
|
+
options = options || {};
|
133
|
+
// Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
|
134
|
+
// tags it will allow on a page
|
135
|
+
if (typeof options.singleton === "undefined") options.singleton = isOldIE();
|
136
|
+
|
137
|
+
// By default, add <style> tags to the bottom of <head>.
|
138
|
+
if (typeof options.insertAt === "undefined") options.insertAt = "bottom";
|
139
|
+
|
140
|
+
var styles = listToStyles(list);
|
141
|
+
addStylesToDom(styles, options);
|
142
|
+
|
143
|
+
return function update(newList) {
|
144
|
+
var mayRemove = [];
|
145
|
+
for(var i = 0; i < styles.length; i++) {
|
146
|
+
var item = styles[i];
|
147
|
+
var domStyle = stylesInDom[item.id];
|
148
|
+
domStyle.refs--;
|
149
|
+
mayRemove.push(domStyle);
|
150
|
+
}
|
151
|
+
if(newList) {
|
152
|
+
var newStyles = listToStyles(newList);
|
153
|
+
addStylesToDom(newStyles, options);
|
154
|
+
}
|
155
|
+
for(var i = 0; i < mayRemove.length; i++) {
|
156
|
+
var domStyle = mayRemove[i];
|
157
|
+
if(domStyle.refs === 0) {
|
158
|
+
for(var j = 0; j < domStyle.parts.length; j++)
|
159
|
+
domStyle.parts[j]();
|
160
|
+
delete stylesInDom[domStyle.id];
|
161
|
+
}
|
162
|
+
}
|
163
|
+
};
|
164
|
+
}
|
165
|
+
|
166
|
+
function addStylesToDom(styles, options) {
|
167
|
+
for(var i = 0; i < styles.length; i++) {
|
168
|
+
var item = styles[i];
|
169
|
+
var domStyle = stylesInDom[item.id];
|
170
|
+
if(domStyle) {
|
171
|
+
domStyle.refs++;
|
172
|
+
for(var j = 0; j < domStyle.parts.length; j++) {
|
173
|
+
domStyle.parts[j](item.parts[j]);
|
174
|
+
}
|
175
|
+
for(; j < item.parts.length; j++) {
|
176
|
+
domStyle.parts.push(addStyle(item.parts[j], options));
|
177
|
+
}
|
178
|
+
} else {
|
179
|
+
var parts = [];
|
180
|
+
for(var j = 0; j < item.parts.length; j++) {
|
181
|
+
parts.push(addStyle(item.parts[j], options));
|
182
|
+
}
|
183
|
+
stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts};
|
184
|
+
}
|
185
|
+
}
|
186
|
+
}
|
187
|
+
|
188
|
+
function listToStyles(list) {
|
189
|
+
var styles = [];
|
190
|
+
var newStyles = {};
|
191
|
+
for(var i = 0; i < list.length; i++) {
|
192
|
+
var item = list[i];
|
193
|
+
var id = item[0];
|
194
|
+
var css = item[1];
|
195
|
+
var media = item[2];
|
196
|
+
var sourceMap = item[3];
|
197
|
+
var part = {css: css, media: media, sourceMap: sourceMap};
|
198
|
+
if(!newStyles[id])
|
199
|
+
styles.push(newStyles[id] = {id: id, parts: [part]});
|
200
|
+
else
|
201
|
+
newStyles[id].parts.push(part);
|
202
|
+
}
|
203
|
+
return styles;
|
204
|
+
}
|
205
|
+
|
206
|
+
function insertStyleElement(options, styleElement) {
|
207
|
+
var head = getHeadElement();
|
208
|
+
var lastStyleElementInsertedAtTop = styleElementsInsertedAtTop[styleElementsInsertedAtTop.length - 1];
|
209
|
+
if (options.insertAt === "top") {
|
210
|
+
if(!lastStyleElementInsertedAtTop) {
|
211
|
+
head.insertBefore(styleElement, head.firstChild);
|
212
|
+
} else if(lastStyleElementInsertedAtTop.nextSibling) {
|
213
|
+
head.insertBefore(styleElement, lastStyleElementInsertedAtTop.nextSibling);
|
214
|
+
} else {
|
215
|
+
head.appendChild(styleElement);
|
216
|
+
}
|
217
|
+
styleElementsInsertedAtTop.push(styleElement);
|
218
|
+
} else if (options.insertAt === "bottom") {
|
219
|
+
head.appendChild(styleElement);
|
220
|
+
} else {
|
221
|
+
throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");
|
222
|
+
}
|
223
|
+
}
|
224
|
+
|
225
|
+
function removeStyleElement(styleElement) {
|
226
|
+
styleElement.parentNode.removeChild(styleElement);
|
227
|
+
var idx = styleElementsInsertedAtTop.indexOf(styleElement);
|
228
|
+
if(idx >= 0) {
|
229
|
+
styleElementsInsertedAtTop.splice(idx, 1);
|
230
|
+
}
|
231
|
+
}
|
232
|
+
|
233
|
+
function createStyleElement(options) {
|
234
|
+
var styleElement = document.createElement("style");
|
235
|
+
styleElement.type = "text/css";
|
236
|
+
insertStyleElement(options, styleElement);
|
237
|
+
return styleElement;
|
238
|
+
}
|
239
|
+
|
240
|
+
function createLinkElement(options) {
|
241
|
+
var linkElement = document.createElement("link");
|
242
|
+
linkElement.rel = "stylesheet";
|
243
|
+
insertStyleElement(options, linkElement);
|
244
|
+
return linkElement;
|
245
|
+
}
|
246
|
+
|
247
|
+
function addStyle(obj, options) {
|
248
|
+
var styleElement, update, remove;
|
249
|
+
|
250
|
+
if (options.singleton) {
|
251
|
+
var styleIndex = singletonCounter++;
|
252
|
+
styleElement = singletonElement || (singletonElement = createStyleElement(options));
|
253
|
+
update = applyToSingletonTag.bind(null, styleElement, styleIndex, false);
|
254
|
+
remove = applyToSingletonTag.bind(null, styleElement, styleIndex, true);
|
255
|
+
} else if(obj.sourceMap &&
|
256
|
+
typeof URL === "function" &&
|
257
|
+
typeof URL.createObjectURL === "function" &&
|
258
|
+
typeof URL.revokeObjectURL === "function" &&
|
259
|
+
typeof Blob === "function" &&
|
260
|
+
typeof btoa === "function") {
|
261
|
+
styleElement = createLinkElement(options);
|
262
|
+
update = updateLink.bind(null, styleElement);
|
263
|
+
remove = function() {
|
264
|
+
removeStyleElement(styleElement);
|
265
|
+
if(styleElement.href)
|
266
|
+
URL.revokeObjectURL(styleElement.href);
|
267
|
+
};
|
268
|
+
} else {
|
269
|
+
styleElement = createStyleElement(options);
|
270
|
+
update = applyToTag.bind(null, styleElement);
|
271
|
+
remove = function() {
|
272
|
+
removeStyleElement(styleElement);
|
273
|
+
};
|
274
|
+
}
|
275
|
+
|
276
|
+
update(obj);
|
277
|
+
|
278
|
+
return function updateStyle(newObj) {
|
279
|
+
if(newObj) {
|
280
|
+
if(newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap)
|
281
|
+
return;
|
282
|
+
update(obj = newObj);
|
283
|
+
} else {
|
284
|
+
remove();
|
285
|
+
}
|
286
|
+
};
|
287
|
+
}
|
288
|
+
|
289
|
+
var replaceText = (function () {
|
290
|
+
var textStore = [];
|
291
|
+
|
292
|
+
return function (index, replacement) {
|
293
|
+
textStore[index] = replacement;
|
294
|
+
return textStore.filter(Boolean).join('\n');
|
295
|
+
};
|
296
|
+
})();
|
297
|
+
|
298
|
+
function applyToSingletonTag(styleElement, index, remove, obj) {
|
299
|
+
var css = remove ? "" : obj.css;
|
300
|
+
|
301
|
+
if (styleElement.styleSheet) {
|
302
|
+
styleElement.styleSheet.cssText = replaceText(index, css);
|
303
|
+
} else {
|
304
|
+
var cssNode = document.createTextNode(css);
|
305
|
+
var childNodes = styleElement.childNodes;
|
306
|
+
if (childNodes[index]) styleElement.removeChild(childNodes[index]);
|
307
|
+
if (childNodes.length) {
|
308
|
+
styleElement.insertBefore(cssNode, childNodes[index]);
|
309
|
+
} else {
|
310
|
+
styleElement.appendChild(cssNode);
|
311
|
+
}
|
312
|
+
}
|
313
|
+
}
|
314
|
+
|
315
|
+
function applyToTag(styleElement, obj) {
|
316
|
+
var css = obj.css;
|
317
|
+
var media = obj.media;
|
318
|
+
|
319
|
+
if(media) {
|
320
|
+
styleElement.setAttribute("media", media)
|
321
|
+
}
|
322
|
+
|
323
|
+
if(styleElement.styleSheet) {
|
324
|
+
styleElement.styleSheet.cssText = css;
|
325
|
+
} else {
|
326
|
+
while(styleElement.firstChild) {
|
327
|
+
styleElement.removeChild(styleElement.firstChild);
|
328
|
+
}
|
329
|
+
styleElement.appendChild(document.createTextNode(css));
|
330
|
+
}
|
331
|
+
}
|
332
|
+
|
333
|
+
function updateLink(linkElement, obj) {
|
334
|
+
var css = obj.css;
|
335
|
+
var sourceMap = obj.sourceMap;
|
336
|
+
|
337
|
+
if(sourceMap) {
|
338
|
+
// http://stackoverflow.com/a/26603875
|
339
|
+
css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */";
|
340
|
+
}
|
341
|
+
|
342
|
+
var blob = new Blob([css], { type: "text/css" });
|
343
|
+
|
344
|
+
var oldSrc = linkElement.href;
|
345
|
+
|
346
|
+
linkElement.href = URL.createObjectURL(blob);
|
347
|
+
|
348
|
+
if(oldSrc)
|
349
|
+
URL.revokeObjectURL(oldSrc);
|
350
|
+
}
|
351
|
+
|
352
|
+
|
353
|
+
/***/ },
|
354
|
+
|
355
|
+
/***/ 698:
|
356
|
+
/***/ function(module, exports, __webpack_require__) {
|
357
|
+
|
358
|
+
module.exports = __webpack_require__(379);
|
359
|
+
|
360
|
+
|
361
|
+
/***/ }
|
362
|
+
|
363
|
+
},[698]);
|
364
|
+
//# sourceMappingURL=styles.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["webpack:////home/adones/Projects/Rails/unsakini/spec/dummy/angular/src/styles.css?0dc5","webpack:////home/adones/Projects/Rails/unsakini/spec/dummy/angular/src/styles.css","webpack:////home/adones/Projects/Rails/unsakini/spec/dummy/angular/~/css-loader/lib/css-base.js","webpack:////home/adones/Projects/Rails/unsakini/spec/dummy/angular/~/style-loader/addStyles.js"],"names":[],"mappings":";;;;;AAAA;;AAEA;AACA;AACA;AACA;AACA,iDAAgF;AAChF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,gCAAgC,UAAU,EAAE;AAC5C,C;;;;;;;ACpBA;AACA;;;AAGA;AACA;;AAEA;;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA,wCAAwC,gBAAgB;AACxD,IAAI;AACJ;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACjDA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA,EAAE;AACF;AACA;AACA,EAAE;AACF;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,gBAAgB,mBAAmB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,sBAAsB;AACtC;AACA;AACA,kBAAkB,2BAA2B;AAC7C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,eAAe,mBAAmB;AAClC;AACA;AACA;AACA;AACA,iBAAiB,2BAA2B;AAC5C;AACA;AACA,QAAQ,uBAAuB;AAC/B;AACA;AACA,GAAG;AACH;AACA,iBAAiB,uBAAuB;AACxC;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;;AAEA;AACA;AACA;AACA,eAAe,iBAAiB;AAChC;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA,gCAAgC,sBAAsB;AACtD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA,EAAE;AACF;AACA,EAAE;AACF;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;;AAEA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uDAAuD;AACvD;;AAEA,6BAA6B,mBAAmB;;AAEhD;;AAEA;;AAEA;AACA;AACA","file":"styles.bundle.js","sourcesContent":["// style-loader: Adds some css to the DOM by adding a <style> tag\n\n// load the styles\nvar content = require(\"!!./../node_modules/css-loader/index.js?sourcemap!./../node_modules/postcss-loader/index.js!./styles.css\");\nif(typeof content === 'string') content = [[module.id, content, '']];\n// add the styles to the DOM\nvar update = require(\"!./../node_modules/style-loader/addStyles.js\")(content, {});\nif(content.locals) module.exports = content.locals;\n// Hot Module Replacement\nif(module.hot) {\n\t// When the styles change, update the <style> tags\n\tif(!content.locals) {\n\t\tmodule.hot.accept(\"!!./../node_modules/css-loader/index.js?sourcemap!./../node_modules/postcss-loader/index.js!./styles.css\", function() {\n\t\t\tvar newContent = require(\"!!./../node_modules/css-loader/index.js?sourcemap!./../node_modules/postcss-loader/index.js!./styles.css\");\n\t\t\tif(typeof newContent === 'string') newContent = [[module.id, newContent, '']];\n\t\t\tupdate(newContent);\n\t\t});\n\t}\n\t// When the module is disposed, remove the <style> tags\n\tmodule.hot.dispose(function() { update(); });\n}\n\n\n//////////////////\n// WEBPACK FOOTER\n// /home/adones/Projects/Rails/unsakini/spec/dummy/angular/src/styles.css\n// module id = 379\n// module chunks = 1","exports = module.exports = require(\"./../node_modules/css-loader/lib/css-base.js\")();\n// imports\n\n\n// module\nexports.push([module.id, \"/* You can add global styles to this file, and also import other style files */\\n\", \"\"]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// /home/adones/Projects/Rails/unsakini/spec/dummy/angular/~/css-loader?sourcemap!/home/adones/Projects/Rails/unsakini/spec/dummy/angular/~/postcss-loader!/home/adones/Projects/Rails/unsakini/spec/dummy/angular/src/styles.css\n// module id = 652\n// module chunks = 1","/*\r\n\tMIT License http://www.opensource.org/licenses/mit-license.php\r\n\tAuthor Tobias Koppers @sokra\r\n*/\r\n// css base code, injected by the css-loader\r\nmodule.exports = function() {\r\n\tvar list = [];\r\n\r\n\t// return the list of modules as css string\r\n\tlist.toString = function toString() {\r\n\t\tvar result = [];\r\n\t\tfor(var i = 0; i < this.length; i++) {\r\n\t\t\tvar item = this[i];\r\n\t\t\tif(item[2]) {\r\n\t\t\t\tresult.push(\"@media \" + item[2] + \"{\" + item[1] + \"}\");\r\n\t\t\t} else {\r\n\t\t\t\tresult.push(item[1]);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn result.join(\"\");\r\n\t};\r\n\r\n\t// import a list of modules into the list\r\n\tlist.i = function(modules, mediaQuery) {\r\n\t\tif(typeof modules === \"string\")\r\n\t\t\tmodules = [[null, modules, \"\"]];\r\n\t\tvar alreadyImportedModules = {};\r\n\t\tfor(var i = 0; i < this.length; i++) {\r\n\t\t\tvar id = this[i][0];\r\n\t\t\tif(typeof id === \"number\")\r\n\t\t\t\talreadyImportedModules[id] = true;\r\n\t\t}\r\n\t\tfor(i = 0; i < modules.length; i++) {\r\n\t\t\tvar item = modules[i];\r\n\t\t\t// skip already imported module\r\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\r\n\t\t\t// when a module is imported multiple times with different media queries.\r\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\r\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\r\n\t\t\t\tif(mediaQuery && !item[2]) {\r\n\t\t\t\t\titem[2] = mediaQuery;\r\n\t\t\t\t} else if(mediaQuery) {\r\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\r\n\t\t\t\t}\r\n\t\t\t\tlist.push(item);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\treturn list;\r\n};\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// /home/adones/Projects/Rails/unsakini/spec/dummy/angular/~/css-loader/lib/css-base.js\n// module id = 653\n// module chunks = 1","/*\r\n\tMIT License http://www.opensource.org/licenses/mit-license.php\r\n\tAuthor Tobias Koppers @sokra\r\n*/\r\nvar stylesInDom = {},\r\n\tmemoize = function(fn) {\r\n\t\tvar memo;\r\n\t\treturn function () {\r\n\t\t\tif (typeof memo === \"undefined\") memo = fn.apply(this, arguments);\r\n\t\t\treturn memo;\r\n\t\t};\r\n\t},\r\n\tisOldIE = memoize(function() {\r\n\t\treturn /msie [6-9]\\b/.test(window.navigator.userAgent.toLowerCase());\r\n\t}),\r\n\tgetHeadElement = memoize(function () {\r\n\t\treturn document.head || document.getElementsByTagName(\"head\")[0];\r\n\t}),\r\n\tsingletonElement = null,\r\n\tsingletonCounter = 0,\r\n\tstyleElementsInsertedAtTop = [];\r\n\r\nmodule.exports = function(list, options) {\r\n\tif(typeof DEBUG !== \"undefined\" && DEBUG) {\r\n\t\tif(typeof document !== \"object\") throw new Error(\"The style-loader cannot be used in a non-browser environment\");\r\n\t}\r\n\r\n\toptions = options || {};\r\n\t// Force single-tag solution on IE6-9, which has a hard limit on the # of <style>\r\n\t// tags it will allow on a page\r\n\tif (typeof options.singleton === \"undefined\") options.singleton = isOldIE();\r\n\r\n\t// By default, add <style> tags to the bottom of <head>.\r\n\tif (typeof options.insertAt === \"undefined\") options.insertAt = \"bottom\";\r\n\r\n\tvar styles = listToStyles(list);\r\n\taddStylesToDom(styles, options);\r\n\r\n\treturn function update(newList) {\r\n\t\tvar mayRemove = [];\r\n\t\tfor(var i = 0; i < styles.length; i++) {\r\n\t\t\tvar item = styles[i];\r\n\t\t\tvar domStyle = stylesInDom[item.id];\r\n\t\t\tdomStyle.refs--;\r\n\t\t\tmayRemove.push(domStyle);\r\n\t\t}\r\n\t\tif(newList) {\r\n\t\t\tvar newStyles = listToStyles(newList);\r\n\t\t\taddStylesToDom(newStyles, options);\r\n\t\t}\r\n\t\tfor(var i = 0; i < mayRemove.length; i++) {\r\n\t\t\tvar domStyle = mayRemove[i];\r\n\t\t\tif(domStyle.refs === 0) {\r\n\t\t\t\tfor(var j = 0; j < domStyle.parts.length; j++)\r\n\t\t\t\t\tdomStyle.parts[j]();\r\n\t\t\t\tdelete stylesInDom[domStyle.id];\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n}\r\n\r\nfunction addStylesToDom(styles, options) {\r\n\tfor(var i = 0; i < styles.length; i++) {\r\n\t\tvar item = styles[i];\r\n\t\tvar domStyle = stylesInDom[item.id];\r\n\t\tif(domStyle) {\r\n\t\t\tdomStyle.refs++;\r\n\t\t\tfor(var j = 0; j < domStyle.parts.length; j++) {\r\n\t\t\t\tdomStyle.parts[j](item.parts[j]);\r\n\t\t\t}\r\n\t\t\tfor(; j < item.parts.length; j++) {\r\n\t\t\t\tdomStyle.parts.push(addStyle(item.parts[j], options));\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tvar parts = [];\r\n\t\t\tfor(var j = 0; j < item.parts.length; j++) {\r\n\t\t\t\tparts.push(addStyle(item.parts[j], options));\r\n\t\t\t}\r\n\t\t\tstylesInDom[item.id] = {id: item.id, refs: 1, parts: parts};\r\n\t\t}\r\n\t}\r\n}\r\n\r\nfunction listToStyles(list) {\r\n\tvar styles = [];\r\n\tvar newStyles = {};\r\n\tfor(var i = 0; i < list.length; i++) {\r\n\t\tvar item = list[i];\r\n\t\tvar id = item[0];\r\n\t\tvar css = item[1];\r\n\t\tvar media = item[2];\r\n\t\tvar sourceMap = item[3];\r\n\t\tvar part = {css: css, media: media, sourceMap: sourceMap};\r\n\t\tif(!newStyles[id])\r\n\t\t\tstyles.push(newStyles[id] = {id: id, parts: [part]});\r\n\t\telse\r\n\t\t\tnewStyles[id].parts.push(part);\r\n\t}\r\n\treturn styles;\r\n}\r\n\r\nfunction insertStyleElement(options, styleElement) {\r\n\tvar head = getHeadElement();\r\n\tvar lastStyleElementInsertedAtTop = styleElementsInsertedAtTop[styleElementsInsertedAtTop.length - 1];\r\n\tif (options.insertAt === \"top\") {\r\n\t\tif(!lastStyleElementInsertedAtTop) {\r\n\t\t\thead.insertBefore(styleElement, head.firstChild);\r\n\t\t} else if(lastStyleElementInsertedAtTop.nextSibling) {\r\n\t\t\thead.insertBefore(styleElement, lastStyleElementInsertedAtTop.nextSibling);\r\n\t\t} else {\r\n\t\t\thead.appendChild(styleElement);\r\n\t\t}\r\n\t\tstyleElementsInsertedAtTop.push(styleElement);\r\n\t} else if (options.insertAt === \"bottom\") {\r\n\t\thead.appendChild(styleElement);\r\n\t} else {\r\n\t\tthrow new Error(\"Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.\");\r\n\t}\r\n}\r\n\r\nfunction removeStyleElement(styleElement) {\r\n\tstyleElement.parentNode.removeChild(styleElement);\r\n\tvar idx = styleElementsInsertedAtTop.indexOf(styleElement);\r\n\tif(idx >= 0) {\r\n\t\tstyleElementsInsertedAtTop.splice(idx, 1);\r\n\t}\r\n}\r\n\r\nfunction createStyleElement(options) {\r\n\tvar styleElement = document.createElement(\"style\");\r\n\tstyleElement.type = \"text/css\";\r\n\tinsertStyleElement(options, styleElement);\r\n\treturn styleElement;\r\n}\r\n\r\nfunction createLinkElement(options) {\r\n\tvar linkElement = document.createElement(\"link\");\r\n\tlinkElement.rel = \"stylesheet\";\r\n\tinsertStyleElement(options, linkElement);\r\n\treturn linkElement;\r\n}\r\n\r\nfunction addStyle(obj, options) {\r\n\tvar styleElement, update, remove;\r\n\r\n\tif (options.singleton) {\r\n\t\tvar styleIndex = singletonCounter++;\r\n\t\tstyleElement = singletonElement || (singletonElement = createStyleElement(options));\r\n\t\tupdate = applyToSingletonTag.bind(null, styleElement, styleIndex, false);\r\n\t\tremove = applyToSingletonTag.bind(null, styleElement, styleIndex, true);\r\n\t} else if(obj.sourceMap &&\r\n\t\ttypeof URL === \"function\" &&\r\n\t\ttypeof URL.createObjectURL === \"function\" &&\r\n\t\ttypeof URL.revokeObjectURL === \"function\" &&\r\n\t\ttypeof Blob === \"function\" &&\r\n\t\ttypeof btoa === \"function\") {\r\n\t\tstyleElement = createLinkElement(options);\r\n\t\tupdate = updateLink.bind(null, styleElement);\r\n\t\tremove = function() {\r\n\t\t\tremoveStyleElement(styleElement);\r\n\t\t\tif(styleElement.href)\r\n\t\t\t\tURL.revokeObjectURL(styleElement.href);\r\n\t\t};\r\n\t} else {\r\n\t\tstyleElement = createStyleElement(options);\r\n\t\tupdate = applyToTag.bind(null, styleElement);\r\n\t\tremove = function() {\r\n\t\t\tremoveStyleElement(styleElement);\r\n\t\t};\r\n\t}\r\n\r\n\tupdate(obj);\r\n\r\n\treturn function updateStyle(newObj) {\r\n\t\tif(newObj) {\r\n\t\t\tif(newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap)\r\n\t\t\t\treturn;\r\n\t\t\tupdate(obj = newObj);\r\n\t\t} else {\r\n\t\t\tremove();\r\n\t\t}\r\n\t};\r\n}\r\n\r\nvar replaceText = (function () {\r\n\tvar textStore = [];\r\n\r\n\treturn function (index, replacement) {\r\n\t\ttextStore[index] = replacement;\r\n\t\treturn textStore.filter(Boolean).join('\\n');\r\n\t};\r\n})();\r\n\r\nfunction applyToSingletonTag(styleElement, index, remove, obj) {\r\n\tvar css = remove ? \"\" : obj.css;\r\n\r\n\tif (styleElement.styleSheet) {\r\n\t\tstyleElement.styleSheet.cssText = replaceText(index, css);\r\n\t} else {\r\n\t\tvar cssNode = document.createTextNode(css);\r\n\t\tvar childNodes = styleElement.childNodes;\r\n\t\tif (childNodes[index]) styleElement.removeChild(childNodes[index]);\r\n\t\tif (childNodes.length) {\r\n\t\t\tstyleElement.insertBefore(cssNode, childNodes[index]);\r\n\t\t} else {\r\n\t\t\tstyleElement.appendChild(cssNode);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nfunction applyToTag(styleElement, obj) {\r\n\tvar css = obj.css;\r\n\tvar media = obj.media;\r\n\r\n\tif(media) {\r\n\t\tstyleElement.setAttribute(\"media\", media)\r\n\t}\r\n\r\n\tif(styleElement.styleSheet) {\r\n\t\tstyleElement.styleSheet.cssText = css;\r\n\t} else {\r\n\t\twhile(styleElement.firstChild) {\r\n\t\t\tstyleElement.removeChild(styleElement.firstChild);\r\n\t\t}\r\n\t\tstyleElement.appendChild(document.createTextNode(css));\r\n\t}\r\n}\r\n\r\nfunction updateLink(linkElement, obj) {\r\n\tvar css = obj.css;\r\n\tvar sourceMap = obj.sourceMap;\r\n\r\n\tif(sourceMap) {\r\n\t\t// http://stackoverflow.com/a/26603875\r\n\t\tcss += \"\\n/*# sourceMappingURL=data:application/json;base64,\" + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + \" */\";\r\n\t}\r\n\r\n\tvar blob = new Blob([css], { type: \"text/css\" });\r\n\r\n\tvar oldSrc = linkElement.href;\r\n\r\n\tlinkElement.href = URL.createObjectURL(blob);\r\n\r\n\tif(oldSrc)\r\n\t\tURL.revokeObjectURL(oldSrc);\r\n}\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// /home/adones/Projects/Rails/unsakini/spec/dummy/angular/~/style-loader/addStyles.js\n// module id = 695\n// module chunks = 1"],"sourceRoot":""}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
RSpec.describe Board, type: :model do
|
4
|
+
|
5
|
+
let(:invalid_attributes) {
|
6
|
+
{
|
7
|
+
name: ''
|
8
|
+
}
|
9
|
+
}
|
10
|
+
|
11
|
+
it_behaves_like 'encryptable', [:name]
|
12
|
+
|
13
|
+
it "validates name" do
|
14
|
+
board = Board.new(invalid_attributes)
|
15
|
+
board.save
|
16
|
+
expect(board.errors.count).to be 1
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
RSpec.describe Comment, type: :model do
|
4
|
+
|
5
|
+
before(:all) do
|
6
|
+
user_is_sharing_a_board_scenario
|
7
|
+
end
|
8
|
+
|
9
|
+
let(:invalid_attributes) {
|
10
|
+
{
|
11
|
+
user_id: @user.id,
|
12
|
+
post_id: @post.id,
|
13
|
+
content: ''
|
14
|
+
}
|
15
|
+
}
|
16
|
+
|
17
|
+
|
18
|
+
it_behaves_like 'encryptable', [:content]
|
19
|
+
|
20
|
+
it "validates title and content" do
|
21
|
+
comment = Comment.new(invalid_attributes)
|
22
|
+
comment.save
|
23
|
+
expect(comment.errors.count).to be 1
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
RSpec.describe Post, type: :model do
|
4
|
+
it_behaves_like 'encryptable', [:title, :content]
|
5
|
+
|
6
|
+
let(:invalid_attributes) {
|
7
|
+
{user_id: @user.id, board_id: @board.id, content: '', title: ''}
|
8
|
+
}
|
9
|
+
|
10
|
+
it "validates title and content" do
|
11
|
+
|
12
|
+
user_is_sharing_a_board_scenario
|
13
|
+
|
14
|
+
post = Post.new(invalid_attributes)
|
15
|
+
post.save
|
16
|
+
expect(post.errors.count).to be 2
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|