- [X]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var gulp = require('gulp'), | |
rigger = require('gulp-rigger'), | |
watch = require('gulp-watch'), | |
prefixer = require('gulp-autoprefixer'), | |
sass = require('gulp-sass'), | |
browserSync = require('browser-sync'), | |
reload = browserSync.reload, | |
sourcemaps = require('gulp-sourcemaps'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"window.zoomLevel": 0, | |
"editor.fontSize": 13, | |
"editor.tabSize": 2, | |
"editor.wordWrap": "on", | |
"editor.minimap.maxColumn": 120, | |
"editor.wordWrapColumn": 100, | |
"editor.renderWhitespace": "all", | |
"workbench.colorTheme": "Monokai Dimmed", | |
"diffEditor.renderSideBySide": true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Policy | |
def can_destroy?(current_user) | |
user&.id == current_user.id | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Answer < ApplicationRecord | |
include Policy | |
belongs_to :question | |
belongs_to :user | |
validates :body, presence: true | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rails_helper' | |
describe Policy do | |
let!(:user) { create :user } | |
let(:other_user) { create :user } | |
# создаем класс | |
class PolicyClass | |
# подключаем модуль который необходимо протестировать | |
include Policy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 |