text stringlengths 10 2.61M |
|---|
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
has_many :pets
#Validations
validates :name, pre... |
# == Schema Information
#
# Table name: diaper_drive_participants
#
# id :integer not null, primary key
# address :string
# business_name :string
# comment :string
# contact_name :string
# email :string
# latitude :float
# longitude :float
# pho... |
Vagrant.configure("2") do |config|
config.vm.define "microk8s" do |microk8s|
microk8s.vm.box = "ubuntu/focal64"
microk8s.vm.hostname = "microk8s"
microk8s.vm.network "public_network",
use_dhcp_assigned_default_route: true
microk8s.vm.provider "virtualbox" do |vb|
vb.name = "micro... |
# frozen_string_literal: true
lane :ios do
appicon(
appicon_image_file: 'spec/fixtures/Themoji.png',
appicon_devices: %i[ipad iphone ios_marketing watch watch_marketing],
appicon_path: 'app'
)
end
lane :ios_splash do
appicon(
appicon_image_file: 'spec/fixtures/ThemojiSplash.png',
appicon_dev... |
describe TriedRecipe do
it { should belong_to :recipe }
it { should belong_to :cook }
it { should validate_presence_of :date_tried }
end
|
# frozen_string_literal: true
require 'rails_helper'
RSpec.feature 'Signup', type: :feature do
before { visit new_user_registration_path }
scenario 'user with correct fields' do
fill_in 'user[name]', with: 'Foo Bar'
fill_in 'user[username]', with: 'foo_bar'
fill_in 'user[email]', with: 'foo@bar.com'
... |
Sequel.migration do
change do
create_table :movies do
primary_key :id
String :name
Float :rating
Date :release_date
Date :end_date
end
end
end
|
class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
has_many :lists, dependent: :destroy
def generate_au... |
require File.expand_path('app/views/page/list_menu', Rails.root)
require File.expand_path('app/views/log_in_or_out_menu_item', Rails.root)
module Views
# Nav menu specialisation for use when a registered user is logged in.
class MemberMenu < Widgets::Page::ListMenu
private
def add_items
widget LogI... |
require 'rubygems'
require 'fileutils'
require 'builder'
module Repub
module Epub
# OEBPS Container Format (OCF) 1.0 wrapper
# (see http://www.idpf.org/ocf/ocf1.0/download/ocf10.htm)
#
class OCF
def initialize
@items = []
end
attr_reader :items
def <<(item)
if item... |
# frozen_string_literal: true
require 'rails_helper'
describe MonographSearchBuilder do
let(:search_builder) { described_class.new(context) }
let(:config) { CatalogController.blacklight_config }
let(:context) { double('context', blacklight_config: config) }
let(:solr_params) { { fq: [] } }
describe "#filte... |
class FontArbutusSlab < Formula
head "https://github.com/google/fonts/raw/main/ofl/arbutusslab/ArbutusSlab-Regular.ttf", verified: "github.com/google/fonts/"
desc "Arbutus Slab"
homepage "https://fonts.google.com/specimen/Arbutus+Slab"
def install
(share/"fonts").install "ArbutusSlab-Regular.ttf"
end
te... |
# Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = %q{japaneggae}
s.version = "0.0.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :require... |
# Defines Blueberry version
module Blueberry
VERSION = '0.1.0'
end
|
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe View, type: :model do
context 'when testing associations' do
it { should belong_to(:video) }
end
end
|
# frozen_string_literal: true
class Question < ActiveRecord::Base
validates :questions, :presence => true
validates :answer, :presence => true
validates :option2, :presence => true
validates :option3, :presence => true
validates :option4, :presence => true
validates :explanation, :presence => true
valida... |
class ApplicationController < ActionController::API
private
def issue_token (payload)
JWT.encode(payload, secret, algorithm)
end
def authorize_editor!
if !current_script.present? || !current_editor.present?
render json: {
error: 'Authentication invalid. Please try again.'
}
en... |
class Mailer < ApplicationMailer
append_view_path("#{Rails.root}/app/views/mailers")
def welcome_email(user)
@user = user
mail(:to => @user.email_address, :subject => "Welcome to Barn & Willow")
end
def order_created(order)
@order = order
@ids = JSON.parse(@order.order_details)
@fabrics = Fabr... |
module UserHelper
def path_for_profile_picture(user)
if user.profile_picture.present?
user.profile_picture.url(:thumbnail)
else
'site/user_profile1.png'
end
end
end
|
# frozen_string_literal: true
require 'octokit'
class PullRequest
def self.from_github(repo:, id:)
pr = Octokit.pull_request(repo.name, id)
PullRequest.new(pr: pr)
end
def initialize(pr:)
@pr = pr
end
def from_fork?
base_repo != head_repo
end
def review_approved?
Octokit.pull_requ... |
class SongGenre <ActiveRecord::Base
belongs_to :song
belongs_to :genre
def slug
self.name.gsub(" ", "-").downcase
end
def self.find_by_slug(slug)
Artist.all.find{|artist| artist.slug == slug}
end
end
|
#
# Cookbook Name:: windows_ntpd
# Recipe:: default
#
# Copyright 2012, City Index Ltd
#
# 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
#
# U... |
# frozen_string_literal: true
# Customer request model non db active model
class CustomerRequest
include ActiveModel::Model
attr_accessor :name, :business_name, :email, :telephone_number, :api_errors
def submit
response = Api::Lead.new.submit(instance_values).symbolize_keys
@api_errors = response[:erro... |
class CitiesController < ApplicationController
def index
@cities = City.displayed
end
end
|
class Importer::Appeals < Importer::Importer
SLICE_SIZE = 1000
def self.import_all
new(
Parser::Appeals.new("data/appeals.jsonl.gz")
).import
end
def import
records.each_slice(SLICE_SIZE).each do |slice|
Appeal.transaction do
import_slice(slice)
end
end
end
priva... |
class Vote
attr_reader :voter, :candidate
def initialize(voter, candidate)
@voter = voter
@candidate = candidate
end
end
|
class Cursor
def initialize(array, start=0)
@array = array
@start = start
end
def ~
if @start >= 0
@array[@start]
end
end
def remove!
@array.delete_at(@start)
end
def next
Cursor.new(@array, @start + 1)
end
def previous
Cursor.new(@array, @start - 1)
end
end
|
require_relative "../views/session_view"
class SessionsController
def initialize(employee_repository)
@employee_repository = employee_repository
@session_view = SessionView.new
end
def sign_in
@session_view.welcome
username = @session_view.ask("username")
password = @session_view.ask("passw... |
class ChangeStoryToUseLocation < ActiveRecord::Migration
def change
# remove the location columns
remove_column :stories, :latitude
remove_column :stories, :longitude
# add a reference to location, w/ foreign key
add_column :stories, :location_id, :integer
add_foreign_key :stories, :locat... |
require 'rails_helper'
RSpec.feature "Projects", type: :feature do
context "Create new project" do
before(:each) do
login_as FactoryBot.create(:user)
visit new_project_path
within("form") do
fill_in "Title", with: "Test title"
end
end
scenario "should be successful" do... |
class AddColumnsToTimetableEntry < ActiveRecord::Migration
def self.up
add_column :timetable_entries, :entry_type, :string
add_column :timetable_entries, :entry_id, :integer
end
def self.down
remove_column :timetable_entries, :entry_id
remove_column :timetable_entries, :entry_type
end
end
|
class Sims::SimsBigaVehiclePeopleController < ApplicationController
before_action :set_sims_biga_vehicle_person, only: [:show, :edit, :update, :destroy]
# GET /sims_biga_vehicle_people
# GET /sims_biga_vehicle_people.json
def index
#@sims_biga_vehicle_people = SimsBigaVehiclePerson.order(vcp_pes_id: :asc).... |
# Your code goes here!
class Anagram
attr_accessor :word
def initialize(word)
@word = word
end
def match(anagrams)
array = []
item_array = []
word_array= []
anagrams.each do |item|
if item.length == word.length
item_array = item.split(//)
word_array = word.split(//)... |
require_relative './models/legislator.rb'
module Tasks
def self.print_by_state arg_state
legislators_from_state = Legislator.get_legislators_by_state(arg_state)
puts "Senators:"
legislators_from_state[:senators].each do |senator|
puts "\t#{senator.name} (#{senator.party})"
end
puts "Representatives:"
... |
class Order < ApplicationRecord
belongs_to :customer, inverse_of: :order
has_many :product_order, inverse_of: :order
has_many :product, through: :product_order, inverse_of: :order, class_name: 'Product'
accepts_nested_attributes_for :customer
accepts_nested_attributes_for :product_order, allow_destroy: true
... |
=begin
#===============================================================================
Title: State Rate Popups
Author: Hime
Date: Jun 15, 2013
--------------------------------------------------------------------------------
** Change log
Jun 15, 2013
- Initial release
-----------------------------------------... |
Dado("que eu faça uma busca na tela de unidades") do
#acesso a tela de unidade
home.load #carregar elementos mapeados pelo pageobject da tela home
home.menuUnidade.click
sleep 2
expect(page).to have_text "Unidades"
#realizando a busca na tela de unidade
unidade.filtro_facilidade.click
unidade.bicic... |
require 'rails_helper'
RSpec.describe Admin::UsersController, type: :controller do
subject { User.new email: 'ex@ex.com', password: '123456', password_confirmation: '123456' }
describe '#update' do
it 'should update a product' do
subject.first_name = 'ababa'
expect(subject.first_name).to eq('abab... |
Idea.destroy_all
Image.destroy_all
Category.destroy_all
User.destroy_all
IMAGES = ["https://wallpaperbrowse.com/media/images/soap-bubble-1958650_960_720.jpg", "https://wallpaperbrowse.com/media/images/cat-1285634_960_720.png", "http://illinoisdouble.com/wp-content/uploads/pictures-images-amazing-wonderful-macro-photog... |
class AddressesController < ApplicationController
before_action :set_address, only: [:show, :edit, :update, :destroy]
# GET /addresses
# GET /addresses.json
def index
@addresses = Address.all.map { |a| [a.latitude, a.longitude, a.magnitude] }.flatten
render json: [["Connectivity",[@addresses]],["Popula... |
ENV['RAILS_ENV'] ||= 'test'
require 'rails/all'
require 'rspec/rails'
require 'factory_girl_rails'
require File.expand_path('../../config/environment', __FILE__)
abort('The Rails environment is running in production mode!') if Rails.env.production?
Dir[Rails.root.join('spec/support/**/*.rb')].each { |file| require(fil... |
# frozen_string_literal: true
class Authorization < ApplicationRecord
belongs_to :user
validates :provider, presence: true
validates :uid, presence: true, uniqueness: { scope: :provider }
def self.handle_authorization(existing_user, auth)
provider = auth['provider']
uid = auth['uid']
author... |
module Quantified
class Mass < Attribute
system :metric do
primitive :gram
one :milligram, :is => Mass.new(0.001, :grams)
one :kilogram, :is => Mass.new(1000, :grams)
end
system :imperial do
primitive :ounce
one :ounce, :is => Mass.new(28.349523125, :grams)
... |
# encoding: utf-8
require "spec_helper"
describe MicropostHelper do
let(:user) { FactoryGirl.create(:user) }
before do
User.create!(name: "Example user",
email: "example@example.com",
username: "someuser",
password: "foobar",
password_confir... |
require 'test_helper'
class TrailsControllerTest < ActionController::TestCase
setup do
@trail = trails(:one)
@user = users(:one)
@admin = users(:admin)
end
test "should get index" do
sign_in(@admin)
get :index
assert_response :success
assert_not_nil assigns(:trails)
end
test "sh... |
class RenameTypeInRosterTransactions < ActiveRecord::Migration
def change
change_table :roster_transactions do |t|
t.rename :type, :roster_transaction_type
end
end
end
|
class AuditObserver < ActiveRecord::Observer
observe Order, User, Product
def after_create(model)
model.logger.info("[Audit] #{model.class.name} #{model.id} created")
end
end
|
class HorizontalPropertiesController < ApplicationController
before_action :set_horizontal_property, only: [:show, :edit, :update, :destroy]
before_action :set_act
before_action :authenticate_user!, except: [:index, :show]
# GET /horizontal_properties
# GET /horizontal_properties.json
def index
@horizo... |
require 'rails_helper'
RSpec.describe ChallengesController, type: :controller do
describe "GET #index" do
context "with valid token" do
before(:each) do
@user_authenticated = FactoryGirl.create(:user_authenticated)
@request.headers["Authorization"] = "Token token=#{@user_authenticated.ac... |
require File.dirname(__FILE__) + '/../../test_helper'
class Workbench::BlastResultsControllerTest < ActionController::TestCase
# Replace this with your real tests.
test "the truth" do
assert true
end
context_with_user_logged do
should "succeed on get index with JSON" do
get :index, :format=> 'jso... |
require 'minitest/autorun'
require "minitest/rg"
require_relative("../guests")
class GuestTest < MiniTest::Test
def setup
@guest1 = Guest.new("Matthew",4, 100, "Swamped")
@guest2 = Guest.new("Cameron",27, 250, "Oklahoma")
@guest3 = Guest.new("Dagin", 6, 500, "I want to break free")
end
def test_gues... |
require 'spec_helper'
require 'ostruct'
describe 'Commands / Update' do
include_context 'users and tasks'
subject(:users) { rom.commands.users }
before do
module Test
UserValidator = Class.new do
ValidationError = Class.new(ROM::CommandError)
def self.call(params)
raise Va... |
class Post < ActiveRecord::Base
has_many :comments, dependent: :destroy
has_many :pictures, as: :imageable
belongs_to :user
acts_as_votable
end
|
# Implement a queue using two stacks
class StackQueue
def initialize
# two hypothetical stack only using push and pop
@en_stack = []
@de_stack = []
end
def enqueue(value)
@en_stack.push(value)
end
def dequeue
flip if @de_stack.empty?
raise 'Empty Queue' if @de_stack.empty?
@de_st... |
# -*- coding: utf-8 -*-
require 'rspec'
require 'rbconfig'
require 'ostruct'
class Object
def truthy?
# FIXME: Should we not check for truthfulness instead, and presume
# that anything else passed to be false? Below we are doing the
# opposite.
#self && !['false', 'no', 'n', '0', 0].include?(self)... |
# This controller runs the API routes for front-end code
class ApiController < ApplicationController
def symjson
render json: ticker_json(Company.all)
end
private
def ticker_json(companies)
list = companies.map(&:symbol)
list.to_json
end
end
|
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
protect_from_forgery with: :null_session, if: Proc.new { |c| c.request.format == 'application/json' }
before_filter :cors_set_access_control_headers
def cors_set_access_control_headers
headers['Access-C... |
require 'spec_helper'
describe 'openvpn::ca', type: :define do
let(:pre_condition) { "file { '/etc/openvpn/#{title}': ensure => directory }" }
let(:title) { 'test_server' }
let(:facts) do
{
ipaddress_eth0: '1.2.3.4',
network_eth0: '1.2.3.0',
netmask_eth0: '255.255.255.0',
concat_base... |
FactoryBot.define do
factory :record_form do
dog_id {1}
user_id {1}
experience {1}
care_take {'留守番平均時間は平日のみ6時間です。土日祝日は基本ずっと自宅に居ます'}
hope {'自分自身の生活環境の条件に適していると感じたため'}
end
end
|
class CreateFilas < ActiveRecord::Migration
def change
create_table :filas do |t|
t.string :responsavel, :limit => 2000
t.string :aluno, :limit => 1000
t.integer :status # 1 - aguardando processamento // 2 - aguardando confirmação da matrícula // 3 - matriculado
t.timestamps
... |
Rails.application.configure do
config.time_zone = 'Central Time (US & Canada)'.freeze
end
|
class PostsController < ApplicationController
# GET, list of posts
def index
@posts = Post.all
end
# GET, start of creating a new Post (obtain attributes)
def new
@post = Post.new
end
# POST, finalize the creation of new Post (persist attributes)
def create
# collects nested attributes, for... |
class ManagementDashboard::AlertsController < ManagementDashboard::BaseController
def index
@alert = Alert.new
@alerts = @organization.alerts
end
def create
@alert = @organization.alerts.new(params.require(:alert).permit!)
if @alert.save
redirect_to management_dashboard_alerts_path, :noti... |
class ReportTopEmployer
include Mongoid::Document
include Mongoid::Timestamps
store_in database: 'sribulancer_development', collection: 'report_top_employers'
field :date, type: Date
belongs_to :employer_member
field :job_posted
field :job_approved
field :jo_created
field :jo_paid
field :total_jo... |
require 'rails_helper'
feature 'Images' do
let!(:user) { FactoryGirl.create(:user) }
context 'none have been uploaded' do
scenario 'should let the user know there are no images' do
visit '/images'
expect(page).to have_content 'No images yet'
end
end
context 'creating images' do
scen... |
# frozen_string_literal: true
require 'spec_helper'
require 'unit/vm_manager/create/shared_stuff.rb'
describe Bosh::AzureCloud::VMManager do
include_context 'shared stuff for vm manager'
describe '#create' do
context 'when VM is created' do
before do
allow(azure_client).to receive(:create_virtu... |
require 'net/http'
require 'nokogiri'
require 'uri'
class Browser
def run!
puts "Please input the url of the website you want to browse: "
url = gets.chomp
page = Page.new(url)
page.fetch!
puts "Enter 'title' to view the webpage title"
puts "Enter 'link' to view the webpage link"
ans... |
Shindo.tests('Rackspace::Servers | image requests', ['rackspace']) do
@image_format = {
'created' => String,
'id' => Integer,
'name' => String,
'progress' => Integer,
'serverId' => Integer,
'status' => String,
'updated' => String
}
tests('success') do
@serve... |
class Image < ActiveRecord::Base
belongs_to :user, inverse_of: :images
belongs_to :stream, inverse_of: :images
has_many :comments, inverse_of: :image, dependent: :destroy
has_many :stops, inverse_of: :image, dependent: :destroy
end
|
RSpec.describe Participation, type: :model do
it { is_expected.to belong_to(:user) }
it { is_expected.to belong_to(:event) }
it { is_expected.to have_attached_file(:car_photo) }
it { is_expected.to validate_attachment_content_type(:car_photo).
allowing('image/png').
allowing('image/gif').
... |
class SpyOpsController < ApplicationController
# GET /spy_ops
# GET /spy_ops.json
def index
@spy_ops = SpyOp.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @spy_ops }
end
end
# GET /spy_ops/1
# GET /spy_ops/1.json
def show
@spy_op = SpyOp.f... |
class UserMailer < ApplicationMailer
def daily_digest(user)
@user = user
@questions = Question.created_yesterday
mail(to: @user.email, subject: "Ежедневный список вопросов созданных за сегодня")
end
def subscription_question(user, question)
@user = user
@question = question
mail(to: @use... |
# == Schema Information
#
# Table name: players
#
# id :integer not null, primary key
# name :string(255)
# rating :integer default(0), not null
# created_at :datetime
# updated_at :datetime
#
# Indexes
#
# index_players_on_name (name)
# index_players_on_rating (rating)
#
... |
class FacilityIctServicesController < ApplicationController
before_filter :authenticate_user!
before_filter :is_admin
def index
if params[:id].blank? || params[:id].nil?
@facility_ict_service = FacilityIctService.page(params[:page]).per(10).order('created_at DESC')
end
end
def create
@faci... |
class Result < ApplicationRecord
belongs_to :user, inverse_of: :results
belongs_to :test, inverse_of: :results
belongs_to :current_question, class_name: 'Question', optional: true
before_validation :set_first_question, on: :create
SUCCESS_TRESHOLD = 85
scope :success_passed, -> { where('passage_percent >... |
class Scenario < ActiveRecord::Base
belongs_to :user
belongs_to :master_scenario
belongs_to :client_version, :foreign_key => "desktop_id"
has_many :variables, :class_name => "ScenarioVariable", :dependent => :destroy
has_many :alerts, :class_name => "ScenarioAlert"
has_many :gro... |
# Copyright 2014 Square Inc.
#
# 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 applicable law or agreed ... |
class AddReferenceHodToDepartments < ActiveRecord::Migration[5.2]
def change
add_reference :departments, :hod
end
end
|
class User
attr_reader :current_cards, :score
attr_accessor :money, :bet
def initialize
@money = 100
@current_cards = []
@score = 0
end
def bet!
@money -= bet
end
def count_score
@score = current_cards.sum(&:value)
@score += 10 if score < 12 && aces?
end
private
def aces... |
require 'logger'
module S3backup
class S3log
@@log_file = nil
@@debug = false
def S3log.get_logger
unless @@log_file
@@log_file = Logger.new($stderr)
@@log_file.level = Logger::INFO
end
return @@log_file
end
def S3log.set_level(level)
unless @@debug
... |
if params[:inline]
json.(promotion, :id, :title)
json.html render partial: "promotion_item", object: promotion, formats: [ :html ]
else
json.(promotion, *promotion.attributes.keys)
end
|
require 'test_helper'
class KlassesControllerTest < ActionDispatch::IntegrationTest
setup do
@klass = klasses(:one)
end
test "should get index" do
get klasses_url, as: :json
assert_response :success
end
test "should create klass" do
assert_difference('Klasse.count') do
post klasses_ur... |
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel... |
require "spec_helper"
require "yaml"
describe BoshDeploymentResource::BoshManifest do
before :each do
@work_dir = File.dirname(__FILE__)
@tmp_dir=`mktemp -d`.strip
`cp -rf #{@work_dir}/fixtures/* #{@tmp_dir}/`
end
after :each do
`rm -rf #{@tmp_dir}`
end
let(:manifest) { BoshDeploymentResou... |
class TrumpTweet < ActiveRecord::Base
extend TrumpTweetsImporter
scope :popular, -> { where('"trump_tweets"."retweets" > 20000') }
scope :unparsed, -> { where(parsed: false) }
scope :oldest, -> { order(:id) }
end
|
class MomentumCms::Api::Admin::SitesController < MomentumCms::Api::Admin::BaseController
before_action :load_site, only: [:show, :update, :destroy]
def index
@sites = MomentumCms::Site.all
render json: @sites
end
def create
@site = MomentumCms::Site.new(site_params)
@site.save!
render jso... |
require_relative './rocket/rocket_factory'
require_relative './mission/mission'
require_relative './config'
require_relative './mission/chaos_monkey'
module MissionControl
class ControlPanel
attr_reader :all_missions
def initialize
@chaos_monkey = Mission::ChaosMonkey.new(
Random.new,
... |
require 'shellwords'
# Alias robut commands:
#
# @robut alias "something" "some long message"
#
# Later if @robut receives the message "@robut something" he will
# repond as if he received "@robut some long message"
#
#
# Valid use:
#
# @robut alias this "something long"
# @robut alias "this thing" "something long... |
module Sunspot
class Search
class Highlight
#
# The Regexp used to locate the highlighted words in a Highlight
#
HIGHLIGHT_MATCHER = /@@@hl@@@(.*)@@@endhl@@@/
#
# Highlighted keywords associated with this hit. Nil if this hit is not
# from a keyword search.
#... |
require 'rspec'
require './lib/grid'
describe Grid do
describe 'initialize' do
it 'is an instance of grid' do
grid = Grid.new(3, ["p--", "-m-", "---"])
expect(grid).to be_a Grid
expect(grid.size).to eq(3)
expect(grid.grid).to eq(["p--", "-m-", "---"])
expect(grid.locate_princess).... |
require 'rails_helper'
RSpec.describe Product, type: :model do
describe "validations" do
subject(:product) { build(:product) }
it { is_expected.to validate_presence_of(:name) }
it { is_expected.to validate_presence_of(:sku) }
it { is_expected.to validate_numericality_of(:price).is_greater_than_or_eq... |
# frozen_string_literal: true
# == Schema Information
#
# Table name: users
#
# id :bigint not null, primary key
# uuid :string(64) not null
# email :string(128) not null
# first_name :string(64)
# last_name :string(64)
# ... |
class EventsController < ApplicationController
def index
@events = Event.order("'created_at' DESC").page(params[:page])
render :layout => false
end
def create
@event = Event.new
respond_to do |format|
if @event.save
format.js
else
format.json { render :json => @event... |
PostitTemplate::Application.routes.draw do
root to: 'posts#index'
get '/register', to: 'users#new'
get '/login', to: 'sessions#new'
post '/login', to: 'sessions#create'
get '/logout', to: 'sessions#destory'
resources :posts, except: :destory do
member do
post 'vote' # /posts/:id/vote => ... |
class RemoveConstraintSiteConfig < ActiveRecord::Migration
def change
change_column :site_configs, :site_id, :integer,:null => true
end
end
|
require 'time'
class Workout < ActiveRecord::Base
has_one :route
validates_numericality_of :user_id, :min_hr, :avg_hr, :max_hr, :cals_burned
def getworkouttotalminutes
totalminutes = ( self.duration.hour * 3600 + self.duration.min * 60 + self.duration.sec ) / 60
end
def to_workoutdata_json
json ... |
module Test
module Unit
module Assertions
# For backward compatibility
unless instance_methods.include?("assert_raise")
def assert_raise(*args, &block)
assert_raises(*args, &block)
end
end
end
end
end
module RSS
module Assertions
def assert_parse(rss, ... |
# Encoding: utf-8
require 'java_buildpack/component/versioned_dependency_component'
require 'java_buildpack/framework'
require 'java_buildpack/logging/logger_factory'
module JavaBuildpack
module Framework
# Installs LSP server component.
class LanguageServerBase < JavaBuildpack::Component::VersionedDepende... |
# == Schema Information
# Schema version: 57
#
# Table name: know_feeds
#
# id :integer(11) not null, primary key
# user_id :integer(11)
# name :string(255)
# created_at :datetime
# updated_at :datetime
#
class KnowFeed < ActiveRecord::Base
acts_as_taggable
be... |
require 'helper'
class TestLetUnit < Test::Unit::TestCase
let(:one) { 1 }
let(:time) { Time.now }
should "allow let statements" do
assert_equal one, 1
end
should "memoize the let" do
current = time
assert_equal current, time
assert_not_equal current, one
end
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.