text stringlengths 10 2.61M |
|---|
class CreateAccountsOrganizations < ActiveRecord::Migration
def up
if Rails.env.production? || Rails.env.staging?
execute <<-SQL
CREATE FOREIGN TABLE organizations(id integer)
SERVER meurio_accounts
OPTIONS (table_name 'organizations');
SQL
else
create_table :organiza... |
class CommentsController < ApplicationController
before_action :authenticate_user!, except: [:index, :show]
before_action :set_commentable, only: :create
before_action :set_comment, only: :destroy
respond_to :js
authorize_resource
def create
respond_with(@comment = @commentable.comments.create(comment... |
class ModifyPicturesPathFields < ActiveRecord::Migration
def change
add_column :pictures, :path, :string
add_column :pictures, :thumb_path, :string
end
end
|
module BootstrapFlashHelper
AVALIABLE_TYPES = %w(info success warning danger).freeze
def bootstrap_flash
flash_messages = []
flash.each do |type, message|
# Skip Devise :timeout and :timedout flags
type_to_s = type.to_s
next if type_to_s == 'timeout' || type_to_s == 'timedout'
type_t... |
# frozen_string_literal: true
module Zendesk
class Snitcher
class Pattern
attr_reader :tickets, :threads
def initialize
@tickets = Zendesk::Snitcher::Ticket.new
@threads = Zendesk::Snitcher::Thread.new
end
end
end
end
|
class ChangeUsedToCondition < ActiveRecord::Migration[6.0]
def change
rename_column :stocks, :used, :condition
end
end
|
module ProfileHelper
def translated_profile_type_for(resource)
resource_name =
if resource.is_a? ActiveRecord::Base
resource.class.name.underscore
else
resource
end
t "profile_types.#{resource_name}"
end
end
|
module RIM
class RimException < Exception
attr_reader :messages
def initialize(messages)
if messages.is_a?(String)
@messages = [messages]
else
@messages = messages
end
end
end
end
|
Rails.application.routes.draw do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
root 'users#homepage'
# get 'users#login'
resources :users
resources :user_questions
resources :posts
resources :questions
resource :user do
get "login"
post "l... |
class Api::V1::TrainingsController < Api::V1::ApiController
before_action :set_training, only: %i[show update destroy]
def index
@trainings = current_context.trainings
end
def show; end
def update
if @training.update(training_params)
render 'show', status: :ok
else
render 'show', st... |
class ChangeArtistColumnToArtistIdInSongs < ActiveRecord::Migration[5.1]
def change
rename_column :songs, :artist, :artist_id
end
end
|
require "rails_helper"
RSpec.describe User, :type => :model do
it 'responds with an email' do
expect(FactoryGirl.build(:user)).to respond_to(:email)
end
it 'responds with a password' do
expect(FactoryGirl.build(:user)).to respond_to(:password)
end
it 'responds with an encrypted password' do
expect(Factory... |
class GameChannel < ApplicationCable::Channel
# match_id를 기준으로 채널 생성
# 종료/취소된 매치, 경기 인원이 편성되지 않은 매치 접근에 대한 예외처리 진행
def subscribed
current_user.reload
reject if current_user.status == "offline"
stream_from "game_channel_#{params[:match_id].to_s}"
begin
@match = Match.find_by_id(params[:matc... |
class Manga
attr_accessor :name, :chapters, :url
def initialize name
@chapters = []
@name = name
@url = "http://mangafox.me/manga/#{@name_slugified}"
p " - #{@name} initialize"
end
def name_slugified
slug = @name.gsub(" - ","_").gsub(/[\s+.!^'"-:\/]/, "_").downcase
slug = slug[0...-1] i... |
class GitSnatch
module Configure
extend self
def configuration
@configuration ||= Configuration.new
end
def configure
yield(configuration)
configuration
end
end
class Configuration
attr_accessor :endpoint, :auth_types, :username, :password
def initialize
sel... |
# encoding: utf-8
class Preachment::Info::Mp3FileUploader < ApplicationUploader
storage :file
def extension_white_list
%w(mp3 wma)
end
end
|
class CreatePresenters < ActiveRecord::Migration[5.1]
def change
create_table :presenters do |t|
t.string :name
t.string :title
t.string :document1
t.string :document2
t.string :document3
t.string :document4
t.string :meeting_id
t.timestamps
end
end
end
|
class AssessmentFormField < Tableless
column :date, :date
column :start_time, :time
column :end_time, :time
column :max_marks, :decimal
column :min_marks, :decimal
column :assessment_form_id, :integer
validates_presence_of :date, :start_time, :end_time
belongs_to :assessment_form
has_many :subj... |
module Racc
# Support module for printing colored text to an ANSI terminal
module Color
extend self
@color_enabled = false
def self.enabled=(enabled)
@color_enabled = enabled
end
def self.enabled?
@color_enabled
end
def self.without_color
saved = @color_enabled
... |
json.array!(@players_years) do |players_year|
json.extract! players_year, :player_id, :year, :passing_stats_id, :rushing_stats_id, :receiving_stats_id, :return_stats_id, :kicking_stats_id, :punting_stats_id, :defense_stats_id
json.url players_year_url(players_year, format: :json)
end |
class Badge < ActiveRecord::Base
GRANTABLE_QUANTITIES = [1, 5, 10, 15, 20, 50, 100]
has_many :user_badges
has_many :users, through: :user_badges
validates :name, :description, presence: true
end
|
Pod::Spec.new do |s|
s.name = 'GKit'
s.version = '0.1'
s.summary = 'An iOS framework.'
s.author = { 'Hua Cao' => 'glare.ch@gmail.com' }
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.platform = :ios, '5.0'
s.requires_arc = true
s.source = { :git => "https://github.co... |
# frozen_string_literal: true
module Dotfiles
module Installers
class Asdf < BaseInstaller
def name
'asdf configuration'
end
private
def perform_installation
ensure_prerequisites
install_config_files
clone_asdf
add_plugin('ruby')
add_plugi... |
class EndUsers::CartItemsController < ApplicationController
before_action :authenticate_end_user!
def create
if end_user_signed_in?
@cart_item = CartItem.new(cart_item_params)
@cart_item.end_user_id = current_end_user.id
@cart_item.save
redirect_to end_users_cart_items_path
else
redirect_to root_path
... |
class AddInformationToPlayers < ActiveRecord::Migration
def change
add_column :players, :name, :string
add_column :players, :provider, :string
rename_column :players, :reddit_bearer, :uid
end
end
|
describe 'Merchants API' do
describe 'relationships' do
it 'can return all items associated with a merchant' do
create(:merchant)
id = Merchant.last.id
id_2 = id + 1
create(:merchant, id: id_2)
create_list(:item, 6, merchant_id: id)
create_list(:item, 6, merchant_id: id_2)
... |
def oxford_comma(array)
if array.length == 1
return array.join
elsif array.length == 2
return array.join(" and ")
else
string = ""
array.each_with_index{ |word, index|
if index == (array.length-1)
string += "and " + word
else
string += word + ", "
... |
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'apress/images/version'
Gem::Specification.new do |spec|
spec.metadata['allowed_push_host'] = 'https://gems.railsc.ru'
spec.name = 'apress-images'
spec.version = Apress::Imag... |
require 'rails_helper'
describe "User logs out" do
let!(:user) { create(:user) }
context "when a user is signed in" do
it "they can log out" do
log_in_as_user(user)
expect(page).to have_selector(:link_or_button, "Sign Out")
click_on "Sign Out"
expect(page).to have_current_path(login... |
# encoding: utf-8
class Discipline < ActiveRecord::Base
has_many :formation_of_competences , :dependent => :destroy
has_many :interim_attestations , :dependent => :destroy
has_many :module_of_disciplines , :dependent => :destroy
has_many :themes
#, :through => :module_of_disciplines
has... |
require "rails_helper"
module Clockface
RSpec.describe "clockface/tasks/delete.html.erb", type: :view do
let(:task) { create(:task) }
let(:captcha) { "abcde" }
before do
task
assign(:task, task)
assign(:captcha, captcha)
view.extend ConfigHelper
end
it "renders the flash... |
#encoding utf-8
class Category < ActiveRecord::Base
has_many :posts
validates_associated :posts
validates :categoryname, :presence => true,
:length => { :minimum => 5 }
# :message => 'en az 5 karaket girebilirsiniz.'
end
|
json.array!(@admin_users) do |admin_user|
json.extract! admin_user, :id, :email, :name, :nickname, :phone, :address, :bank_account
json.url admin_user_url(admin_user, format: :json)
end
|
Rails.application.routes.draw do
root to: 'orders#new'
get 'ui(/:action)', controller: 'ui'
resources :brands, only: [:new, :create]
end
|
class Ability
include CanCan::Ability
def initialize(user)
user ||= User.new #guest user
if user.role? :admin
can :manage, :all
elsif user.role? :author
can :manage, Project, :user_id => user.id
can [:read,:create], Project
can :manage, [Reward, Update, ProjectParticipant], :project => {:user_id =... |
require 'rspec'
require './lib/room'
require './lib/house'
RSpec.describe Room do
it 'is an instance of' do
room = Room.new(:bedroom, 10, "13")
expect(room).to be_an_instance_of(Room)
end
it 'is a bedroom' do
room = Room.new(:bedroom, 10, "13")
expect(room.category).to eq(:bedroom)
end
it ... |
Rails.application.routes.draw do
scope 'api' do
resources :experiences
resources :projects do
post :move, on: :member
end
resources :jobs do
post :move, on: :member
end
resources :educations do
post :move, on: :member
end
end
scope 'auth' do
post '/login', to: ... |
require 'rails_helper'
RSpec.feature "User logs in" do
let(:user) { build(:user) }
scenario "with valid credentials" do
visit root_path
click_link "Sign Up"
fill_in "Username", with: user.username
fill_in "Email", with: user.email
fill_in "Password", with: user.password
click_button "C... |
module MailUp
module Console
class Group
attr_accessor :api
def initialize(id, api)
@api = api
@id = id
end
# Import a recipient to the specified group(synchronous import).
#
# @param [Hash] recipient data, see ConsoleRecipientItems (See http://help.mailup.com... |
require 'spec_helper'
module Roadblock
describe PermissionsController do
routes { Roadblock::Engine.routes }
let(:valid_attributes) { attributes_for(:roadblock_permission) }
let(:valid_session) { {} }
describe "GET index" do
it "assigns all permissions as @permissions" do
permission =... |
# == Schema Information
#
# Table name: paypal_tokens
#
# id :integer not null, primary key
# community_id :integer not null
# token :string(64)
# transaction_id :integer
# merchant_id :string(255) not null
# receiver_id :stri... |
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel... |
# frozen_string_literal: true
class ModSignup < ApplicationRecord
belongs_to :mod
belongs_to :event_attendee
before_validation :maybe_set_admitted_at
validate :validates_waitlist, on: :create
validate :validates_mod_constraints
validate :validates_mod_section_signup_limit, on: :create
validate :validate... |
#
# Cookbook Name:: tahoe_lafs
# Recipe:: default
#
# Copyright (c) 2014 The Authors, All Rights Reserved.
tahoe_dir = node['tahoe']['home_dir'] || '/var/tahoe'
tahoe_venv = File.join(tahoe_dir, "venv")
tahoe_bin = File.join(tahoe_venv, "bin", "tahoe")
tahoe_cfg = File.join(tahoe_dir, "cfgs")
user 'tahoe' do
su... |
require './test/test_helper'
require './lib/season_statistics'
require './lib/stat_tracker'
require 'minitest/autorun'
require 'minitest/pride'
require 'mocha/minitest'
class StatTrackerTest < Minitest::Test
def setup
game_path = './data/games.csv'
team_path = './data/teams.csv'
game_teams_path = './dat... |
RSpec.configure do |config|
config.expect_with :rspec do |expectations|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end
config.mock_with :rspec do |mocks|
mocks.verify_partial_doubles = true
end
config.filter_run :focus
config.run_all_when_e... |
class Day < ActiveRecord::Base
validates :start_day, presence: :true
validates :end_day, presence: :true
belongs_to :event
def upvote
self.score += 1
self.save
end
def downvote
self.score -= 1
self.save
end
end |
class Group < ActiveRecord::Base
after_destroy :destroy_rollouts
has_many :memberships, dependent: :destroy
validates :name, presence: true, uniqueness: true
validate :validate_not_defined
attr_accessible :name
private
def destroy_rollouts
Rollout.where(group: name).each(&:destroy)
end
def val... |
class RenameContestColumns < ActiveRecord::Migration
def self.up
rename_column :contests, :start, :contest_start
rename_column :contests, :end, :contest_end
end
def self.down
end
end
|
source "http://rubygems.org"
# Add dependencies required to use your gem here.
# Example:
# gem "activesupport", ">= 2.3.5"
# Add dependencies to develop your gem here.
# Include everything needed to run rake, tests, features, etc.
group :development do
gem "bundler", "~> 1.0.0"
gem "jeweler", "~> 1.6.2"
gem "... |
# == Schema Information
#
# Table name: users
#
# id :integer not null, primary key
# first_name :string(255)
# last_name :string(255)
# email :string(255)
# phone :string(255)
# terms :boolean
# username :string(25... |
# spec/controllers/mixins/user_actions_helper.rb
require 'spec_helper'
require 'controllers/mixins/actions_base_helper'
require 'controllers/mixins/user_actions'
shared_examples_for Mithril::Controllers::Mixins::UserActions do
it_behaves_like Mithril::Controllers::Mixins::ActionsBase
it { instance.should resp... |
# Encoding: utf-8
Ohai.plugin(:Processes) do
provides 'processes'
collect_data(:linux) do
processes Mash.new
so = shell_out('ps -eo pid,euser,start_time,nice,%cpu,%mem,cmd')
so.stdout.lines do |line|
case line
when / PID EUSER START NI %CPU %MEM CMD/
next
else
l... |
def prime?(n)
if n.even? || n < 2
return false
else
(2..(n-1)).none? { |num| n % num == 0}
end
end
|
# encoding: UTF-8
module API
module Helpers
module V1
module SurveysHelpers
extend Grape::API::Helpers
def paginated_subscriber_surveys(surveys_list, options={})
response_data = surveys_list.map do |subscriber_survey|
if subscriber_survey.survey.is_a? SurveyPoll
... |
class AddFieldsToOpenings < ActiveRecord::Migration
def change
add_column :openings, :room, :string
add_column :openings, :open_date, :date
add_column :openings, :discovered_open, :datetime
add_column :openings, :discovered_closed, :datetime
end
end
|
require "rails_helper"
feature "Show a comment" do
let(:post) { create :post }
let!(:comment_1) { create :comment, post: post }
let!(:comment_2) { create :comment, post: post }
scenario "Visitor views a post" do
visit post_path(post)
expect(page).to have_content(comment_1.text)
expect(page).to hav... |
# encoding: utf-8
# Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module MobileCenterApi
#
# Microsoft Visual Studio Mobile Center API
#
class Releases
#
# Creates and initializes a new instance of ... |
class CommentsController < ApplicationController
def create
@comment = Comment.new(comment_params)
@comment.user = current_user
@comment.article = Article.find(params[:article])
@comment.save
redirect_to article_path(params[:article])
end
private
def comment_params
params.require(:co... |
class GroupsController < ApplicationController
def index
@groups = if can?(:manage, Group)
Group.all
else
current_user.groups
end
end
end
|
class Event < ApplicationRecord
belongs_to :host, class_name: "User"
has_many :eventsTags
has_many :rsvps
has_many :tags, through: :eventsTags
has_many :users, through: :rsvps
end
|
require_relative './application_service'
require 'openfoodfacts'
class BarcodeReader < ApplicationService
def initialize(upc)
@upc = upc
end
def call
# return a hash of product info
product = Openfoodfacts::Product.get(@upc, locale: 'jp')
if product
item_name = product.product_name
... |
class FontNotoSerifMyanmar < Formula
head "https://noto-website-2.storage.googleapis.com/pkgs/NotoSerifMyanmar-unhinted.zip", verified: "noto-website-2.storage.googleapis.com/"
desc "Noto Serif Myanmar"
homepage "https://www.google.com/get/noto/#serif-mymr"
def install
(share/"fonts").install "NotoSerifMyan... |
class PerMemberValue < ActiveRecord::Base
belongs_to :member
belongs_to :field
def valid_data?(errors)
if self.field.required? && (value.nil? || value == '')
errors.add(self.field.name, "Обязательно должно быть указано")
return false
end
return true
end
end
|
module ApplicationHelper
DEFAULT_NO_ANSWER = "No answer yet"
#returns the full title on a per-page basis
def full_title(page_title)
base_title = CONFIG[:title] || "Ruby on Rails Template"
if page_title.empty?
base_title
else
"#{base_title} | #{page_title}"
end
end
#returns the Display Name of th... |
require 'spec_helper'
feature 'Organization admin creates a private challenge' do
attr_reader :organization_admin, :challenge
scenario 'admin visits page' do
organization = create :organization
organization_admin = create :user, userable: organization
challenge = create :challenge, title: 'Reto activo'... |
require 'puppetlabs_spec_helper/module_spec_helper'
require 'rspec-puppet-facts'
include RspecPuppetFacts
RSpec.configure do |c|
default_facts = {
puppetversion: Puppet.version,
facterversion: Facter.version
}
default_facts.merge!(YAML.load(File.read(File.expand_path('../default_facts.yml', __FILE__)))) ... |
require "card.rb"
class Deck
VALUES = ['A', 'K', 'Q', 'J', '10', '9', '8',' 7', '6', '5', '4', '3', '2']
SUITES = ['heart', 'spade', 'diamond', 'club']
def initialize
self.build_deck
end
def draw_card
@cards.pop
end
def build_deck
result = []
VALU... |
Gem::Specification.new do |s|
s.name = 'dropybara'
s.version = '1.0.0'
s.licenses = ['Apache License 2.0']
s.date = '2018-02-05'
s.summary = 'Drag and drop files in Capybara'
s.authors = ['Sam Boylett']
s.email = 'sam.boylett@piksel.com'
s.homepage = 'https://github.com/pikselpalette/dropybara'
s.meta... |
module Azoogle
require 'yaml'
require 'soap/rpc/driver'
require 'date'
DEFAULT_REFCODE = '~RefCodeHere~'
class AzAdServer
def initialize(az_account=nil,referrer_code=nil)
if az_account.nil?
@az_account = (AzoogleAccount.find(:first) || AzoogleAccount.create)
else
... |
require 'rails_helper'
RSpec.describe Users::SessionsController, type: :controller do
let(:user) { create(:user) }
describe 'GET #new' do
it { expect(get(:new)).to render_template(:new) }
end
describe 'POST #create' do
context 'with valid details' do
before do
post :create, params: { us... |
#
# XcodeInstaller::Logout
#
module XcodeInstaller
class Logout
def action(args, options)
say_error "You are not authenticated" and abort unless Security::InternetPassword.find(:server => XcodeInstaller::AppleDeveloperCenter::HOST)
Security::InternetPassword.delete(:server => XcodeInstaller::AppleD... |
require_relative '../source/queue'
describe Queue do
let(:size) { 10 }
let(:queue) { Queue.new( size ) }
describe "#enqueue" do
it "should add an element to the queue" do
queue.enqueue('a')
end
it "Should add the elements in order" do
queue.enqueue('a')
queue.enqueue('b')
... |
class CreateCounselors < ActiveRecord::Migration[5.2]
def change
create_table :counselors do |t|
t.string :name
t.string :email
t.string :phone
t.string :unit_number
t.boolean :help_others
t.date :ypt
t.string :status
t.string :created_by
t.string :updated_by
... |
# hashes_ex_7.rb
# B. There is no method called keys for Array class
|
class RenameUserIdToProfessorIdInUniversityClasses < ActiveRecord::Migration[6.0]
def change
rename_column :university_classes, :user_id, :professor_id
end
end
|
class Menu < ApplicationRecord
include ActiveModel::Validations
include WorkWithDate
has_and_belongs_to_many :items
validate :only_one_menu_in_day
def start_time
self.created_at
end
private
def only_one_menu_in_day
errors.add(:created_at, "isn't available on this date") if Menu.today.exists... |
require 'rails_helper'
RSpec.describe Sword::Metadata::ParentPublication do
describe 'API/Interface' do
context 'has attr_accessor for the following instance var:' do
it 'doi' do
expect(subject).to respond_to(:doi)
expect(subject).to respond_to(:doi=)
end
it 'issue' do
... |
class CreateJobs < ActiveRecord::Migration
def change
create_table :jobs do |t|
t.integer "transaction_id", :null => false
t.integer "job_type_id", :null => false
t.integer "status", :default => 0, :null => false
t.datetime "create... |
require_relative "lib/yae/version"
Gem::Specification.new do |spec|
spec.name = "yae"
spec.version = Yae::VERSION
spec.authors = ["Stephen Ierodiaconou"]
spec.email = ["stevegeek@gmail.com"]
spec.summary = "yae (Yet Another Enum) provides a simple enum class (enumerated type) implementation, Yae::Enum"
sp... |
def reduce(array, num=0)
counter = 0
output = num
while counter < array.size
output = yield(output, array[counter])
counter += 1
end
output
end
array = [1, 2, 3, 4, 5]
puts reduce(array) { |acc, num| acc + num } # => 15
puts reduce(array, 10) { |acc, num| acc + num } ... |
require 'asciidoctor'
require 'asciidoctor-diagram'
require 'asciidoctor-revealjs'
outputdir = 'output'
imagesdir = 'images'
revealjs_theme = 'simple'
desc 'Cleans and sets up output directory'
task :dirs do
remove_dir outputdir
mkdir outputdir
cp_r 'images', outputdir
cp_r 'reveal.js', outputdir
end
desc 'B... |
class FontNotoSansCham < Formula
head "https://noto-website-2.storage.googleapis.com/pkgs/NotoSansCham-unhinted.zip", verified: "noto-website-2.storage.googleapis.com/"
desc "Noto Sans Cham"
homepage "https://www.google.com/get/noto/#sans-cham"
def install
(share/"fonts").install "NotoSansCham-Black.ttf"
... |
class TodoList < ActiveRecord::Base
has_many :todo_items, dependent: :destroy
belongs_to :user
default_scope {order('list_due_date')}
end
|
# frozen_string_literal: true
class GraphicsController < ApplicationController
before_action :set_graphic, only: %i[show edit update destroy]
# GET /graphics
# GET /graphics.json
def index
@graphics = Graphic.all
end
# GET /graphics/1
# GET /graphics/1.json
def show; end
# GET /graphics/new
... |
class PlayersController < ApplicationController
def index
@ranked_players = Player.ranked
@match = Match.new()
end
private
# Use callbacks to share common setup or constraints between actions.
# Never trust parameters from the scary internet, only allow the white list through.
def match_pa... |
class User < ActiveRecord::Base
validates :first_name, :last_name, :email, :password_hash, presence: true
validates :email, uniqueness: true
validates :password_hash, length: { minimum: 6}
include BCrypt
def password
@password ||= Password.new(password_hash)
end
def password=(new_password)
@pass... |
# Use to calculate different billing entites that are required to
# to create invoice
module Calculatable
extend ActiveSupport::Concern
def calculate_bill(patient)
calculate_days(patient) * ward_rate(patient) + calculate_appointments_charges(patient)
end
def calculate_days(patient)
days = (patient.di... |
# CMSBindingTest.rb
# June 29, 2007
#
$:.unshift File.join(File.dirname(__FILE__),'..','lib')
require 'test/unit'
require 'CMSBinding'
class TestCMSBindingTest < Test::Unit::TestCase
def setup
@cms = CMSBinding::CMSSource.new({:site => '0'})
end
def teardown
end
def test_simple_article
article ... |
require 'pry'
# Helper Method
def position_taken?(board, location)
!(board[location].nil? || board[location] == " ")
end
WIN_COMBINATIONS = [
[0,1,2], #top row
[3,4,5], #middle row
[6,7,8], #bottom row
[0,3,6], #left column
[1,4,7], #middle column
[2,5,8], #right column
[0,4,8], #top left to bottom ri... |
#
# Cookbook Name:: rsyslog
# Recipe:: client
#
# Copyright 2014, YOUR_COMPANY_NAME
#
# All rights reserved - Do Not Redistribute
#
include_recipe "rsyslog"
template "remote.conf" do
path "/etc/rsyslog.d/remote.conf"
owner "root"
group "root"
mode 0640
notifies :restart, 'service[rsyslog]'
end
|
shared_examples_for 'a REST adapter' do
include Rack::Test::Methods
def container_url_for(user)
raise NotImplementedError
end
def storage_class
raise NotImplementedError
end
it "returns 404 on non-existing routes" do
get "/virginmargarita"
_(last_response.status).must_equal 404
end
d... |
module Shoperb module Theme module Editor
module Mounter
module Model
class Page < Sequel::Model
extend Base::SequelClass
include Base::Sequel
fields :id, :state, :name, :content, :permalink, :handle, :translations, :template
translates :name, :content
def self.pri... |
require File.dirname(__FILE__) + '/../test_helper'
class BuildTest < ActiveSupport::TestCase
test "should validate" do
assert ! Build.new.valid?
assert Build.new(:plan_id => 1).valid?
end
test "should inherit revision from parent build if repository_url is equal" do
parent = Build.new(:revision ... |
class Article < ApplicationRecord
has_many :categories, through: :junctions
end
|
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe "Configuration" do
let(:configuration) { SharedWorkforce::Configuration.new }
describe "#api_key" do
it "should use the API key set in ENV['SHAREDWORKFORCE_API_KEY']" do
with_env 'SHAREDWORKFORCE_API_KEY', 'API_KEY_FROM_ENV' do
con... |
Spree::Taxon.class_eval do
LANG = Spree::Config[:locales].split(",").collect {|l| l.to_sym} rescue I18n.available_locales
translates :name, :description, :permalink, :fallbacks_for_empty_translations => true
globalize_accessors :locales => LANG, :attributes => [:name, :description, :permalink]
# Creates p... |
class GenresController < ApplicationController
before_action :set_genre, only: [:show, :edit, :update, :destroy]
# GET /genres
# GET /genres.json
def index
@genres = Genre.all
end
# GET /genres/1
# GET /genres/1.json
def show
end
# GET /genres/new
def new
@genre = Genre.new
end
# G... |
module CDI
module V1
module PageStructure
class LearningTrackPageSerializer < BaseSerializer
has_one :learning_track, serializer: ModelSerializer::LearningTrackSerializer
has_many :questions_templates, serializer: ModelSerializer::QuestionTemplateSerializer
has_many :categories, s... |
module Noodle
class EmptyValidator < ActiveModel::Validator
def validate(record)
if record.node_class_property.properties.key?('validators') && record.node_class_property.properties['validators'].key?('integer')
record.errors.add(:empty_value, 'Valu must be an integer', strict: true) unless reco... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.