text stringlengths 10 2.61M |
|---|
class Profile < ActiveRecord::Base
belongs_to :user
validate :first_and_last_not_null
validates :gender, format: {with: /male|female/}
validate :not_male_sue
scope :ordered_by_birth_year, -> { order birth_year: :asc}
def first_and_last_not_null()
if not first_name and not last_name
err... |
require 'rails_helper'
describe WelcomeFacade do # rubocop:disable Metrics/BlockLength
it 'exists' do
params = {}
user = create(:user)
wf = WelcomeFacade.new(params, user)
expect(wf).to be_a(WelcomeFacade)
end
describe 'instance methods' do
before :each do
@params = {}
@user = cre... |
#
# Cookbook Name:: coobramailserver
# Recipe:: default
#
# Copyright 2014, COOBRA
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unles... |
# frozen_string_literal: true
require 'test_helper'
class DateRangeControllerTest < ActionDispatch::IntegrationTest
setup do
@date_range = date_ranges(:one)
end
test 'should get index' do
get date_ranges_url
assert_response :success
end
test 'should get new' do
get new_date_range_url
a... |
require 'spec_helper'
describe Spree::SalePrice do
let!(:product) { create(:product, price: 50) }
let!(:variant) { create(:variant, price: 50) }
let(:sale_price) { create(:sale_price) }
context "product#put_on_sale" do
context "when put on sale" do
before {
product.put_on_sale(10, {start_at:... |
# Events
module Ruborobo
$bot.evt(:command_error) do |ev, cmd, exception|
ev.respond "#{['Apparently Ry or Erisa can\'t code.', 'Oof, ow, ouchie.', 'Whee, bugs.', 'Woah, a Ruby bug! Let\'s pester Erisa about it!', 'Oops, I died again. Thanks Ry.'].sample}\n```\n#{exception}```\n(Error in command #{cmd.name... |
require 'scasm/isa'
require 'scasm/statement'
require 'scasm/value'
module SCASM
# TODO keep track of line number for error reporting
class Parser
HEX_RE = /^0[xX][0-9a-fA-F]+$/
INT_RE = /^\d+$/
REG_RE = /^[A-Z]+$/
LABEL_RE = /^[a-z]+$/
INDIRECT_RE = /^\[.+\]/
INDIRECT_OFFSET_RE = /^[^+]+\+[^+]+$/
def ... |
class Ability
include CanCan::Ability
def initialize(user)
user ||= User.new # guest user (not logged in)
return can :manage, :all if user.admin?
can :manage, User, id: user.id
can :manage, Task, user_id: user.id
if user.manager?
can :manage, User do |managed_user|
managed_user... |
require 'spec_helper'
describe HTTPalooza do
it 'has a version number' do
expect(HTTPalooza::VERSION).not_to be nil
end
it 'should be hilarious' do
hilarious = true
expect(hilarious).to eq(true)
end
it 'can make a request for everyone' do
responses = HTTPalooza.invite.everyone.except_user_b... |
require_relative 'application_view'
class UsersView < ApplicationView
def index
header
body do
line('Users:')
@locals[:users].each do |user|
line("[#{user['id']}] - #{user['name']} - #{user['email']}")
end
end
footer
end
end
|
module Hermes
module Plugin
class Cat
##
# Feed parser for http://cat.jackpolgar.com.
#
module Nirix
##
# String containing the feed URL.
#
# @return [String]
#
URL = 'http://cat.jackpolgar.com/feed.atom'
##
# Returns the det... |
require 'rails_helper'
RSpec.describe Coin, type: :model do
describe '#on_bittrex?' do
it "is true when BitTrex included" do
subject.exchanges << "BitTrex"
expect(subject.on_bittrex?).to be_truthy
end
it "is false when not included" do
expect(subject.on_bittrex?).to be_falsey
end
... |
class Like < ActiveRecord::Base
belongs_to :likable, polymorphic: true
belongs_to :user
validates_uniqueness_of :user_id, scope: [:likable_id, :likable_type],
message: "Already liked"
end |
module Rocket
class Engine
attr_reader :avg_speed
SPEED_FACTOR = 10
def initialize(avg_speed, random_generator, stddev = 100)
@rand_helper = random_generator
@avg_speed = avg_speed
@stddev = stddev
@valid = false
@next = 0
@estabilization_time = time_for_reaching_aver... |
require 'rspec_helper'
describe Block do
it "Blocks that are wool can have their data set by color" do
b = Block.of :wool
b.color = :orange
b.data.should == 1
end
it "ensures wool blocks be white by default" do
b = Block.of :wool
b.color.should == :white
end
it "has block colors" do
... |
### Testing task 2 code:
# Carry out dynamic testing on the code below.
# Correct the errors below that you spotted in task 1.
require_relative('card.rb')
class CardGame
#no def initialize or attr_reader or accessor
def checkforAce(card)
if card.value = 1 #this should be a double ==
return true
e... |
require 'test_helper'
class WorkingArticlesControllerTest < ActionDispatch::IntegrationTest
setup do
@working_article = working_articles(:one)
end
test "should get index" do
get working_articles_url
assert_response :success
end
test "should get new" do
get new_working_article_url
assert... |
class SetDefaultsToWarRequests < ActiveRecord::Migration[6.1]
def change
change_column_default :war_requests, :bet_point, 200
change_column_default :war_requests, :max_no_reply_count, 5
change_column_default :war_requests, :include_ladder, false
change_column_default :war_requests, :inclued_tournament... |
class Conditions
def self.classCondition(clazz)
proc { |value|
value.is_a? clazz
}
end
def self.valueCondition(expected_value)
proc { |value|
expected_value == value
}
end
def self.messagesCondition(*messages)
proc { |object|
messages.all? { |message|
object.r... |
# frozen_string_literal: true
require 'bundler/setup'
require 'active_record'
require 'rspec/core'
require 'rspec/core/rake_task'
require 'dotenv'
Dotenv.load
include ActiveRecord::Tasks
RSpec::Core::RakeTask.new
task :default => :spec
task :test => :spec
DatabaseTasks.root = File.dirname(__FILE__)
db_dir = File.... |
module Asaas
class Discount < Model
transform_keys(&:to_sym)
DiscountTypes = Types::Strict::String.enum('FIXED', 'PERCENTAGE')
attribute :value, Types::Coercible::Float
attribute :dueDateLimitDays, Types::Coercible::Integer.optional.default(0)
attribute :type, DiscountTypes
end
end |
class ZipCode < ActiveRecord::Base
validates :postal_code, :fip_id, presence: true
validates :postal_code, uniqueness: true
belongs_to :fip
end
|
class RenameIconUrlToIconPathInChallenges < ActiveRecord::Migration
def change
rename_column :challenges, :icon_url, :icon_path
end
end
|
class AddIndexToFirstLastName < ActiveRecord::Migration
def change
add_index :users, :first_name, unique: true
add_index :users, :last_name, unique:true
end
end
|
require 'net/ftp'
module Backup
module Storage
class FTP < Backup::Storage::Base
attr_accessor :user, :password, :ip, :path, :tmp_path, :final_file
# Stores the backup file on the remote server using FTP
def initialize(adapter)
%w(ip user password path).each do |method|
... |
require_relative '../main.rb'
require 'fileutils'
describe 'AppHelpers' do
subject do
Class.new { extend AppHelpers }
end
describe '#invalidUser' do
context 'given two strings consisting of letters and numbers' do
it 'should return false' do
expect(subject.invalidUser('Bob12345', 'asdfADF2... |
module Scheherazade
class CharacterBuilder < Struct.new(:character)
AUTO = 'Auto' # Note: must be equal? to AUTO (i.e. same object), not just ==
def initialize(character)
super
@chain = [character]
while (c = story.characters[@chain.first])
@chain.unshift c
end
@model =... |
require 'test_helper'
class ReminderJobTest < ActiveSupport::TestCase
test "message is sent on perform" do
#setup
pregnant = pregnant_make
subscriber = pregnant.subscribers.find_by_offset(0)
message = pregnant.messages.first
job = ReminderJob.new(subscriber.id, pregnant.id, message.id)
... |
class PageGenerator < RubiGen::Base
attr_reader :name, :module_name
def initialize(runtime_args, runtime_options = {})
super
usage if args.empty?
@name = args.shift
@module_name = @name.camelcase
end
def manifest
record do |m|
m.directory 'src'
m.directory 'test/unit'
... |
require 'spec_helper'
RSpec.describe 'combine_reducers' do
before do
@page = visit('/')
end
it 'returns a composite reducer that maps the state keys to given reducers' do
res = @page.eval_ruby do
counter_reducer = Redux.create_reducer do |state, action|
state = 0 if state.nil?
acti... |
информация о кино с kinopoisk.ru
{command} [название/идентификатор]/[[*] [название]]
*/{command} A Beautiful Mind
бот будет искать фильм с названием "A Beautiful Mind"
*/{command} 530
бот покажет страницу фильма с идентификатором 530 (A Beautiful Mind)
*/{command} * 2012
бот будет искать фильм с названием "2012" |
#!/usr/bin/env ruby
require 'fileutils'
PUBLIC_DIR = 'public'
CSS_DIR = 'css'
HTML_DIR = 'html'
IMAGES_DIR = 'images'
JS_DIR = 'js'
JSON_DIR = 'json'
# Generate directory structure
Dir.mkdir( PUBLIC_DIR ) unless File.exists? PUBLIC_DIR
Dir.chdir( PUBLIC_DIR ) do
FileUtils.mkpath( CSS_DIR, HTML_DIR, IMAGE... |
module Endpoints
class Me < Base
namespace "/me" do
before do
authenticate!
end
get do
encode serialize(current_user, :current_user)
end
private
def serialize(data, structure = :default)
Serializers::User.new(structure).serialize(data)
end
e... |
class AddColumnsToLogtimes < ActiveRecord::Migration
def change
add_column :logtimes, :approved_by, :string
add_column :logtimes, :approved_at, :datetime
add_column :logtimes, :rejected_by, :string
add_column :logtimes, :rejected_at, :datetime
add_column :logtimes, :comments, :string
add_colum... |
require 'erb'
require 'nokogiri'
require 'dip'
require 'tipr'
require 'spec_helper'
require 'all_tipr_files_spec'
share_examples_for "all representations" do
before(:each) do
# need a daitss DIP
path = File.join '..', 'DIPs', 'FDA0666002'
@dip = DIP.new path
# need the rep.xml template
raw_xml... |
module ShortMessageHelper
class MessageListGroup
attr_reader :sender, :messages
def initialize(sender)
@sender = sender
@messages = []
end
def add_message(message)
@messages << message
end
end
def split_messages_group(messages)
... |
class User < ActiveRecord::Base
validates :email, presence: true, email: true
validates_presence_of :name
validates :number, length: { is: 10, wrong_length: "is not a valid phone number"}, :allow_blank => true
has_many :requests
def self.new_user_from_hash(hash)
@user = User.new fb_id: hash[:uid],
name:... |
require "rest-client"
class TelegramGateway
def post_message(text:)
RestClient.post send_message_url,
{
chat_id: ENV.fetch("TELEGRAM_CHAT_ID"),
text: text
}.to_json,
{content_type: :json, accept: :json}
end
private
def send_message_url
"https://api.telegram.org/bot#{... |
class CreatePerformances < ActiveRecord::Migration[5.2]
def change
create_table :performances do |t|
t.date :date
t.integer :purchase
t.integer :visit
t.integer :total
t.boolean :deleted, null: false, default: false
t.references :product, foreign_key: true
t.references :l... |
=begin
#===============================================================================
** Equip Events
Author: Hime
Date: Feb 26, 2013
--------------------------------------------------------------------------------
** Change log
Feb 26, 2014
- re-ordered event execution .dequip event is executed before equip ... |
class RemoveDataTypeAvatarAndContentTypeFromUser < ActiveRecord::Migration
def up
remove_column :users, :data
remove_column :users, :avatar
remove_column :users, :content_type
end
def down
add_column :users, :data, :binary
add_column :users, :avatar, :string
add_column :users, :content_ty... |
class CartUpdateOperation < Operation
attr_reader :pipe
def initialize
@pipe = Pipe.new
@cart = Main::Carts.new @pipe
end
def load
super() do
@cart.load_from_params attribute_group: :for_update
end
end
def accomplish
super do
@cart.update
end
end
end
|
FactoryGirl.define do
factory :subscript do
title "MyString"
description "MyText"
author "MyString"
file_path "MyString"
filename "MyString"
algorithm_id 1
end
end
|
module Schema
module Assertions
def attributes_equal?(other, attributes=nil, print: nil)
attributes ||= self.class.attribute_names
print = true if print.nil?
print ||= false
equal = self.eql?(other, attributes, ignore_class: true)
if !equal && print
attributes = Array(attr... |
class CreateIterations < ActiveRecord::Migration
def self.up
create_table :iterations do |t|
t.integer :deed_id
t.integer :user_id
t.datetime :done_at
t.integer :timespan
t.string :comment, :limit => 200
t.timestamps
end
add_index :iterations, :user_id
add_index :it... |
module Haystack
module Rack
class JSExceptionCatcher
def initialize(app, options = {})
Haystack.logger.debug 'Initializing Haystack::Rack::JSExceptionCatcher'
@app, @options = app, options
end
def call(env)
if env['PATH_INFO'] == Haystack.config[:frontend_error_catching_... |
# frozen_string_literal: true
require 'rails_helper'
feature 'user can approve tickets' do
scenario 'user has recipient ticket and view approves' do
person = create(:person)
user = create(:user, person: person)
person_other = create(:person, email: 'flavio@docflux.com',
... |
require 'aptible/resource/version'
require 'aptible/resource/base'
require 'aptible/resource/default_retry_coordinator'
require 'gem_config'
module Aptible
module Resource
include GemConfig::Base
with_configuration do
has :retry_coordinator_class,
classes: [Class],
default: Default... |
require "csv"
require "roo"
module RecordRoo
autoload :VERSION, 'record_roo/version'
autoload :DataSource, 'record_roo/data_source'
autoload :Csv, 'record_roo/formats/csv'
autoload :Xlsx, 'record_roo/formats/xlsx'
autoload :Xls, 'record_roo/formats/xls'
end
|
# plugins/local/frontend/models/search_result_data.rb
# redefines facets, which you can see at:
# https://github.com/archivesspace/archivesspace/blob/master/frontend/app/models/search_result_data.rb#L215-L257
require Rails.root.join('app/models/search_result_data')
class SearchResultData
# this changes what facets ... |
# frozen_string_literal: true
require 'test_helper'
module Vedeu
module DSL
describe Views do
let(:described) { Vedeu::DSL::Views }
let(:instance) { described.new(model, client) }
let(:model) {
Vedeu::Views::View.new(name: 'actinium')
}
let(:client) {}
descri... |
# -*- encoding : utf-8 -*-
require 'rs'
class Billing::CustomerRegistration
include Mongoid::Document
include Mongoid::Timestamps
belongs_to :user, class_name: 'Sys::User'
field :custkey, type: Integer
field :rs_tin, type: String
field :rs_name, type: String
field :dob, type: Date
field :confirmed, ty... |
class PostsController < ApplicationController
def index
@posts =post.all
end
def new
@post=post.new
end
def create
@post=post.create(post_params)
redirect_to posts_path
end
private
def post_params
params.require(:post).permit(:image. :caption)
end
end
|
require 'spec_helper'
describe RightSupport::Net::Balancing::StickyPolicy do
context :initialize do
end
before(:each) do
@endpoints = [1,2,3,4,5]
@policy = RightSupport::Net::Balancing::StickyPolicy.new(@endpoints, {})
@trials = 2500
end
context :next do
context 'given all servers are he... |
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'ois-notifier/version'
Gem::Specification.new do |spec|
spec.name = 'ois-notifier'
spec.version = OisNotifier::VERSION
spec.authors = ['Murdho']
spec.email = [... |
require_relative 'spec_helper'
require_relative '../src/vending_machine_errors/errors'
require_relative '../src/vending_machine'
require_relative '../src/vending_machine_logger'
describe VendingMachine do
let(:all_products) do
{
'coca-cola' => { price: 100, in_stock: 15, name: 'Coca Cola', key: 'coca-cola'... |
# (c) Copyright 2016-2017 Hewlett Packard Enterprise Development LP
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... |
class RegistrationCoursesController < ApplicationController
before_filter :login_required
before_filter :set_precision
filter_access_to :all
def index
@registration_courses = RegistrationCourse.find(:all,:order => "courses.course_name",:joins => :course).paginate(:page => params[:page],:per_page => 30)
... |
class Document < ActiveRecord::Base
belongs_to :page
has_attached_file :file
audited
attr_protected :id
validates_presence_of :name, :page
searchable do
text :name, :default_boost => 2
end
def authorized?(user)
page.authorized?(user)
end
def searchable?(user)
page.searchab... |
class MarketsController < ApplicationController
def index
if params[:search].present?
@markets = Market.near(params[:search]).page(params[:page]).per(5)
else
@markets = Market.all.page(params[:page]).per(5)
end
end
def new
@market = Market.new
end
def create
@market = Mark... |
# == Schema Information
#
# Table name: bulk_assets
#
# id :integer not null, primary key
# user_id :integer
# state :string(255) default(""), not null
# asset_type :string(255) default(""), not null
# path :string(255) default(""), not null
# host :string(255) ... |
# convert euros to US dollars
#Prompt for the amt of money in euros you have
#Prompt for the current exchange rate of the euro
#Print out the new amt in US dollars
#formula for currency conversion is:
# amt.to = (amt.from x rate.from)/(rate.to)
puts "How many euros are you changing?"
euros = gets.chomp.to_f... |
#encoding: utf-8
require 'nokogiri'
class Formatter
def initialize(xml)
@xml = xml
end
def format
xml_doc = Nokogiri::XML @xml
output = []
xml_doc.xpath("//saml1:Attribute", 'saml1' => 'urn:oasis:names:tc:SAML:1.0:assertion').each do |node|
attr_name = node.xpath("@AttributeName")
... |
require_relative 'panel'
require_relative '../config'
require_relative '../world/window'
class TitlePanel < Panel
include HasPad
include PadHelpers
def initialize(clients)
super()
self.size = screen_width, 4
@clients = clients
end
def tick(time)
if @parent.tabs != @prev_tabs
@prev_ta... |
module Antlr4::Runtime
class PredictionContextCache
def initialize
@cache = {}
end
def add(ctx)
return EmptyPredictionContext::EMPTY if ctx == EmptyPredictionContext::EMPTY
existing = @cache[ctx]
return existing unless existing.nil?
@cache[ctx] = ctx
ctx
end
... |
class Interaction < ApplicationRecord
# The person id is always the initial requestor
# Can get owner id via the item
enum status: [:requested, :approved, :returned, :available, :failed]
belongs_to :item
has_one :review, dependent: :destroy
validates :start_date,:presence => true
validates :end_date... |
# frozen-string-literal: true
require File.join(File.dirname(__FILE__), 'helper')
class TestFileRefProperties < Test::Unit::TestCase
context 'The crash.mp3 file audio properties' do
setup do
@fileref = TagLib::FileRef.new('test/data/crash.mp3', true, TagLib::AudioProperties::Average)
@properties = @... |
require File.join(File.expand_path(File.dirname(__FILE__)), '..', 'test_helper')
require 'cc_deville'
class TiktokTest < ActiveSupport::TestCase
test "should parse Tiktok profile" do
m = create_media url: 'https://www.tiktok.com/@scout2015'
d = m.as_json
assert_equal '@scout2015', d['username']
asser... |
#!/usr/bin/env ruby -w
require "socket"
require 'json'
class ChatServer
def initialize( port, ip )
@serverSocket = TCPServer.open( ip, port )
# users to connection lookup
@clients = Hash.new
printf("Chat Server started on port %d\n", port)
run
end # end initialize
def run
loop {
Th... |
# Default serialization configuration
class Api::V1::BaseSerializer < Xibit::Serializer
# camelize :lower
# Configuration
configure :root, :instance => true,
:collection => true
configure :meta, :param => :meta,
:key => :_meta
configure :lin... |
class Admin::AdminsController < Admin::AdminController
before_action :authorize_admin, only: [:new, :create, :destroy]
before_action :set_admin, only: [:show, :edit, :update]
load_and_authorize_resource
include Admin::AdminsHelper
def index
@admins = Admin.all
end
def new
@admin = Admin.new
end
def cre... |
class AddColumnPessoaFisicaIdToPessoas < ActiveRecord::Migration
def change
add_reference :pessoas, :pessoa_fisica, index: true, foreign_key: true
end
end
|
module Rdomino
class SimpleFormatter < Logger::Formatter
def call(severity, time, progname, msg)
"#{time.to_s :db} #{severity} #{msg2str msg} \n"
end
end
end
|
require 'erb'
require './lib/detect_os.rb'
require 'yaml'
# Install a component
# *.nothing => Do nothing
# *.sh => Do nothing. These files are for system usage.
# *.run => Run custom install script
# *.smylink => file get's symlinked to $HOME
# *.zshrc => get source into system .zshrc file
def install_components(opti... |
class AddIndexesToPlayers < ActiveRecord::Migration[4.2]
def change
add_index :players, :name
add_index :players, :rating
end
end
|
class AddChannelToLessons < ActiveRecord::Migration
def change
add_column :lessons, :channel, :string
end
end
|
class ConditionCategory < ActiveRecord::Base
belongs_to :condition
belongs_to :category
end
|
# 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
module Models
#
# Model object.
#
#
class CrashFreeDevicePercentages
# @return [Integer] Average p... |
require 'rails_helper'
feature "User management" do
scenario "sees a registration form" do
visit '/users/new'
expect(page.has_content?('Register for a new account')).to eq(true)
within("form") do
fill_in 'Email', :with => 'user@example.com'
fill_in 'Password hash', :with => 'password'
end... |
require_relative 'Node'
class BinarySearchTree
def initialize(classType)
@type = classType
end
def insert(value)
return {'errorMessage'=>'Invalid input value type', 'success'=>false} if value.class != @type
@root = Node.new if @root == nil
@root.insert(value)
end
def search(value)
@root... |
class ProjectsController < ApplicationController
before_action :signed_in_user, only: [:index, :create, :destroy]
def index
@projects = Project.all
end
def create
@project = current_user.projects.build(project_params)
if @project.save
flash[:success] = "Project Created"
redirect_to root_url
else
r... |
require "spec_helper"
describe Doctor do
it "is initialized with a name" do
test_insurance = Insurance.new({:name=>"Red Shield"})
test_insurance.save
test_specialty = Specialty.new({:name=>"Time travel"})
test_specialty.save
test_doctor = Doctor.new({:name=>"Who", :specialty_id=>test_specialty.id,... |
require "spec_helper"
describe FeedFieldHelper do
describe "parse micropost" do
describe "should find http links and wrap them in <a> tags" do
before { @micropost = parse_words_one_by_one("This micropost contains a http link. The link http://www.twittosocial.com should be transformed into a link") }
... |
module Antlr4::Runtime
class TokenTagToken < CommonToken
attr_reader :token_name
attr_reader :label
def initialize(token_name, type, label = nil)
super(type)
@token_name = token_name
@label = label
end
def text
return '<' + @label + ':' + @token_name + '>' unless @label.n... |
class CreateLibraries < ActiveRecord::Migration
def change
create_table :libraries do |t|
t.references :library_category, index: true, foreign_key: true
t.string :title
t.string :author_name
t.string :edition
t.string :year_publication
t.string :publishing_company
t.strin... |
class Track < ActiveRecord::Base
validates :name, :album_id, presence: true
belongs_to :album
end
|
require 'test_helper'
class PvcrequestsControllerTest < ActionDispatch::IntegrationTest
setup do
@pvcrequest = pvcrequests(:one)
end
test "should get index" do
get pvcrequests_url
assert_response :success
end
test "should get new" do
get new_pvcrequest_url
assert_response :success
end... |
class AddColumnsToCaughtPokemons < ActiveRecord::Migration[6.0]
def change
add_column :caught_pokemons, :name, :string
add_column :caught_pokemons, :level, :integer
end
end
|
class Responder
def self.respond(data, options)
case options['format']
when 'hipchat'
Responders::Hipchat.perform(data, options)
when 'motion_ai'
Responders::MotionAI.perform(data, options)
when 'web'
Responders::Web.perform(data, options)
else
raise("wrong format: #{option... |
# frozen_string_literal: true
# Simple wrappper around RestClient.Resource
$LOAD_PATH.unshift(__dir__) unless
$LOAD_PATH.include?(__dir__) ||
$LOAD_PATH.include?(File.expand_path(__dir__))
require 'excon'
require 'json'
require 'sfrest/audit'
require 'sfrest/backup'
require 'sfrest/centralized_role_managemen... |
require 'yaml'
require 'csv'
require 'pp'
#global vars
$debug = false
#we're using a csv that doesn't have pool members- that will be handled with a different script
csv_data = CSV.read("../private-fixtures/phl3-minus-built-vips.csv")
headers = csv_data.shift.map {|i| i.to_s }
# we expect 4 columns: fqdn, jetty port,... |
require_relative 'boot'
require "rails"
# Pick the frameworks you want:
require "active_model/railtie"
require "active_job/railtie"
require "active_record/railtie"
require "active_storage/engine"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_mailbox/engine"
require "action_text/en... |
class RenameLocationToCity < ActiveRecord::Migration[6.0]
def change
rename_column :appointments, :location, :city
end
end
|
require "test_helper"
class MainModelsControllerTest < ActionDispatch::IntegrationTest
setup do
@main_model = main_models(:one)
end
test "should get index" do
get main_models_url
assert_response :success
end
test "should get new" do
get new_main_model_url
assert_response :success
end
... |
desc "Load and launch"
task :load_and_launch => [:download_built, :launch] do
puts "Just downloaded a prebuilt usergrid and launched it."
puts "Maybe http://localhost:8880/?api_url=http://localhost:8080 will work!"
puts "Usergrid should be at http://localhost:8080/"
system('cat usergrid-stack/config/src/main/re... |
class UsersController < ApplicationController
# before_action :check_if_logged_in, :except => [:new, :create, :index, :show]
# before_action :check_if_admin, :only => [:index]
def index
@users = User.all
end
def create
@user = User.new user_params
# raise params.inspect
@user.username = @use... |
factories.rb
require 'factory_girl'
require 'faker'
FactoryGirl.define do
factory :user do
username { Faker::Internet.user_name }
email { Faker::Internet.email }
name { Faker::Name.name }
password { Faker::Internet.password }
end
factory :article do
name { Faker::Lorem.word }
neighborhoo... |
# frozen_string_literal: true
require 'test_helper'
module Vedeu
module EscapeSequences
describe Esc do
let(:described) { Vedeu::EscapeSequences::Esc }
describe '.escape' do
let(:stream) { "\e[0m\e[38;2;39m\e[48;2;49m\e[2J\e[?25l" }
subject { described.escape(stream) }
... |
FactoryBot.define do
factory :user do
name { 'botAdmin' }
sequence(:email) { |n| "admin#{n}@testmail.com" }
admin { true }
password { 'admintest123' }
password_confirmation { 'admintest123' }
end
end |
class HomeValuationsController < ApplicationController
# GET /index
def index
@valuations = ZillowReport::HomeValuation.all
render json: @valuations
end
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.