text stringlengths 10 2.61M |
|---|
FactoryGirl.define do
factory :program do
name "Example Program"
link "http://example.com"
end
end
|
# while loop
# loops while a true condition is met
#
# until loop
# loops until a true condition is met
# aka while loop running while condition is false
# syntax if this was while loop: while (true) === while (!false)
#
puts "until loop"
count = 1
until count > 5 do
puts count
count += 1
end
puts while ... |
# frozen_string_literal: true
# rubocop:disable Style/LambdaCall
RubyNext::Core.patch Proc, name: "ProcCompose", method: :<<, version: "2.6" do
<<~RUBY
def <<(other)
raise TypeError, "callable object is expected" unless other.respond_to?(:call)
this = self
proc { |*args, &block| this.(other.(*a... |
require 'open-uri'
require 'json'
class GamesController < ApplicationController
def new
alphabet = ('A'..'Z').to_a
@letters = Array.new(10) { alphabet.sample }
end
def score
@word = params[:word]
@grid = params[:grid]
@status = params[:status]
# @session_id = params[:session_id]
if ... |
class AudienceFloat < ActiveRecord::Migration
def change
change_column :ad2s, :audience, :float
end
end
|
class Restaurant < User
has_many :menus, foreign_key: 'restaurant_id'
end
|
module GlobalMenu
class Container
attr_reader :lookup, :caption, :path
def initialize(name, path = nil)
@lookup = underscored_name(name)
@caption = humanized_name(name)
@path = (path || 'javascript:void(0)')
@items = []
end
def add_item(item_name, item_path)
unless @i... |
class User < ActiveRecord::Base
has_many :jobs
before_save :encrypt_password
before_save :generateToken, if: :new_record?
before_save :default_values, if: :new_record?
email_regex = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
validates :login, presence: true, uniqueness: true
validates :firstname, presence: t... |
class ItemsController < ApplicationController
# 細かいですが、配列の記法が統一されていないのが気になりました。(%iで書くことが多いと思います)
before_action :authenticate_user!, only: [:new, :edit, :create, :update, :destroy]
before_action :set_item, only: %i(show edit update destroy)
before_action :require_my_item, only: [:edit, :update, :destroy]
befor... |
require "test/unit"
require './config/interval_parser'
class IntervalParserTest < Test::Unit::TestCase
def test_1_s
assert_equal(1, IntervalParser.new("1s").parse)
end
def test_n_s
n = 123
assert_equal(n, IntervalParser.new("#{n.to_s}s").parse)
end
def test_1_m
assert_equal(60, IntervalPar... |
class Event < ActiveRecord::Base
has_many :comments
belongs_to :user
belongs_to :category
end
|
words = [
{
singular: 'advocaat-generaal',
multiple: 'advocaten-generaal'
},
{
singular: 'advocaat',
multiple: 'advocaten'
},
{
singular: 'adv.',
multiple: 'advctn.'
},
{
singular: 'raadsman',
multiple: 'raadsmannen'
},
... |
require 'helper'
def app
Potatochop::Web
end
describe 'Potatochop' do
describe 'Web' do
app.set(:tater => Potatochop::Spud.new(Potatochop::FileSystemInterface.new('spec/fake_mockups')))
include Rack::Test::Methods
it 'returns an error when a haml page does not exist' do
get 'no_exist.html'
... |
class CreateUser < ActiveRecord::Migration
def self.up
create_table "users", :force => true do |t|
t.string "login"
t.string "nickname"
t.string "realname"
t.string "password"
t.integer "disabled", :default => 0, :null => false
t.datetime "created_at"
... |
# require 'test_helper'
#
# class ProfileResearchFieldsControllerTest < ActionController::TestCase
# setup do
# @profile_research_field = profile_research_fields(:one)
# end
#
# test "should get index" do
# get :index
# assert_response :success
# assert_not_nil assigns(:profile_research_... |
require "spec_helper"
describe ProjectsController do
render_views
let(:user) { create(:user) }
before { sign_in user }
subject { response }
describe "GET #index" do
before(:each) do
create_projects(user)
end
it "renders the index page" do
get :index
expect(subject).to render_t... |
#!/usr/bin/env ruby
require 'nokogiri'
# .idea/workspace.xml
# /project/component[@name="projectView"]/navigator/
# <autoscrollToSource ProjectPane="true" />
# <autoscrollFromSource ProjectPane="true" />
#perl -i -pe '
#s[<(autoscrollToSource|autoscrollFromSource) />][<$1 ProjectPane="true" />];
#' .idea/workspace.... |
module Pietr
##
# Contains all the methods that can be used in Piet
class Ops
class << self
def perform_action(interpreter, hue, shade)
method_table = [
[nil, :push, :pop],
[:add, :subtract, :multiply],
[:divide, :mod, :not],
[:greater, :pointer, :switch],... |
# 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 rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# Ch... |
require 'test_helper'
class ScheduleTest < ActiveSupport::TestCase
test "validate presence of required fields in schedule" do
schedule = Schedule.new
schedule.save
assert schedule.invalid?
assert !schedule.errors[:keyword].blank?, "Keyword must be present for all Schedules"
assert !schedu... |
# Filters added to this controller will be run for all controllers in the application.
# Likewise, all the methods added will be available for all controllers.
class ApplicationController < ActionController::Base
protect_from_forgery
#session :session_key => '_thoughtbag_session_id'
# Generates a string of c... |
class Take < ActiveRecord::Base
belongs_to :scene
belongs_to :storyboard_cell
belongs_to :sound_roll
belongs_to :camera_roll
has_many :screengrabs
belongs_to :shooting_day
end
|
require 'rspec'
require 'leetcode'
describe "word_break" do
it "construct a sentence where each word is a valid dictionary word" do
result1 = word_break("catsanddog", ["cat", "cats", "and", "sand", "dog"])
result2 = word_break("aaaaaaa", ["aaaa","aa","a"])
expect(result1).to eq(["cats and dog", "cat sand... |
require "spec_helper"
describe PasswordEncryptor do
let(:encryptor) {mock("encryptor")}
it "sets encryptor to BCrypt" do
expect(PasswordEncryptor.encryptor).to eql(BCrypt::Password)
end
context "encrypting password" do
before do
PasswordEncryptor.stub :encryptor => encryptor
end
it "... |
class JobAreasController < ApplicationController
access all: [], user: [], superadmin: :all
before_action :set_job_area, only: [:edit, :show, :update, :destroy]
def new
@job_area = JobArea.new
end
def create
@job_area = JobArea.new(job_area_params)
respond_to do |format|
if @job_area.save... |
require 'spec_helper'
describe JourneyWalkerWeb do
it 'has a version number' do
expect(JourneyWalkerWeb::VERSION).not_to be nil
end
end
|
Given /^I assign "([^"]*)" to "([^"]*)"$/ do |value, key|
eval "Settings.#{key} = #{value}"
end
Then /^Settings should respond to "([^"]*)"$/ do |key|
Settings.should respond_to(key)
end
Then /^"([^"]*)" should hold "([^"]*)"$/ do |key, value|
Settings.send(key).should eq(value)
end
Then /^Settings\.keys shoul... |
require "open4"
class Command < ActiveRecord::Base
attr_accessible :command, :description, :is_deployment, :name
has_many :command_template_vars
has_many :log_entries
validates_presence_of :name
validates_presence_of :command
validates_uniqueness_of :name
validate :validate_command_path
before_save :s... |
#!/usr/bin/ruby
# -*- coding: UTF-8 -*-
#!/usr/bin/ruby
# -*- coding: UTF-8 -*-
#ruby循环语句学习
#ruby while语句
$i = 1
$num = 5
while $i < $num
puts "在while循环语句中 i = #{$i} "
$i = $i + 1
end
puts ' --- 1 ---------------华丽丽的分割线------------'
#ruby until语句
$i1 = 1
$num1 = 5
until $i1 > $num1
puts "在until循环语句中 ... |
ActiveAdmin.register Award do
before_filter :skip_sidebar!, only: :index
config.batch_actions = false
config.sort_order = 'id_asc'
permit_params :award_name, :award_recipient, :award_count, :category_id, :is_active
before_action :set_travel_conference
belongs_to :travel_conference
navigation_menu :defaul... |
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
## Application load settings:
config.cache_classes = true # Code is not reloaded between requests.
config.eager_load = true # Eager load your application to memory on boot.
config.consider_all_r... |
# We realized that "Distribution" made the intent clearer
class RenameTicketsToDistributions < ActiveRecord::Migration[5.0]
def change
rename_table :tickets, :distributions
end
end
|
class CreateRanks < ActiveRecord::Migration
def change
create_table :ranks do |t|
t.belongs_to :user, :null => false
t.belongs_to :tournament, :null => false
t.decimal :mu, :null => false, :precision => 38, :scale => 5
t.decimal :sigma, :null => false, :precision => 38, :scale => 5
... |
class RenameIdentityRolesTableToProjectRoles < ActiveRecord::Migration
def change
rename_table :identity_roles, :project_roles
end
end
|
class Jobs < ActiveRecord::Migration
def change
create_table :jobs do |t|
t.string :company_name, null: false
t.string :function_name
t.boolean :intern
t.date :start_date, null: false
t.date :end_date
t.string :company_url
end
end
end
|
class WeekdaySet < ActiveRecord::Base
has_many :batches
has_many :time_table_weekdays
has_many :weekday_sets_weekdays,:dependent => :destroy
alias_method :weekdays,:weekday_sets_weekdays
named_scope :default ,:first
WEEKDAYS = {
"0" => "sunday",
"1" => "monday",
"2" => "tuesday",
"3" => "... |
class AddReadStatusToEmails < ActiveRecord::Migration[5.1]
def change
add_column :emails, :read, :boolean, default:false, null:false
end
end
|
class User < ActiveRecord::Base
has_one :api_key, dependent: :destroy
belongs_to :role
has_many :rides
after_create :create_api_key
before_create :password_to_md5_on_create
before_update :password_to_md5_on_update
validates :name, presence: true, length: {minimum: 3}
validates :role_id, pres... |
class RatingsController < ApplicationController
before_action :find_rateable
def create
@rateable = find_rateable
result = @rateable.rate_by current_user, params[:rate][:my_rating]
respond_to do |format|
format.json { render json: { success: result.valid? } }
end
end
private
def fin... |
require 'dotenv'
Dotenv.load
require 'vcr'
VCR.configure do |config|
config.cassette_library_dir = File.expand_path('../../fixtures/cassettes/', __FILE__)
config.hook_into :webmock
config.filter_sensitive_data('USERNAME') { ENV['USERNAME'] }
config.filter_sensitive_data('PASSWORD') { ENV['PASSWORD'] }
end
m... |
namespace :db do
desc "Fill database with sample data"
task populate: :environment do
admin = User.create!(name: "Jacob Yong Admin",
email: "cpyong27@gmail.com",
password: "pin5125",
password_confirmation: "pin5125")
admin.toggle!(:a... |
require 'rails_helper'
RSpec.describe Collection do
let(:collection_type) { Hyrax::CollectionType.new(title: 'something') }
let(:attributes) do
{
collection_type_gid: 'gid://nextgen/hyrax-collectiontype/1',
create_date: Hyrax::TimeService.time_in_utc,
modified_date: Hyrax::TimeService.time_in... |
require 'test_helper'
class AwsUsersControllerTest < ActionController::TestCase
setup do
@aws_user = aws_users(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:aws_users)
end
test "should get new" do
get :new
assert_response :success
... |
json.array!(@apps) do |app|
json.extract! app, :id, :title, :blog_link, :job_link, :description, :author, :status
json.url app_url(app, format: :json)
end
|
require 'typhoeus'
module Libretsy
class Request
attr_accessor :client, :response, :session
def initialize(client)
@client = client
@session = client.session
end
def self.request(client)
new(client).do_request
end
def do_request
@response = Typhoeus::Request.post(... |
#!/usr/bin/env ruby
require "dctl"
require "thor"
require "pty"
require "rainbow"
require "config"
require "open3"
require "dctl/cli/kubernetes"
module Dctl
class Cli < Thor
ERROR_COLOR = :red
SUCCESS_COLOR = :green
CMD_COLOR = :dimgray
desc "k8s", "Manage a kubernetes cluster"
subcommand "k8s"... |
require "spec_helper"
describe QBIntegration::Service::Item do
let(:config) { Factories.config }
subject do
described_class.new config
end
it "finds items by sku" do
VCR.use_cassette("item/find_by_sku", match_requests_on: [:method, :body]) do
item = subject.find_by_sku('T-SHIRT-PUGS-RULE')
... |
class Client < ActiveRecord::Base
validates_presence_of :name, :email,:company
validates_uniqueness_of :email
end
|
class LogicFormula
def initialize(str)
str.gsub!(/\s+/, '')
end
def is_wff?
end
def evaluate(interp = Interpretation.new)
end
def to_s
end
def main_connective
@main_connective.value
end
class FormulaNode
attr_accessor :value, :left, :right
def initialize(value, left = nil, ri... |
When(/^I want to view all the test cases on my project$/) do
on(NavigationPage).goto(:test_cases_page)
on(TestCasesPage).wait_for_page
end |
require 'rails_helper'
describe "user test" do
it "can_service_manage?" do
web_owner = create(:user, position: "web_owner")
web_admin = create(:user, position: "web_admin")
user = create(:user, position: "user")
expect(web_owner.can_service_manage?).to eq(true)
expect(web_admin.can_service_manag... |
module Ohm
class Set
LUA_POP = File.expand_path("../lua/pop.lua", __FILE__)
def pop(options = {})
if options[:by]
options.merge!(:by => to_key(options.delete(:by)))
end
if options.has_key?(:limit)
raise ArgumentError, 'limit options is not supported. always limit: [0, 1]'
... |
# encoding: utf-8
# copyright: 2018, Hugo Paredes
# frozen_string_literal: true
require 'awspec'
require 'aws-sdk'
state_file = 'terraform.tfstate.d/kitchen-terraform-default-aws/terraform.tfstate'
tf_state = JSON.parse(File.open(state_file).read)
instance_id = tf_state['modules'][0]['outputs']['ec2_instance.webser... |
define :sensu_silence_check, :action => :create, :payload => {} do
if params[:client].nil?
params[:client] = node.name
end
if params[:action] == :create or params[:action] == :silence
# add a timestamp and owner to the payload
# when we look at the stash later, these bits helps us know how old a sta... |
Rails.application.routes.draw do
mount EOTS::Engine => "/contact_emails"
end
|
class VideopostsController < ApplicationController
before_action :logged_in_user, only: [:create, :destroy]
before_action :correct_user, only: :destroy
def create
@videopost = current_user.videoposts.build(videopost_params)
if @videopost.save
flash[:success] = "Videopost created!"
redirect_... |
class AddUniqueId < ActiveRecord::Migration[5.1]
def change
remove_column :jobs, :expires_at, :timestamp
add_column :jobs, :access_key, :uuid
end
end
|
require 'json'
require 'uri'
module Bosh::Dev
class StemcellDependencyFetcher
def initialize(downloader, logger)
@downloader = downloader
@logger = logger
end
def download_os_image(opts)
bucket_name = opts[:bucket_name]
key = opts[:key]
output_path = opts[:output_path]
... |
class JobSitesController < ApplicationController
#before_action :set_job_site, only: [:show, :edit, :update, :destroy]
def index
basedOn = params[:basedOn]
searchText = params[:searchText]
if searchText != nil
search_condition = "%" + searchText + "%"
end
if basedOn == "Contact Name"
... |
class BusinessyearsController < BaseApiController
before_filter :find_organisation
before_filter :find_businessyear, only: [:show, :update]
before_filter only: :update do
unless @json.has_key?('businessyear')
render nothing: true, status: :bad_request
end
end
def index
render json: Busine... |
require 'test_helper'
class ImagesControllerTest < ActionDispatch::IntegrationTest # rubocop:disable Metrics/ClassLength
def test_new
get new_image_path
assert_response :ok
assert_select 'h1', 'New Image URL'
assert_select '.new_image'
assert_select '.simple_form'
assert_select '.images_for... |
class RemovePhotoFromDinners < ActiveRecord::Migration
def change
remove_column :dinners, :photo
end
end
|
# frozen_string_literal: true
module ProblemDetails
module Rails
# Configures global settings for ProblemDetails::Rails
# ProblemDetails::Rails.configure do |config|
# config.default_json_content_type = 'application/json'
# end
class << self
def configure
yield config
... |
class SubjectsController < ApplicationController
before_action :set_subject, only: [:show, :edit, :update, :destroy]
def index
@subjects = Subject.all
end
def show
end
def new
@subject = Subject.new
end
def edit
end
def create
@subject = Subject.new(subject_params)
respond_to do ... |
class ColorPrototype
def clone
raise 'You must implement this method in a descendant class.'
end
end
|
# frozen_string_literal: true
class UserMailer < ApplicationMailer
delegate :site_url, to: :'Rails.configuration'
def confirmation
@user = User.with_pk!(params.fetch(:user_id))
@auth_token = AuthToken.with_pk!(params.fetch(:auth_token_id))
params = {
confirmation_token: @user.email_confirmation_... |
module Qualtrics::API
class UserMapping
include Kartograph::DSL
kartograph do
mapping User
root_key singular: "result", plural: "elements", scopes: [:read]
property :username, scopes: [:read, :create, :update]
property :first_name, scopes: [:read, :create, :update], key: "fir... |
require_relative "../test_helper"
require "reqrep/test/request_lint"
class HTTP2RequestTest < Minitest::Test
include ReqRep::Test::RequestLint
def request
@request ||= begin
req = Jaguar::HTTP2::Request.new(stream)
# streams set the method and path in the headers
req.instance_variable_set(:@... |
def hello_t(array)
if block_given? # if there is a block, execute while loop
i = 0 # set variable counter
while i < array.length # execute loop as long as i is less than length of array
yield array[i] # yield each value stored in the array
i = i + 1 # increment i on each iteration
end
arr... |
# encoding: utf-8
#! /usr/bin/env ruby
##
# Auteur CrakeTeam
# Version 0.1 : Date : Mon Mar 17 09:42 2013
#
require 'gtk2'
require_relative 'Events'
require './Vue/Fenetres/FenetreJeu'
require './Vue/Elements/CaseCartesienne'
require './Vue/Dialogues/DialogueQuitterPartie'
require './Vue/Dialogues/DialogueEcraserSauv... |
# frozen_string_literal: true
RSpec.shared_context 'with json response' do
let(:response_body) { JSON.parse(response.body).deep_symbolize_keys }
let(:response_list) { JSON.parse(response.body).map(&:deep_symbolize_keys) }
end
|
#
# Cookbook Name:: vim
# Recipe:: default
#
# Copyright 2014, YOUR_COMPANY_NAME
#
# All rights reserved - Do Not Redistribute
#
package "vim" do
action :install
end
package "python" do
action :install
end
package "python-devel" do
action :install
end
package "python-setuptools" do
action :install
en... |
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe Api::V1::Partners::CustomersController, type: :request do
let(:partner) { create(:partner) }
let!(:customers) { create_list(:customer, 20, partner: partner) }
let(:token) { partner.user.token }
before { sign_in_user(partner.user) }
descri... |
json.array!(@stories) do |story|
json.extract! story, :id, :title, :agency_name, :office_location, :agency_fees, :house_name, :house_location, :rent, :deeds, :loss, :contract_start, :contract_end
json.url story_url(story, format: :json)
end
|
$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
module Simp
class Helpers
def self.get_param(param, command)
file = "#{File.dirname(__FILE__)}/.gem_#{param}"
if (File.exists?(file))
info = File.read(file)
else
info = `#{command}`
File.open(file, "w") do |f|
... |
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
before_action :set_locale
before_action :configure_permitted_parameters, if: :devise_controller?
def set_locale
... |
require 'byebug'
require 'colorize'
class Board
attr_accessor :grid, :size, :cursor
def initialize(size, full_board)
# American Checkers 8x8
# International Draughts (Checkers) 10 x 10
@size = size
@grid = setup_game(full_board)
@cursor = [0,0]
end
def [](pos)
row, col = pos
... |
class CreateProjects < ActiveRecord::Migration
def change
create_table :projects do |t|
t.string :name
t.integer :status
t.string :description
t.date :start_date
t.date :end_date
t.decimal :funding, precision: 10, scale: 2
t.integer :difficulty_level
t.t... |
class OrdersController < ApplicationController
def show
@order = Order.find_by id: params[:id]
respond_to do |format|
format.html
format.pdf do
disposition = (params[:download] == "true") ? :attachment : :inline
order_pdf_service = OrderPdfService.new @order
order_pdf_ser... |
class AddValuesToSearch < ActiveRecord::Migration[5.0]
def change
add_column :searches, :values, :integer
end
end
|
class EpicsController < ApplicationController
def index
@epic_lists = EpicList.all.order(:created_at)
end
end
|
class Teacher < ActiveRecord::Base
has_many :courses
has_many :students, :through => :courses
end
|
require 'spec_helper'
describe ImportPage::Importer do
subject{ described_class.new(section_id) }
let(:section_id) { 10 }
let(:store_dir) { Pathname.new(Settings.import_page.pool_path).join("#{section_id}") }
around do |example|
old = described_class.visitor_data_root
described_class.visitor_data_roo... |
# frozen_string_literal: true
require 'open3'
module CliHelper
class << self
# Execute a Terraform command with open3.
# Supported option is `:dir` which is optionally the path to the Terraform project dir
def execute(command, opts = {})
if opts[:dir]
begin
Open3.capture3(command... |
#encoding: utf-8
class Admins::BaseController < ApplicationController
layout "admin"
before_action :authenticate_admin!,:set_active
def set_active
controller = params["controller"].gsub("/","_")
self.instance_variable_set("@#{controller}", 'active')
end
end |
class AddOpenpayFieldsToOrders < ActiveRecord::Migration[5.1]
def change
add_column :orders, :openpay_id, :string
add_column :orders, :company, :string
add_column :orders, :order_status, :string, default: "PROCESSED"
add_column :orders, :redirect_url, :string
end
end
|
class EntriesController < ApplicationController
before_action :require_current_user
def new
@user = User.find(params[:user_id])
end
def create
@user = User.find(params[:user_id])
entry = @user.entries.new(entry_params)
if entry.save
flash[:success] = 'New entry was successfully created'
... |
require 'wikipedia'
require 'pry'
require 'pebbles/suddenly_death_string'
Wikipedia.Configure {
domain 'ja.wikipedia.org'
#domain 'en.wikipedia.org'
path 'w/api.php'
}
module Lita
module Handlers
class WikiPhoto < Handler
route /^photo\s+(\S.*)+/, :getwikiphoto
def getwikiphoto(response)
... |
class AddIuvareIdToUsers < ActiveRecord::Migration[5.1]
def change
add_column :users, :iuvare_id, :string
end
end
|
# encoding: utf-8
require File.expand_path("../spec_helper", __FILE__)
describe "Form" do
before :each do
browser.goto(WatirSpec.files + "/forms_with_input_elements.html")
end
describe "#exists?" do
it "returns true if the form exists" do
browser.form(:id, 'new_user').should exist
browser.fo... |
class CompaniesController < ApplicationController
before_action :authenticate_user!
before_action :set_company, only: [:show, :edit, :update, :destroy]
# GET /companies
# GET /companies.json
def index
@companies = Company.all
end
# GET /companies/1
# GET /companies/1.json
def show
respond_to... |
# Stores quotes and replies with a random stored quote.
class Robut::Plugin::Quips
include Robut::Plugin
desc "add quip <text> - adds a quip to the quip database"
match /^add quip (.+)/, :sent_to_me => true do |new_quip|
if add_quip(new_quip)
reply "I added the quip to the quip database"
else
... |
# hash of amino_acid --> codon
class Translation
AMINOS = {
:Methionine => ['AUG'],
:Phenylalanine => ['UUU', 'UUC'],
:Leucine =>['UUA', 'UUG'],
:Serine =>['UCU', 'UCC', 'UCA', 'UCG'],
:Tyrosine =>['UAU', 'UAC' ],
:Cysteine =>['UGU', 'UGC'],
:Tryptophan =>['UGG'],
:STOP =>['UAA', 'UA... |
# frozen_string_literal: true
class Rogare::Commands::Pronouns
extend Rogare::Command
command 'pronouns'
aliases 'gender'
usage '`!%` - You’re a sweetie'
handle_help
match_empty :execute
def execute(m)
m.reply 'My pronouns are she/her it/its, thanks for asking :)'
end
end
|
class RenamePostIdColumnsForCommentsAndVoters < ActiveRecord::Migration[5.2]
def change
rename_column :comments, :post_id, :text_id
rename_column :voters, :post_id, :text_id
end
end
|
require 'test_helper'
class CarTest < ActiveSupport::TestCase
test "should save the car" do
car = Car.new
car.title = "driver"
car.car_type = "mini"
car.color = "blue"
assert car.save, "Did not save a valid car"
end
test "should not save a car without a title" do
car = Car.new
# car.... |
Given(/^I click "(.*?)" button$/) do |arg1|
within("#offers-form") do
find(".button").click
end
#save_and_open_page
end
Then(/^I should see a message "(.*?)"$/) do |arg1|
page.should have_content(arg1)
end
Then(/^I should not see a message "(.*?)"$/) do |arg1|
page.should_not have_content(arg1)
end
Giv... |
require 'test_helper'
class PomodoroTest < ActiveSupport::TestCase
def setup
@pomodoro = Pomodoro.find(1)
@one = pomodoros(:one)
@two = pomodoros(:two)
end
def test_create
assert_kind_of Pomodoro, @pomodoro
assert_equal @one.id, @pomodoro.id
assert_equal... |
require File.join(File.dirname(__FILE__), '..', '..', 'spec', 'spec_helper')
require File.join(File.dirname(__FILE__), '..', '..', 'lib', 'right_popen', 'lib', 'right_popen')
require File.join(File.dirname(__FILE__), 'auditor_proxy_mock')
require File.join(File.dirname(__FILE__), 'instantiation_mock')
require 'instance... |
class ChangeNotesColumnOnProjects < ActiveRecord::Migration[5.2]
def change
remove_column :projects, :notes
add_column :projects, :notes, :text, default: ''
end
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.