text stringlengths 10 2.61M |
|---|
class CreateStudents < ActiveRecord::Migration
def change
create_table :students do |t|
t.string :nim
t.string :nama_depan
t.string :nama_belakang
t.string :tempat_lahir
t.date :tanggal_lahir
t.references :religion
t.references :gender
t.string :tahun_masuk
t.... |
require 'rails_helper'
RSpec.describe User, type: :model do
subject(:user) do
FactoryBot.build(:user,
email: "jay@gmail.com",
password: "password")
end
# validations
it { should validate_presence_of(:email) }
# validations
it { should validate_presence_of(:password_digest) }
it { should... |
class FontGlowSansScCondensed < Formula
version "0.93"
sha256 "9eb59505b8b6a863f8b61b9941fd2ac4b748e501d5c272987c3408052b0765aa"
url "https://github.com/welai/glow-sans/releases/download/v#{version}/GlowSansSC-Condensed-v#{version}.zip"
desc "Glow Sans SC Condensed"
homepage "https://github.com/welai/glow-san... |
class TF2_Server
attr_accessor :server
def initialize(ip)
@server = GoldSrcServer.new(ip.first, ip.last.to_i)
@server.init
end
def players
@server.players
end
end
|
class FontAfricanSerif < Formula
version "9.380"
url "https://www.languagegeek.com/font/AfricanSerif.zip"
desc "African Serif"
homepage "https://www.languagegeek.com/font/fontdownload.html"
def install
(share/"fonts").install "African Serif REGULAR 938.ttf"
(share/"fonts").install "African Serif BOLD ... |
# frozen_string_literal: true
require "test_helper"
require "generators/boring/graphql/install/install_generator"
class GraphqlInstallGeneratorTest < Rails::Generators::TestCase
tests Boring::Graphql::InstallGenerator
setup :build_app
teardown :teardown_app
include GeneratorHelper
include ActiveSupport::Te... |
class Workflow < ActiveRecord::Base
attr_accessible :name
has_one :notification
has_many :runs
has_many :steps
has_one :trigger
def create_run
run = self.runs.new
run.state = "pending"
run.trigger = Trigger.new(:args => self.trigger.args, :type => self.trigger.type)
self.steps.each do |... |
require 'csv'
module TeachersPet
module Actions
class Forks < Base
def repository
self.options[:repository]
end
def get_forks
self.client.forks(self.repository)
end
def run
self.init_client
forks = self.get_forks
CSV.open(self.options[:outp... |
require 'spec_helper'
describe Acknowledgement do
before { @acknowledgement = Acknowledgement.new }
subject { @acknowledgement }
it { should respond_to(:user_id) }
it { should respond_to(:message_id) }
it { should belong_to(:user) }
it { should belong_to(:message) }
end
|
class CreateDraftsections < ActiveRecord::Migration[5.0]
def change
create_table :draftsections do |t|
t.belongs_to :user
t.belongs_to :company
t.belongs_to :draftagreement
t.belongs_to :draft
t.string :name
t.integer :status
t.decimal :order, :precision => 2, :scale => 2... |
class Address < ActiveRecord::Base
include ActiveModel::Validations
extend Enumerize
acts_as_gmappable
# Associations
#----------------------------------------------------------------------------
belongs_to :addressable, :polymorphic => true
# Attributes
#----------------------------------------------... |
require 'spec_helper'
require_relative '../models/request_result.rb'
request_denied_hash = {"code"=>"500",
"message"=>"{\"code\":132,\"specificCode\":2,\"httpStatus\":500,\"name\":\"XCirc error\",\"description\":\"XCirc error : Request denied - already on hold for or checked out to you.\"}"
}
already_sent_hash = {"... |
class Bear
attr_accessor :roar, :type, :bear_name, :tummy
def initialize(roar, type, bear_name, tummy)
@roar = roar
@type = type
@bear_name = bear_name
@tummy = tummy
end
end |
module Constants
module AuthProvider
FB = 'facebook'.freeze
end
module OrderStatus
REQUESTED = 'requested'.freeze
PENDING = 'pending'.freeze
PROCESSING = 'processing'.freeze
SUCCESS = 'success'.freeze
CANCELED = 'canceled'.freeze
end
module OrderLevel
E10A = 'E1.0.A'.freeze
E... |
require 'rubygems'
require 'rspec'
require 'active_model'
require 'active_record'
require 'active_support'
ROOT = Pathname(File.expand_path(File.join(File.dirname(__FILE__), '..')))
$LOAD_PATH << File.join(ROOT, 'lib')
$LOAD_PATH << File.join(ROOT, 'lib', 'adjustable_image')
require File.join(ROOT, 'lib', 'adjustabl... |
# frozen_string_literal: true
module Rabbitek
##
# Rabbitek configuration
class Config
DEFAULTS = {
bunny_configuration: { hosts: 'localhost:5672', vhost: '/' },
log_format: 'json',
enable_newrelic: true,
enable_sentry: true,
logger: Logger.new(STDOUT),
reloader: proc { |&... |
=begin
#===============================================================================
Title: Gamble Item Shop
Author: Hime
Date: May 28, 2013
--------------------------------------------------------------------------------
** Change log
May 28, 2013
- Initial release
------------------------------------------... |
class InstasController < ApplicationController
def index
@instas = Insta.all
end
def show
@insta = Insta.find(params[:id])
end
def new
end
def edit
@insta = Insta.find(params[:id])
end
def create
render plain: params[:insta].inspect
@insta = Insta.new(insta_params)
@insta.save
redirect_to @in... |
class Application < ActiveRecord::Base
belongs_to :subject
has_many :children
has_many :criminal_arrests
has_many :employments
has_many :family_members
has_many :housing_histories
has_many :people
accepts_nested_attributes_for :children, :criminal_arrests, :employments, :family_members, :housing_histo... |
#
# Cookbook Name:: test-cookbook
# Recipe:: default
#
# Copyright 2016, KTZ
#
# All rights reserved - Do Not Redistribute
#
template '/tmp/greeting.txt' do
source 'greeting.txt.erb'
variables(
:greeting => node['test-cookbook']['greeting']
)
end |
require_relative "../helpers/remainder_game"
class OEIS
# https://www.reddit.com/r/math/comments/409dfe/does_anyone_know_anything_about_this_idea_i/
def self.a268058(n)
(1..n).map { |k| RemainderGame.length(n, k) }.max
end
end
|
# == Schema Information
#
# Table name: user_profiles
#
# id :integer not null, primary key
# name :string
# user_id :integer
# bio :text
# created_at :datetime not null
# updated_at :datetime not null
# avatar... |
class FontNotoSansTamil < Formula
head "https://noto-website-2.storage.googleapis.com/pkgs/NotoSansTamil-unhinted.zip", verified: "noto-website-2.storage.googleapis.com/"
desc "Noto Sans Tamil"
homepage "https://www.google.com/get/noto/#sans-taml"
def install
(share/"fonts").install "NotoSansTamil-Black.ttf... |
FactoryBot.define do
factory :book do
association :category
association :publisher
sequence :title do |n|
"Book#{n}"
end
subtitle "MyString"
author "MyString"
description "MyString"
image_url "https://prodimage.images-bn.com/pimages/9780151010264_p0_v3_s550x406.jpg"
ISBN "MyS... |
require_relative './test_helper'
describe ThreadLocalDelegator do
it "can be created with no arguments" do
ThreadLocalDelegator.new.class.must_equal ThreadLocalDelegator
end
it "can be created with a default object" do
ThreadLocalDelegator.new({}).class.must_equal ThreadLocalDelegator
end
it "can b... |
class ApplicationController < ActionController::Base
protect_from_forgery
def current_user
@current_user ||= CurrentUser.new(remote_user_id, remote_privgroups)
end
helper_method(:current_user)
private
def remote_user_id
if request.env['REMOTE_USER'].present?
request.env['REMOTE_USER']
e... |
class LikesController < ApplicationController
before_action :set_context
after_action :verify_authorized
def create
@like = Like.new
@like.entity = @context
@like.author = current_user
authorize @like
unless @like.entity.liked? current_user
@like.save
render :nothing => true, :status => 200, :conte... |
class Park < ActiveRecord::Base
validates :name, :location, :description, :park_type, presence: true
scope :search_by_name, -> (name_parameter) { where("name like ?", "%#{name_parameter}%")}
scope :search_by_location, -> (location_parameter) { where("location like ?", "%#{location_parameter}%")}
scope :searc... |
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe MemberApplication do
let(:single_application) { create(:single_application) }
let(:family_application) { create(:family_application) }
let(:apprentice_application) { create(:apprentice_application) }
context 'with a single application' do
... |
class DancesController < ApplicationController
skip_before_filter :authenticate_user!, :only => [:show, :get_data]
protect_from_forgery :except => :sync
# GET /dances
# GET /dances.json
def index
@dances = current_user.dances
respond_to do |format|
format.html # index.html.erb
format.json... |
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.ssh.insert_key = true
# main
config.vm.define "main" do |main|
# Set Image
main.vm.box = "ubuntu/xenial64"
main.disksize.size = "100GB"
main.vm.provider "virtualbox" do |vb|
vb.memory = 8192
#vb.gui = ... |
# frozen_string_literal: true
module Vedeu
module Geometries
# Define an area from dimensions or points.
#
# @api private
#
class Area
extend Forwardable
def_delegators :border,
:bottom?,
:enabled?,
:left?,
... |
class UserRecordsController < ApplicationController
before_action :set_user_record, only: [:show, :edit, :update, :destroy]
# GET /user_records
# GET /user_records.json
def index
@user_records = UserRecord.all
end
def update_auto_models
@auto_models = AutoModel.where(auto_brand_id: params[:auto_br... |
class DevicesController < ApplicationController
before_action :set_device, only: [:show, :edit, :update, :destroy]
rescue_from ActiveRecord::RecordNotFound, with: :invalid_device
def index
@devices = Device.order(updated_at: :desc).paginate(page: params[:page], per_page: 5)
@device = Device.new
end
... |
class AddApplicationSettingsToApiKeys < ActiveRecord::Migration
def change
add_column :api_keys, :application_settings, :text
end
end
|
class ScheduleMailer < ApplicationMailer
def send_mail(schedule)
@schedule = schedule
mail(
from: ENV["EMAIL"],
to: schedule.email,
subject: '予約確定通知'
)
end
end
|
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '2.7.0'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 6.0.3', '>= 6.0.3.3'
# Use postgresql as the database for Active Record
gem 'pg', '>= 0.18', '< 2.0'
# Use Puma as the app server
... |
json.array!(@mailing_schedules) do |mailing_schedule|
json.extract! mailing_schedule, :id, :name, :template_id, :city_hall_id, :date, :content
json.url mailing_schedule_url(mailing_schedule, format: :json)
end
|
require 'rails_helper'
RSpec.describe CategoriesController do
login_user
fixtures :categories
describe "GET #new" do
it "assigns @category" do
get :new
expect(assigns(:category)).to be_a_new(Category)
end
it "renders the :new view" do
get :new
expect(response).to rend... |
require_relative 'rest/accounts_controller'
require_relative 'rest/contacts_controller'
require_relative 'rest/messaging_controller'
require_relative 'rest/reports_controller'
require_relative 'rest/two_step_verification_controller'
class Routee
@@token = ''
@@appSecret = ''
@@appId = ''
def initialize(appId... |
class Moderator::ModeratorController < ApplicationController
before_action :check_if_moderator
private
def check_if_moderator
unless current_user.try(:moderator?)
redirect_to root_path
end
end
end
|
class AddMaxscoreToParticipations < ActiveRecord::Migration
def change
add_column :participations, :maxscore, :integer
end
end
|
#!/usr/bin/env ruby -wW0
#
#
#
# spinner.rb
# Caleb Crane <spinner.rb@simulacre.org> on 2010-09-04
require "singleton"
module Spinner
class Sweep
include Singleton
@@params = {:border => "=", :sweeper => " ", :sweeper_size => 3, :len => 30, :speed => 0.025, :format => "%s" }
@@bcount = @@fcount... |
require_relative 'room'
require 'csv'
class RoomRepository
def initialize(csv_file_path)
@csv_file_path = csv_file_path
@rooms = []
load_csv
end
def all
@rooms
end
def find(room_id)
# Find é parecido com select,
# a diferença é que retorna 1 elemento ao invés
# de um array com... |
require_relative '../../test_helper'
class Admin::PatientsControllerTest < ActionDispatch::IntegrationTest
setup do
@patient = patients(:default)
end
# Vanilla CMS has BasicAuth, so we need to send that with each request.
# Change this to fit your app's authentication strategy.
# Move this to test_help... |
class Message < ApplicationRecord
belongs_to :room
belongs_to :user, optional: true #加えた
end
|
# The number of length 2n + 1 strings over a {0, 1} alphabet such that the first half of any initial odd substring is a permutation of the second half.
#
# Equivalence classes up to swapping the letters of the alphabet.
#
# 1 -> 1 is a permutation of 1
# 101 -> 10 is a permutation of 01... |
require 'spec_helper'
fail2ban = OHAI['fail2ban']
describe 'fail2ban Plugin' do
it 'should be an Mash' do
expect(fail2ban).to be_a(Mash)
end
it 'should find lines in the fail2ban log' do
line='2014-04-30 10:46:24,006 fail2ban.actions: WARNING [ssh] Ban 1.1.1.1'
expect(fail2ban['activity'][0]).to eq... |
require "rubygems"
require "rspec"
require 'fakeweb'
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__)))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'googl'
def load_fixture(name)
File.join(File.expand_path(File.dirname(__FILE__)), '/fixtures', name)
end
def fake_urls
FakeWeb.a... |
class AddAdditionalInfoToLineItems < ActiveRecord::Migration
def change
add_column :line_items, :additional_info, :text
end
end
|
class AddPersonNametoTables < ActiveRecord::Migration
def change
add_column :events_people, :PersonName, :text
end
end
|
class AddExpAndLevelToCharacters < ActiveRecord::Migration
def change
add_column :characters, :level, :integer
add_column :characters, :experience, :integer, limit: 8
end
end
|
require 'test_helper'
class MessagesControllerTest < ActionController::TestCase
setup do
end
test "should get index with user's messages" do
# Create 3 messages (6 message records), with only 2 that should show in index
create_message(users(:user), users(:admin))
create_message(users(:admin), users(... |
class ItemsController < ApplicationController
before_action :authenticate_user!, only: [:new, :create, :edit, :update, :destroy]
before_action :admin_user, only: [:new, :create, :edit, :update, :destroy]
before_action :set_search
# TODO
# before_destroy :should_not_destroy_if_stock, prepend: true
def new
... |
require 'csv'
require 'roo'
class DataDefinition < ApplicationRecord
def self.nlm_info_for(column_name)
where('column_name=?',column_name).first.nlm_definition
end
def self.import(file_name='./public/DataDictionary.xlsx')
# TODO This is fragile - will fail if the xlsx thinks there are nil columns
self.de... |
require "#{File.dirname(__FILE__)}/EvenNumber"
describe EvenNumber do
before do
@evennumber = EvenNumber.new
end
describe "#filter" do
it "only allows even numbers" do
@evennumber.filter([1,2,3,4,5,6]).should == [2,4,6]
end
end
describe "#increment" do
it "gets the ... |
# Post Model
class Post < ActiveRecord::Base
belongs_to :user
validates :image, presence: true
has_attached_file :image,
styles: { thumb: ['500 x 500#', :jpg],
original: ['500x500>', :jpg] },
convert_options: { thumb: '-quality 75 -strip',
... |
module TestableExamples
class Runner
def initialize(opts)
@base = opts[:dir] || Dir.pwd
@name = opts[:task_name] || "test_examples"
@include_path = opts.key?(:include_path) ? opts[:include_path] : "lib"
@requires = opts.key?(:requires) ? opts[:requires] : opts[:requires]
end
def i... |
require File.expand_path('../lib/feed2email/version', __FILE__)
Gem::Specification.new do |gem|
gem.name = 'feed2email'
gem.version = Feed2Email::VERSION
gem.author = 'Aggelos Orfanakos'
gem.email = 'me@agorf.gr'
gem.homepage = 'https://github.com/agorf/feed2email'
gem.su... |
#Closest I got on my own.
# def keep_adding
# sum = 0
# arr = Array.new
# repeat = "Give me a number!"
# puts repeat
# input = gets.chomp
# if input == "done"
# else
# input = input.to_i
# arr.push(input)
# keep_adding
# end
# sum = arr.reduce(:+)
# puts sum
# end
# puts "Let's play a game, I will k... |
require 'javaclass/classfile/constant_pool'
module JavaClass
module ClassFile
# Container class for list of all classes, methods and fields referenced by this class.
# This information is derived from the constant pool, no analysis.
# Author:: Peter Kofler
class References
# Creat... |
include_recipe 'yumrepo::stackdriver'
package 'stackdriver-agent'
stackdriver_credentials = Chef::EncryptedDataBagItem.load('credentials', 'stackdriver')
template '/etc/sysconfig/stackdriver' do
variables stackdriver_apikey: stackdriver_credentials['api_key']
notifies :restart, 'service[stackdriver-agent]'
end
... |
class AddEndingPageNumberToSupplementals < ActiveRecord::Migration
def change
add_column :supplementals, :ending_page_number, :integer
end
end
|
class CreatePitstats < ActiveRecord::Migration
def change
create_table :pitstats do |t|
t.integer :ed #자책점
t.float :inn #이닝수
t.integer :fb #볼넷
t.integer :hit #피안타
t.integer :perr #폭투
t.integer :hr
t.integer :losepitcher #패전투수
t.integer :qualstartnowin #퀄스, 승리못함
... |
class AddAdmittedAtToModSignup < ActiveRecord::Migration[6.0]
def change
add_column :mod_signups, :admitted_at, :timestamp, null: false
end
end
|
require 'spec_helper'
describe "Account Transaction Retrieval" do
describe "self.get_acct_has_ordered_sku(params)",:vcr do
it "Indicates whether an account has ever ordered or paid for a specified inventorty item (SKU)" do
params = { "acct_no" => 1, "sku" => 'Test' }
response = api.get_acct_has_order... |
#!/usr/bin/env ruby
# encoding: utf-8
#
# This file, gist, is generated code.
# Please DO NOT EDIT or send patches for it.
#
# Please take a look at the source from
# http://github.com/defunkt/gist
# and submit patches against the individual files
# that build gist.
#
require 'strscan'
module JSON
module Pure
c... |
# -*- coding: utf-8 -*-
=begin
--------------------------------------------------------------------------------------------------------------------
<copyright company="Aspose" file="html_api_spec.rb">
</copyright>
Copyright (c) 2022 Aspose.HTML for Cloud
<summary>
Permission is hereby granted, free ... |
# -*- encoding : utf-8 -*-
require 'spec_helper'
describe RolesController do
describe :show do
it "should assign @role" do
@role = create_role("lim")
get :show, id: @role.id
assigns[:role].should == @role
end
end
describe :index do
it "should assign @roles with the existing roles"... |
require 'rails_helper'
RSpec.describe Rating, :type => :model do
it { should belong_to :book }
it { should belong_to :user }
it { should validate_numericality_of(:rating).with_message('only number from one to ten') }
end
|
INPUT_FORMAT = /(\d+) players; last marble is worth (\d+) points$/
SPECIAL_MARBLE = 23
player_count, marble_count = File.read("input").match(INPUT_FORMAT).captures.map(&:to_i)
marble_count += 1
class Circle
def initialize
@left = [0]
@right = []
end
def next
if @right.empty?
@right = @left
... |
describe "User Delegates" do
it "allows delegate to approve a proposal" do
proposal = create(:proposal, :with_approver)
delegate = create(:user)
approver = proposal.approvers.first
approver.add_delegate(delegate)
approver.save!
login_as(delegate)
visit proposal_path(proposal)
click_on... |
require "spec_helper"
describe Unit, :vcr do
let(:unit) { create(:unit) }
describe "validations" do
let(:blank_error) { ["can't be blank"] }
it "validates the presence of a unit name" do
invalid_unit = Unit.new(name: nil)
expect(invalid_unit).to_not be_valid
expect(invalid_unit.errors[:... |
class Api::V1::SpeakersController < ApiController
def index
@speakers = Speaker.all
json_response(@speakers, "success", {}, 200)
end
def show
@speaker = Speaker.find params[:id]
json_response(@speaker.as_json(show: true), "success", {}, 200)
end
end
|
class Event < ApplicationRecord
belongs_to :host, class_name: "User"
has_many :invites, foreign_key: :attended_event_id, dependent: :destroy
has_many :attendees, through: :invites
after_create :invite_host_automatically
scope :upcoming, -> { where("date >= ?", Date.today).order(date: :asc) }
scope :past, ... |
require 'spec_helper'
module Neo4j::Server
describe CypherResponse do
describe 'to_hash_enumeration' do
it "creates a enumerable of hash key values" do
#result.data.should == [[0]]
#result.columns.should == ['ID(n)']
response = CypherResponse.new(nil,nil)
response.set_d... |
# -*- coding: utf-8 -*-
#
# Author:: lnznt
# Copyright:: (C) 2011 lnznt.
# License:: Ruby's
#
require 'zlib'
require 'gmrw/extension/all'
module GMRW; module SSH2; module Algorithm
class Compressor
def_initialize :name
property_ro :compress, '{
"zlib" => zlib_compressor,
}[name] || proc {|s| s }'... |
class AddSourcesProtoToDmarcReports < ActiveRecord::Migration[6.1]
def change
add_column :dmarc_reports, :sources_proto, :binary
end
end
|
# This migration comes from solidus_product_recommendations (originally 20160701090723)
class RenameSourceInRecommendationSource < ActiveRecord::Migration
def change
rename_column :spree_product_recommendations, :source, :recommendation_source
end
end
|
class CreateBabyBookPages < ActiveRecord::Migration
def self.up
create_table :baby_book_pages do |t|
t.string :name,:limit=>100
t.string :logo,:limit=>50
t.integer :baby_book_id
t.integer :position
t.text :content
t.text :content_history
t.integer :layout_id
t.time... |
OPERATORS = [:+, :-, :*, :/, :%, :**]
puts "Please enter 1st integer"
first = gets.chomp.to_i
puts "Please enter 2nd integer"
second = gets.chomp.to_i
numbers = [first, second]
OPERATORS.each do |operation|
puts "#{first} #{operation.to_s} #{second} = #{numbers.inject(operation)}"
end
|
require 'snmp2mkr/vhost'
module Snmp2mkr
module SendRequests
class Metrics
def initialize(metric_values)
metric_values.each do |m|
if !m.kind_of?(Hash) || !m[:vhost].kind_of?(Vhost) || !m[:value] || !m[:name] || !m[:time]
raise TypeError, "invalid metric_values #{m.inspect}"
... |
class Search < ActiveRecord::Base
belongs_to :user, inverse_of: :searches
belongs_to :shop
belongs_to :item
has_many :taggings, as: :taggable
has_many :hotel_tags, through: :taggings, class_name: "Tag::HotelTag", source: :tag
has_many :room_searches, :dependent => :destroy
has_one :cart
scope :submitt... |
# frozen_string_literal: true
class SearchPage < SitePrism::Page
element :search_btn, 'body > div.page_wrap._wrap > header > div.content > div > div.flex > ul > li.glyph.search_buttons > a.search > span'
element :input_value_search, '#search_v4'
element :return_search, '.details'
def search_movie(value)
s... |
# frozen_string_literal: true
class OrderDetailQuantityInput < SimpleForm::Inputs::FileInput
def input(_wrapper_options)
input_html_options[:class] << "timeinput" if object.quantity_as_time?
@builder.text_field(attribute_name, input_html_options).html_safe
end
def hint(_wrapper_options = nil)
if ob... |
class AddTimeToEventos < ActiveRecord::Migration
def change
add_column :eventos, :time, :string
end
end
|
Gem::Specification.new do |s|
s.name = 'option_date'
s.version = '1.0.0'
s.date = '2018-04-20'
s.summary = "Handle dates that may not include month or day"
s.description = "Handles and formats dates with optional months and days"
s.authors = ["Ben Sinclair"]
s.email = 'ben@... |
class FontFantasqueSansMono < Formula
version "1.8.0"
sha256 "84be689e231ff773ed9d352e83dccd8151d9e445f1cb0b88cb0e9330fc4d9cfc"
url "https://github.com/belluzj/fantasque-sans/releases/download/v#{version}/FantasqueSansMono-Normal.zip"
desc "Fantasque Sans Mono"
homepage "https://github.com/belluzj/fantasque-s... |
require "spec_helper.rb"
describe "Viewing posts" do
context "there are no posts" do
it "displays no posts" do
expect(Post.all.count).to eq(0)
visit "/posts"
expect(page.all("div.tile").count).to eq(0)
end
end
context "there are posts" do
it "dis... |
require_relative '../card'
require_relative 'spec_helper'
describe Card, "#face_card?" do
context "testing card functionalities" do
it "checks if a given card is a face card or not" do
card = Card.new(:jack, :heart)
expect(card.face_card?).to eql true
end
end
end
describe Card, "#to_s" do
context "testin... |
class Record < ActiveRecord::Base
belongs_to :student
belongs_to :project
validates_presence_of :student_id, :project_id
validates :hours_worked, numericality: { only_integer: true , greater_than_or_equal_to: 0}
end
|
# frozen_string_literal: true
require 'minitest/autorun'
require_relative '../lib/convert_hash_syntax'
class ConvertHashSyntaxTest < Minitest::Test
def setup
@old_syntax = <<~OLD
{
:name => 'Alice',
:age => 20,
:gender => :female
}
OLD
@new_syntax = <<~NEW
{
... |
class Event < ActiveRecord::Base
# validates :user_id, presence: true
belongs_to :user
belongs_to :calendar
def self.search(search)
if search
where("LOWER(title) LIKE ? OR LOWER(description) LIKE ?", "%#{search.downcase}%", "%#{search.downcase}%")
else
find(:all)
end
end
geocoded... |
class RecordsController < ApplicationController
def new
@record = Record.new
@title = "Record"
end
def create
@record = Record.new(params[:record])
if @record.save
flash[:success] = "Successfully added!"
redirect_to @record
else
@title = "Record"
render 'new'
... |
class ConvertPrecisionOfBanEndsAtToGroupChatMemberships < ActiveRecord::Migration[6.1]
def change
change_column(:group_chat_memberships, :ban_ends_at, :datetime, precision: 6)
end
end
|
require_relative '../src/notes_application_class.rb'
RSpec.describe "NotesApplication" do
describe "Case for create method" do
it "create method should not create empty note" do
note = NotesApplication.new("user")
response = note.create('')
expect(response).to eq nil
end
it "create m... |
require_relative 'helpers/local_b_file'
class BFileParser # Methods that depend on parsing of individual b_files.
def self.parse(data)
begin
BFileParser.new(data)
rescue StandardError => e
return puts "Could not parse b-file: " + e.message
end
end
def initialize(data)
@raw_file = da... |
class DraftsController < ApplicationController
def index
@drafts = Draft.all
end
def show
@draft = Draft.find(params[:id])
end
end
|
class ThreadPost < ApplicationRecord
belongs_to :book_threads
belongs_to :user
end
|
Rails.application.routes.draw do
root 'departments#index'
resources :department do
resources :items
end
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.