text stringlengths 10 2.61M |
|---|
require 'rails_helper'
RSpec.describe Criterium, type: :model do
before(:each) do
@user = User.create(name: "Gavrila", password: "qwerty")
@comparsion = Comparsion.create(name: "Gavrila_comparsion", user: @user)
end
describe 'create and validate' do
it "is valid with valid attributes" do
expect... |
module Yuki
module Store
class TokyoTyrant < Yuki::Store::AbstractStore
require 'rufus/tokyo/tyrant'
def initialize(config = {})
@socket = config[:socket] if config.include? :socket
@host, @port = config[:host], config[:port]
end
def valid?
unless(socket... |
# GSPlan - Team commitment planning
#
# Copyright (C) 2008 Jan Schrage <jan@jschrage.de>
#
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU
# General Public License as published by the Free Software Foundation, either version 3 of the License,
# or (at your option) ... |
# Identify the type of a MovementRow
class MovementIdentifier
attr_reader :movement_row
ORDER_REGEX = /commande|composant|composants|order|brique|cube|cable|câble|carte sd|batterie|sata/i
VPN_REGEX = /cotisation|abonnement|redevance|vpn|don|donnation|contribution|adhesion|participation|soutien/i
NEUTRINET_ACCO... |
json.product do
json.extract! @product, :id, :name, :description, :category, :price, :average_rating
json.imageUrl url_for(@product.photo)
json.reviewIds @product.reviews.pluck(:id)
end
@product.reviews.includes(:user).each do |review|
json.reviews do
json.set! review.id do
json.extract! review, :id,... |
require './helpers/tweet_helper'
require './helpers/user_helper'
class UserController < ApplicationController
helpers Sinatra::UserHelpers
helpers Sinatra::TweetHelpers
get '/signup' do
erb :signup
end
post '/signup' do
new_user = User.new(params)
if new_user.save
login(new_user)
re... |
#!/usr/bin/ruby
require 'phashion'
require 'rubygems'
# take directory name from command line argument and create an array of its contents
unless ARGV[0].nil?
inDir = Dir.new( ARGV[0] ) # check that directory is legit
unless Dir.exists?( inDir ) then exit; end;
globFilter = "*.jpg" # only look for JPEGs
num... |
class Employee < Account
has_many :time_entries
has_and_belongs_to_many :job_orders, :join_table => "employee_job_orders"
def total_hours
time_entries.sum(:time)
end
def log_time(amount, company)
TimeEntry.create(time: amount, employee: self, account: company)
end... |
require 'serverspec'
set :backend, :exec
describe 'chef-server-populator-configurator' do
describe file('/etc/opscode/pivotal.rb') do
it { should be_file }
end
describe file('/etc/opscode/chef-server.rb') do
its(:content) { should match /api_fqdn "localhost"/ }
end
end
describe 'chef-server-org-crea... |
# vim: set expandtab ts=2 sw=2 nowrap ft=ruby ff=unix : */
require 'sinatra/base'
require 'sinatra/json'
require './lib/api-server/error'
module ApiServer
class Handler < Sinatra::Base
helpers Sinatra::JSON
helpers do
include Rack::Utils
# Execute query
#
# @param [Arel::SelectManag... |
require 'rails_helper'
RSpec.describe PurchaseBuyer, type: :model do
describe '購入情報の保存' do
before do
user = FactoryBot.create(:user)
product = FactoryBot.create(:product)
@purchase_buyer = FactoryBot.build(:purchase_buyer, user_id: user.id, product_id: product.id)
sleep 0.1
end
c... |
class WelcomeController < ApplicationController
def index
@abouts = About.all
@works = Work.order("id DESC")
@education = Education.all
@portfolio = Portfolio.all
end
end
|
# if we need multiple if elsif and els blocks then we should us case statements
# we have a number and we need to check its value
# example 1
#
# number = 1
# case number
# when 0
# puts "number is 0"
# when 1
# puts "number is 1"
# else
# puts "number is neither 0, nor 1"
# end
# we can make var assignments with... |
require File.dirname(__FILE__) + "/spec_helper"
if HAS_SQLITE3 || HAS_MYSQL || HAS_POSTGRES
describe 'DataMapper::Is::Versioned' do
before :all do
class Form
include DataMapper::Resource
include DataMapper::Is::Versioned
property :id, Integer, :serial => true
property :name... |
#!/usr/bin/env ruby
class SeatLayout
attr_reader :height, :width
def initialize(matrix)
@matrix = matrix
@height, @width = @matrix.length, @matrix.first.length
end
def ==(other)
return false unless @height == other.height && @width == other.width
(0...@height).each do |row|
(0...@width... |
#
# Be sure to run `pod lib lint EZBasicKit.podspec" to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = "EZBasi... |
require "rails_helper"
RSpec.describe Nonce, type: :model do
describe "valid?" do
it "is true when nonce is unique" do
nonce = "asdf1234"
expect(described_class.valid?(nonce)).to be true
end
it "is false for duplicate nonce" do
nonce = "asdf5678"
described_class.create!(nonce: no... |
ENV['RACK_ENV'] = 'test'
require 'rack/test'
require 'test/unit'
require File.expand_path(File.dirname(__FILE__) + '/../fetcher.rb')
require File.expand_path(File.dirname(__FILE__) + '/../news.rb')
require File.expand_path(File.dirname(__FILE__) + '/../reaction.rb')
require File.expand_path(File.dirname(__FILE__) + '/... |
# InSpec test for recipe KafkaServer::Install
# The InSpec reference, with examples and extensive documentation, can be
# found at https://www.inspec.io/docs/reference/resources/
%w(java-1.8.0-openjdk-devel git tmux).each do |package|
describe package(package) do
it { should be_installed }
end
end
describe g... |
class Furniture < ActiveRecord::Base
has_many :comments
has_many :photos
belongs_to :shop
has_attached_file :avatar , :styles => { :profile => "600x600>", :thumb => "300x300>" }
validates_attachment_content_type :avatar, :content_type => ["image/jpg", "image/jpeg", "image/png"]
validates_presence_of :tit... |
# Board represents a board to be used for a game of 3 by 3
# Tic Tac Toe. You can place pieces, get the board, as well
# as remember the winner.
class Board
# initializes a new empty Board
def initialize
@board = [" ", " ", " ",
" ", " ", " ",
" ", " ", " "]
@winner = " "
@@connect... |
# A sub-namespace.
module Restful::Resource
autoload :Base, "restful/resource/base"
autoload :Collection, "restful/resource/collection"
autoload :Pagination, "restful/resource/pagination"
autoload :AssociationProxy, "restful/resource/association_proxy"
autoload :Scope, ... |
class HouseholdmembershipController < ApplicationController
before_filter :hhmembership_owner, only: [:destroy]
def destroy
#Destroy the membership
household_membership = Householdmembers.where(hhid: params[:id], member: current_user.id)
household_name = Household.find( params[:id] ).hhname
household_member... |
RSpec.feature "Users can view budgets on an activity page" do
before do
authenticate!(user: user)
end
after { logout }
context "when the user belongs to BEIS" do
let(:user) { create(:beis_user) }
context "when the activity is fund_level" do
scenario "budget information is shown on the page" ... |
# frozen_string_literal: true
class AggregatedScores::GameDecorator
include BaseDecorator
attr_reader :scores
def initialize(scores)
@scores = scores
end
def call
if !scores.empty?
scores
.group(
'scores.dropped_side',
'scores.position_id',
'scores.shot_t... |
class CashRegister
attr_reader :discount, :total, :items
attr_writer :total
def initialize(discount = 0)
@discount = discount
@total = 0
@last_transcation = 0
@items = []
end
def add_item(title, price, qty = 1)
@last_transcation = price * qty
self.total += @last_transcation
qty.t... |
# Command for listing configuration variables.
class Golem::Command::Environment < Golem::Command::Base
# @private
USAGE = "\nlist configuration values"
# List configuration variables that are set.
def run
print "Configuration values:\n"
print Golem::Config.config_hash.collect {|k, v| "\t " + k.to_s ... |
module SumoLogic
module Kubernetes
# module for caching strategy
module CacheStrategy
require 'lru_redux'
require_relative 'reader.rb'
CACHE_TYPE_POD_LABELS = 'pod_labels'.freeze
def init_cache
@all_caches = {
CACHE_TYPE_POD_LABELS => LruRedux::TTL::ThreadSafeCache.... |
module Middleman
class GDriveDataHelpers < GDriveExtension
def initialize(app, options_hash={}, &block)
super
app.helpers do
def getItemByPosition(grid_position, page_data_request)
item_by_position = page_data_request.find { |k| k['grid_position'] == grid_position }
item_... |
module Token
# Serves as Base-Class for all registered tokens. Registering a token with
#
# Token:Handler.register :awesome, :template => :foo, :description => "Description"
#
# is pretty much equivalent to
#
# class Token::AwesomeToken < Token::Token; end
# Token::AwesomeToken.proces... |
class UserController < ApplicationController
before_action :authorize_request, except: [:create, :find_user_by_email]
# GET /users
def index
@users = User.all
render json: @users, status: :ok
end
# GET /users/:id
def show
@user = User.find(params[:id])
render json: @user, status: :ok
rescue Act... |
FactoryBot.define do
factory :bike do
id { Faker::Number.number(digits: 8) }
model { Faker::Alphanumeric.alpha(number: 6) }
status { 'active' }
end
end
|
class DailyForecast
attr_reader :high, :low, :id, :today, :tonight, :icon
def initialize(forecast)
@id = nil
@icon = forecast[:daily][:icon]
@today = forecast[:daily][:data].first[:summary]
@high = forecast[:daily][:data].first[:temperatureHigh]
@low = forecast[:daily][:data].first[:temperatur... |
require 'orocos/test'
describe Orocos::InputWriter do
if !defined? TEST_DIR
TEST_DIR = File.expand_path(File.dirname(__FILE__))
DATA_DIR = File.join(TEST_DIR, 'data')
WORK_DIR = File.join(TEST_DIR, 'working_copy')
end
CORBA = Orocos::CORBA
include Orocos::Spec
it "should no... |
" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
" source ~/.vimrc.before if it exists.
if filereadable(expand("~/.vimrc.before"))
source ~/.vimrc.before
endif
" ================ General Config ====================
e... |
class FriendRequestsController < ApplicationController
before_action :set_friend_request, only: [:show, :edit, :destroy]
# GET /friend_requests
# GET /friend_requests.json
def index
@friend_requests = FriendRequest.all
end
# GET /friend_requests/1
# GET /friend_requests/1.json
def show
end
# ... |
Factory.define :measurement do |measurement|
measurement.uid {UUIDTools::UUID.random_create }
measurement.altitude {rand 50000 }
measurement.speed {rand 200 }
measurement.latitude {rand * 360 - 180 }
measurement.longitude {rand * 360 - 180 }
measurement.accuracy {rand 2000 }
measurement.altitude_accuracy ... |
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most co... |
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe AllowlistedJwt, type: :model do
let(:alj) { build(:allowlisted_jwt) }
describe 'object' do
it { expect(alj).to be_valid }
end
context 'validations' do
describe 'jti' do
it 'should have error if NOT present' do
alj = bu... |
# Add it up!
# Complete each step below according to the challenge directions and
# include it in this file. Also make sure everything that isn't code
# is commented in the file.
# I worked on this challenge with Monique Williamson.
# 0. total Pseudocode
# make sure all pseudocode is commented out!
# Inp... |
# frozen_string_literal: true
# rubocop:todo all
require 'spec_helper'
# Create a client with all possible configurations (forcing/discovering each
# topology type) and ensure the resulting client is usable.
describe 'Client construction' do
let(:base_options) do
SpecConfig.instance.test_options.merge(
se... |
require 'rails_helper'
RSpec.describe OrderItem, type: :model do
before do
@user = User.create!(username: "mitch", password: "password", role: 0)
@item = Item.create!(title: "dinosaur", description: "aksdhk", price: 3)
@order = Order.create!(user_id: @user.id, status: 0)
@order_item = OrderItem.creat... |
class User < ApplicationRecord
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable, :confirmable
validates :name, :username, :country, :company_name, presence: true
validate :profit_share, if: Proc.new { |user| user.admin? }
validates :profit_share, ... |
module Transferit
module V1
module Entities
class Users < Grape::Entity
expose :id
expose :star
expose :first_name
expose :last_name
expose :phone
expose :avatar
end
class Cities < Grape::Entity
expose :title
expose :id
end
... |
class Point
attr_reader :x, :y
def initialize(x, y)
@x = x
@y = y
end
def +(velocity)
Point.new(
x + Math.cos(velocity.angle) * velocity.speed,
y + Math.sin(velocity.angle) * velocity.speed
)
end
def colliding?(player_position, radius:)
distance(player_position) < Player::... |
#
# Cookbook Name:: dbforbix
# Recipe:: drivers
#
# Author:: Hugo Cisneiros (hugo.cisneiros@movile.com)
# Author:: Tiago Cruz (tiago.cruz@movile.com)
#
# Copyright:: 2017-2018, Movile
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
#... |
class Public::RelationshipsController < ApplicationController
before_action :authenticate_user!, except: [:followings, :followers]
def create
current_user.follow(params[:user_id])
redirect_to request.referer
end
def destroy
current_user.unfollow(params[:user_id])
redirect_to request.referer
... |
class AddFixedMechatUrlToInstances < ActiveRecord::Migration
def change
add_column :instances, :fixed_mechat_url, :string, defalt: ''
end
end
|
class Picture < ActiveRecord::Base
belongs_to :project
belongs_to :achievement
end
|
class User < ActiveRecord::Base
VALID_NAME = /\A[a-zA-Z]+\z/
validates :firstName, presence: true, length: { maximum: 20}, format: { with: VALID_NAME }
validates :lastName, presence: true, length: { maximum: 20}, format: { with: VALID_NAME }
VALID_EMAIL = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
val... |
require 'spec_helper'
describe CompanyAdmin::UsersController do
# fixtures :all
render_views
before(:each) do
activate_authlogic
@user = Factory(:user, :email => 'hehe@iseeyou.com')
login_as(@user)
@company = Factory(:company, :name => 'BBLaha')
employee = Factory(:employee, :user => @user... |
class Product < ApplicationRecord
has_many :product_combinations
has_many :combinations, :through => :product_combinations
end
|
module ApplicationHelper
BOOTSTRAP_ALERTS = { 'notice' => 'alert-success', 'alert' => 'alert-danger' }.freeze
DEFAULT_BOOTSTRAP_ALERT = 'alert-primary'.freeze
def flash_message(type, msg)
alert_type = BOOTSTRAP_ALERTS[type] || DEFAULT_BOOTSTRAP_ALERT
content_tag :div, sanitize(msg, attributes: %w[href t... |
require './description_list.rb'
require './Enemy.rb'
class Room
def initialize(y_index)
initialize_loot(y_index)
initialize_enemies(y_index)
initialize_description()
end
def inspect_room
puts @description
@enemies.each_with_index {|enemy, index|
puts "There is an #{enemy.name} in this r... |
require 'rails_helper'
# RSpec.describe Driver, type: :model do
# pending "add some examples to (or delete) #{__FILE__}"
# end
describe Driver do
it "has a valid factory" do
expect(build(:driver)).to be_valid
end
it "is invalid without a name" do
driver = build(:driver, name: nil)
driver.valid?
expect... |
require 'eb_ruby_client/support/resource'
RSpec.describe EbRubyClient::Support::Resource do
let(:test_class) { Class.new.include(EbRubyClient::Support::Resource) }
subject(:included_modules) { test_class.included_modules }
subject(:extended_modules) { test_class.singleton_class.included_modules }
describe "wh... |
# frozen_string_literal: true
module Types
module Objects
class AlbumObject < ::Types::Objects::BaseObject
description 'アルバム'
field :id, ::String, null: false, description: 'ID'
field :name, ::String, null: false, description: 'タイトル'
field :upc, ::String,... |
class Adivinhacao
def initialize numEscolhido
@numEscolhido = numEscolhido
end
def sorteio
@sorteio = rand(100)
end
def tentativa
if @numEscolhido == @sorteio
puts "Você inseriu o nº #{@numEscolhido}"
puts "Você acertou o nº sorteado, parabéns!"
... |
class AddColumnstoUser < ActiveRecord::Migration[5.0]
def change
add_column :users, :first_name, :string
add_column :users, :last_name, :string
add_column :users, :course, :string
add_column :users, :student_number, :string
add_column :users, :tutor, :string
end
end
|
# frozen_string_literal: true
# rubocop:todo all
module ClientRegistryMacros
def new_local_client(address, options=nil, &block)
ClientRegistry.instance.new_local_client(address, options, &block)
end
def new_local_client_nmio(address, options=nil, &block)
# Avoid type converting options.
base_options... |
class AddressesController < ApplicationController
before_action :authenticate_user!
def edit
@address = current_user.addresses.first
end
def update
address = current_user.addresses.first
if address.update!(address_params)
redirect_to "/users/mypage"
else
render :edit
end
end
... |
class User < ApplicationRecord
# Relationships between User and other Models
has_many :bookings
has_many :favorites
has_many :workspaces, through: :bookings
has_many :workspaces, through: :favorites
# Validations for User model
has_secure_password
validates :username, :password, :password_confirmation... |
require 'spec_helper'
describe 'nscd' do
let (:facts) { {
:operatingsystem => 'Ubuntu'
} }
context 'with default params' do
it do should contain_package('nscd').with(
'ensure' => 'present',
'name' => 'nscd'
) end
it do should contain_service('nscd').with(
'ensure' => '... |
# === COPYRIGHT:
# Copyright (c) Jason Adam Young
# === LICENSE:
# see LICENSE file
module QueryTools
extend ActiveSupport::Concern
included do
scope :for_season_year, lambda {|season_year| where(season_year: season_year)}
end
end
|
# coding: utf-8
# Copyright: Hiroshi Ichikawa <http://gimite.net/en/>
# License: New BSD License
$KCODE = "u"
require "securerandom"
require "net/http"
require "pp"
require "cgi"
require "time"
require "enumerator"
require "rss"
require "open-uri"
require "rubygems"
require "json"
require "oauth"
require "twitter"
... |
class UsersController < ApplicationController
before_action :set_user, only: [:show, :edit, :update, :destroy]
access admin: :all
# GET /users
def index
# this view should be removed later - we used dashboards instead
@users = User.all
end
# GET /users/1
def show
end
# GET /users/new
def ... |
require "rails_helper"
describe RewardTrigger::ByTransactions do
let!(:user) { create :user }
let(:subject) { RewardTrigger::ByTransactions }
describe "give cash rebate" do
let!(:cash_rebate_reward) { create :reward, name: "5% Cash Rebate" }
describe "when user has not claimed cash rebate reward" do
... |
module Api::MetricsHelper
# TODO: make presenters for the metrics based on value,
# value_description, relevant_date/year, num_metrics and DRY this up
# and docstring
# Take a company, poop out their metrics dashboard.
def metrics_dashboard(company_id, current_user)
if current_user.nil?
return limi... |
module Kernel
def describe(comment)
puts comment.red
if block_given?
yield
else
p "Missing block"
end
end
def it(comment)
if block_given?
begin
yield
puts comment.green
rescue => e
puts comment.red
puts e.to_s.red
end
else
... |
# frozen_string_literal: true
class CommitteeReportsController < ApplicationController
before_action :set_committee_report, only: %i[show edit update destroy]
before_action :admin_required
def index
@committee_reports = CommitteeReport.all
end
def show; end
def new
@committee_report = CommitteeR... |
require 'chunks/wiki'
# Includes the contents of another page for rendering.
# The include command looks like this: "[[!include PageName]]".
# It is a WikiReference since it refers to another page (PageName)
# and the wiki content using this command must be notified
# of changes to that page.
# If the included page co... |
module Haenawa
module Exceptions
module Unsupported
class TargetType < StandardError; end
end
end
end
|
class CreateApiPrototypes < ActiveRecord::Migration
def change
create_table :api_prototypes do |t|
t.integer :faker_id
t.text :prototype
t.timestamps
end
add_index :api_prototypes, :faker_id
end
end
|
class ApplicationController < ActionController::Base
protect_from_forgery
rescue_from CanCan::AccessDenied do |exception|
Rails.logger.debug "Access denied on #{exception.action} #{exception.subject.inspect}"
redirect_to access_denied_path, alert: exception.message
end
def curr_user_course
if curr... |
require_relative 'pseudocode.rb'
class Microprocessor < PseudoCodeScript
def initialize(*a)
super(*a)
default_values do
unhook_all()
@power = :normal
@temp = :normal
@footprint_elapsed = false
@rx = nil
@downlink_window = 10
@no_recent_contact = false
end
... |
class Contact < ActiveRecord::Base
belongs_to :client
validates :client_id, presence: true
validates :name , presence: true
end
|
require_relative '../spellcorrection.rb'
describe 'String' do
describe 'remove_repeats' do
it 'removes repeats for characters' do
'fffffddddsssss'.remove_repeats.should == 'fds'
end
it 'removes repeats for numbers' do
'11112222222'.remove_repeats.should == '12'
end
it 'removes repea... |
require_relative 'item'
class ItemRepository
attr_reader :item, :all_items, :sales_engine
def initialize(csvtable, sales_engine = "")
@item = csvtable
@all_items = make_items
@sales_engine = sales_engine
end
def make_items
item.by_row.map do |row|
Item.new(row[:id],
row[:n... |
# encoding: utf-8
require 'test/helper'
class Nanoc3::DataSources::FilesystemVeboseTest < MiniTest::Unit::TestCase
include Nanoc3::TestHelpers
# Test preparation
def test_setup
# Create data source
data_source = Nanoc3::DataSources::FilesystemVerbose.new(nil, nil, nil, nil)
# Remove files to mak... |
class AddUserRefToComments < ActiveRecord::Migration
def change
add_foreign_key :comments, :users
add_index :comments, :user_id
end
end |
require 'net/http'
require 'uri'
require 'openssl'
require 'rubygems'
module Ereignishorizont
class Client
VERSION = '2.0.0'
# Class-wide configuration
@@api_token = nil
@@url = nil
attr_reader :api_token, :url
def initialize(url = nil, api_token = nil)
@url = (url ... |
module Exim
module Importer
def self.extname_file(file)
File.extname(file.filename)
end
def self.f_row
1 || 0
end
def self.import_file(klass,file,key)
spreadsheet = open_spreadsheet(file[:file])
header = file[:sortable_schema].split(',')
head... |
Rails.application.routes.draw do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
#ユーザー関連のルーティング
root 'home#index'
get 'users/mypage', to: 'users#mypage'
get 'users/edit', to: 'users#edit'
post 'login', to: 'sessions#create'
delete 'logout', to: 'sess... |
require 'jievro/parser/tools/tokens'
def source
'for ; ; { }'
end
def expected_tokens
[
T_FOR,
T_WHITESPACES(' '),
T_SEMICOLON,
T_WHITESPACES(' '),
T_SEMICOLON,
T_WHITESPACES(' '),
T_OPEN_CURLY_BRACKET,
T_WHITESPACES(' '),
T_CLOSE_CURLY_BRACKET
]
end
def expected_ast
{
... |
# == Schema Information
#
# Table name: events
#
# id :integer not null, primary key
# title :text
# url :string(255)
# location :string(255)
# start_time :datetime
# created_at :datetime not null
# updated_at :datetime not null
# end_time :datetime
# us... |
require 'test_helper'
require 'minitest/mock'
class ProductTest < ActiveSupport::TestCase
fixtures %w(
attachment/product_attachments
category/links
category/products
customer_prices
customers
keyword/customer_subcategories
keywords
manufacture_order/composite_rows
manufacture_ord... |
require 're_captcha/configuration'
module ReCaptcha
module Configurable
def configuration
@configuration ||= Configuration.new
end
def configure
yield(configuration) if block_given?
end
end
end
|
class DeleteStartTimeInMeetings < ActiveRecord::Migration[6.0]
def change
remove_column :meetings, :start_time, :datetime
end
end
|
require 'rubygems'
require 'active_resource'
require_relative 'revision'
module PMS
class Issue < ActiveResource::Base
self.site = 'http://pms.foradian.org/'
self.user = 'api-key'
self.password = 'random'
def related_revisions
SVN::Revision.search(self.id)
end
end
end
# # Retrieving issue... |
# frozen_string_literal: true
class Bridgetown::Site
module Writable
# Remove orphaned files and empty directories in destination.
#
# @return [void]
def cleanup
@cleaner.cleanup!
end
# Write static files, pages, and documents to the destination folder.
#
# @return [void]
d... |
# frozen_string_literal: true
namespace :permissions do
desc 'Reload user permissions'
task reload: :environment do
Permission.transaction do
# Delete old permissions
Permission.delete_all
# Clean permissions cache
Rails.cache.delete('permissions')
# Load permissions
Barong:... |
# { "coins": { "1": 10, "5": 10, "10": 10, "25": 10, "50"; 10 } }
# { "coins": { "50": 5, "25": 4 } }
require 'rubygems'
require 'bundler'
require 'json'
Bundler.require
# $coins = {}
$coins = { 50 => 5, 25 => 4, 10 => 5, 5 => 10}
class NoCoinsException < StandardError
end
class CoinsExchanger
attr_accessor :coi... |
class User < ActiveRecord::Base
has_many :user_countries
has_many :countries, through: :user_countries
has_secure_password
validates :username, presence: true, uniqueness: { case_sensitive: false }
validates :email, presence: true, uniqueness: { case_sensitive: false }
validates :password, prese... |
module ModuleElements
class ElementsPage
def self.elementoLinkPagina
return "/"
end
#Elementos Pagina de Login
def self.elementoUser
return "input[id=normal_login_username]"
end
def self.elementoPassword
return "input[i... |
class Clue
include Neo4j::ActiveNode
property :url, type: String
property :name, type: String
has_n(:persons).to(Person)
has_n(:organizations).to(Person)
has_n(:plots).to(Plot)
has_n(:information_sources).to(InformationSource)
end
|
# encoding: utf-8
class ProfilePictureUploader < CarrierWave::Uploader::Base
include CarrierWave::MiniMagick
storage :file
# This is a sensible default for uploaders that are meant to be mounted:
def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
# Provide a defaul... |
require 'rails_helper'
RSpec.describe 'contact us page' do
example 'when not logged in' do
visit contact_us_path
expect(page).to have_content 'Hey there'
expect(page).to have_link 'Schedule a call with us'
end
example 'when logged in' do
account = create_account(:onboarded)
person = account.... |
class User < ApplicationRecord
has_many :playlist
validates :name, presence: true
validates :email, presence: true, uniqueness: true
end
|
require 'spec_helper'
module Stride
RSpec.describe User do
describe '.fetch!' do
before do
Stride.configure do |config|
config.client_id = 'some client id'
config.client_secret = 'some client secret'
end
end
context 'when successful' do
before do... |
class Student
# Remember, you can access your database connection anywhere in this class
# with DB[:conn]
attr_accessor :name, :grade
attr_reader :id
def initialize (name, grade, id = 1)
@name = name
@grade = grade
@id = id
end
def self.create_table
sql = "CREATE TABLE students (
id INTEGER PRIMARY K... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.