text stringlengths 10 2.61M |
|---|
require 'rails_helper'
RSpec.describe "welcome/index.html.haml", type: :view do
it 'should contain links back to the home page' do
render
expect(rendered).to match /Welcome/
end
end
|
require 'goby'
RSpec.describe Item do
let(:item) { Item.new }
context "constructor" do
it "has the correct default parameters" do
expect(item.name).to eq "Item"
expect(item.price).to eq 0
expect(item.consumable).to eq true
expect(item.disposable).to eq true
end
it "correctly a... |
require 'deliveryboy/client'
require 'deliveryboy/loggable'
require 'deliveryboy/plugins'
require 'fileutils'
class Deliveryboy::Plugins::Exec
include Deliveryboy::Plugins # Deliveryboy::Maildir needs this to load plugins properly
include Deliveryboy::Loggable # to use "logger"
def initialize(config)
@sorte... |
# Restart required even in development mode when you modify this file.
class String
# fails on stressed sylables open > openning
# put in exceptions if needed
def ing
return "offering" if self == "offer"
return "savoring" if self == "savor"
original = self
if original.match(/ie$/)
... |
require 'spec_helper'
require 'facter/util/infiniband'
describe 'infiniband_hca_port_guids fact' do
before :each do
Facter.clear
allow(Facter.fact(:has_infiniband)).to receive(:value).and_return(true)
end
it 'returns HCAs' do
allow(Facter.fact(:infiniband_hcas)).to receive(:value).and_return(['mlx5_... |
require "test_helper"
class NewUserCanRegisterTest < ActionDispatch::IntegrationTest
test "new user can register and be logged in" do
visit root_path
click_on "Login"
click_on "Create Account"
fill_in "Username", with: "Dan"
fill_in "Password", with: "password"
fill_in "Password confirmation"... |
FactoryBot.define do
factory :card do
id {Faker::Number.between}
workflow { FactoryBot.create(:workflow)}
name { Faker::FunnyName.name }
position { Faker::Number.between }
end
end
|
# frozen_string_literal: true
ThinkingSphinx::Index.define 'cms/page', with: :real_time do
indexes :title
has :tenant_id, type: :bigint
indexes :published
scope { CMS::Page.where(searchable: true) }
end
module CMSPageIndex
extend ActiveSupport::Concern
included do
after_save :sphinx_index
end
p... |
class UserTagsController < ApplicationController
before_action :get_user
def index
@tags = @user.tags
end
def new
@tag = Tag.new
end
def create
end
private
def get_user
return @user = User.find(params[:user_id]) unless params[:user_id].nil?
@user = @list.user
end
end
|
Date::DATE_FORMATS[:default] = '%B %d, %Y'
class ActiveSupport::TimeWithZone
def as_json(_options = {})
strftime('%B %d, %Y')
end
end
|
Rails.application.routes.draw do
resources :city_trips
resources :cities, only: [:index, :show]
resources :countries, only: [:index, :show]
resources :trips, only: [:show, :new, :create, :edit, :update, :destroy]
resources :users, only: [:show, :new, :create, :edit, :update, :destroy]
resources :sessions, o... |
class DbTasks
class PostgresDbConfig < ActiveRecordDbConfig
end
class PostgresDbDriver < ActiveRecordDbDriver
def create_schema(schema_name)
if select_rows("SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = '#{schema_name}'").empty?
execute("CREATE SCHEMA #{quote_table_name(schema_n... |
# frozen_string_literal: true
class Api::V1::Auth::RegistrationsController < DeviseTokenAuth::RegistrationsController
def create
@resource = resource_class.new(sign_up_params.except(:confirm_success_url))
@resource.provider = 'email'
# honor devise configuration for case_insensitive_keys
... |
json.polls @polls do |poll|
json.id poll.id
json.title poll.title
json.user_id poll.user_id
json.current_user current_user
json.voters poll.voter_ids
json.options poll.options do |option|
json.id option.id
json.name option.name
json.vote_count option.vote_count
end
end
|
require "test_helper"
describe Review do
describe "relations" do
it "has a product" do
r = reviews(:one)
r.must_respond_to :product
r.product.must_be_kind_of Product
end
end
describe "validations" do
it "must be valid with all required fields" do
review = Review.last
re... |
class Admin::ProducerController < Admin::AuthenticatedController
def new
@producer = Producer.new
@page_title = 'Insertar nueva Productora'
end
def create
@producer = Producer.new(producer_params)
if @producer.save
flash[:notice] = "La Productora #{@producer.name} fue insertada con éxito."
... |
FIXTURES_PATH = File.expand_path(File.join(File.dirname(__FILE__), 'fixtures'))
module LoadHelper
def load_yaml_file(file)
schedule = Scheduler.load_from( File.join(FIXTURES_PATH, file), :yaml )
schedule.week_of 2010,11,21
schedule.duration 90
schedule
end
end
describe 'load... |
class AddSteamUpdatedAtToPlayer < ActiveRecord::Migration
def change
add_column :players, :steam_updated_at, :datetime
end
end
|
module Upmin
class Attribute
def visible_in_results?
%i(handler content description created_at updated_at real comment).none? { |key| key == name }
end
def visible_in_model?
%i(handler id real kind).none? { |key| key == name }
end
def label_name
return model.class.model_class.h... |
require 'test/helpers'
describe 'apt_control set' do
include CLIHelper
before do
setup_dirs
with_default_reprepro_config
control production: { worker: '= 0.5.5' }
end
it 'sets the version and writes the inifile' do
run_apt_control 'set production worker ">= 0.6"'
run_apt_control 'status ... |
require 'test_helper'
class ProduceOrderItemsControllerTest < ActionController::TestCase
setup do
@produce_order_item = produce_order_items(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:produce_order_items)
end
test "should get new" do
... |
class NilClass
def blank?
return true
end
end |
class User < ApplicationRecord
has_secure_password
has_many :created_events, class_name: "Event", foreign_key: "creator_id"
has_and_belongs_to_many :participated_events, class_name: "Event"
end
|
#===============================================================================
# ** Alchemy_Settings
#-------------------------------------------------------------------------------
# impostazioni dello script dell'alchimia
#===============================================================================
module Alchem... |
class Download < ActiveRecord::Base
belongs_to :hellaserver
validates_presence_of :hellaserver
validates_associated :hellaserver
end
|
# File documentation:
# Find the relative path to the current directory of this file
dir = File.dirname(__FILE__)
# Find the absolute path to the current directory of this file
full_path = File.expand_path(dir)
# Assuming the file we want to open is in the same directory as this file
# this will generate the path ... |
class TextsController < ApplicationController
before_action :set_text, only: [:show, :edit, :update, :destroy]
# GET /texts/excluded
# GET /texts/excluded.json
def excluded
@texts = Text.where(include: false)
render :index
end
# GET /texts/included
# GET /texts/included.json
def included
@te... |
class Cell
attr_accessor :living, :num_living_neighbors
def initialize(row, col, living)
@row = row
@col = col
@living = living
@num_living_neighbors = 0
end
def dead
return !living
end
def tick
return true if living && (num_living_neighbors==2 || num_living_neighbors==3)
return true if dead && n... |
class Shoe < ActiveRecord::Migration[5.2]
def change
create_table :shoes do |t|
t.integer :size
t.string :color
t.boolean :light_up
t.string :brand
t.integer :price
t.boolean :availibilty
t.integer :user_id
end
end
end
|
module BookKeeping
VERSION = 3
end
class Squares
attr_reader :integer
def initialize(i)
@integer = i
end
def square_of_sum
integer_range.inject(:+)**2
end
def sum_of_squares
integer_range.map {|i| i**2 }.inject(:+)
end
def difference
square_of_sum - sum_of_squares
end
private... |
class Event < ActiveRecord::Base
extend SimpleCalendar
has_calendar attribute: :starts_at
belongs_to :program
end
|
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
# その他---------------------------------------
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
# --------... |
class Expense
attr_reader :amt, :descr, :paid_by, :date, :share, :category
@@all = []
def self.all
return @@all
end
def self.print_all(arr = @@all)
puts
arr.each {|exp| exp.print}
puts
return nil
end
def self.lookup_by(property, value)
@@all.select{|expense| expense.instance_var... |
Types::MutationType = GraphQL::ObjectType.define do
name "Mutation"
description "Available Mutations"
fields Util::FieldComposer.compose(
[
Mutations::UserMutationType,
Mutations::PostMutationType,
Mutations::CommentMutationType
])
end |
# encoding: UTF-8
set :application, "berkub"
set :repo_url, "git@github.com:berkub/berkub.git"
# ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }
set :deploy_to, "/var/www/berkub"
set :scm, :git
set :rbenv_ruby_version, "2.0.0-p353"
set :format, :pretty
set :log_level, :debug
set :pty, true
set :rail... |
class Legislators < ActiveRecord::Migration
def up
create_table :legislators do |t|
t.string :firstname
t.string :lastname
t.string :party
t.string :phone
t.string :state
t.string :twitter_id
t.boolean :in_office
t.integer :votesmart_id
t.timestamps
end
... |
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable,
:omniauthable, omniauth_providers: [:twitter]
... |
# frozen_string_literal: true
# rubocop:todo all
require 'lite_spec_helper'
describe Mongo::Error::NoServerAvailable do
describe 'message' do
let(:selector) do
Mongo::ServerSelector::Primary.new
end
let(:cluster) do
Mongo::Cluster.new(['127.0.0.1:27017'],
Mongo::Monitoring.new, moni... |
# frozen_string_literal: true
require 'fileutils'
require 'spec_helper'
RSpec.describe 'RailsAdmin::Version' do
describe '#warn_with_js_version' do
it 'does nothing when the versions match' do
allow(RailsAdmin::Version).to receive(:actual_js_version).and_return('3.0.0')
allow(RailsAdmin::Version).to... |
#==============================================================================
# ** Game_BattlerBase
#------------------------------------------------------------------------------
# This base class handles battlers. It mainly contains methods for calculating
# parameters. It is used as a super class of the Game_Batt... |
# frozen_string_literal: true
class AddEstimatedDobToStudents < ActiveRecord::Migration[5.0]
def change
add_column :students, :estimated_dob, :boolean, null: false, default: true
end
end
|
class CreateTimeTrackers < ActiveRecord::Migration
def change
create_table :time_trackers do |t|
t.integer :user_id
t.integer :time_tracker_category_id
t.datetime :from
t.datetime :to
t.text :note
t.integer :cost_time
end
end
end
|
class AddCollumnTotalTasksToWorkersProfit < ActiveRecord::Migration
def change
add_column :workers_profits, :total_tasks, :integer
end
end
|
Hippo::Application.routes.draw do
resources :users
get "users/:id/orders" => "users#orders", as: :user_orders
post "users/:id/ship/:op_id" => "users#ship", as: :ship_order
get "users/:id/pending" => "users#pending", as: :pending
get "users/:id/completed" => "users#completed", as: :completed
resources :pro... |
class Customer
attr_reader :name
@@customers = []
def initialize(options={})
@name = options[:name]
add_to_customers
end
def self.all
@@customers
end
def purchase(product)
Transaction.new(self, product)
end
def self.list
... |
# frozen_string_literal: true
name 'tgw_uwsgi'
maintainer 'Sean M. Sullivan'
maintainer_email 'sean@barriquesoft.com'
license 'Apache-2.0'
description 'Installs/Configures uWSGI application server.'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version ... |
require "capybara"
require "capybara/poltergeist"
module Fitbit2withings
class WithingsClient
Capybara.javascript_driver = :poltergeist
Capybara.ignore_hidden_elements = true
Capybara.run_server = false
Capybara.default_max_wait_time = 60
def login
session.visit "https://healthmate.withing... |
require 'lib/reports/shared_report_definitions'
class Qa::Question < ::ActiveRecord::Base
extend ::SharedReportDefinitions
def self.number_of_visible_questions_in_last(days, cobrand)
self.visible.count(:joins => :user, :conditions => conditions_for_report('created_at',days,cobrand))
end
def self.n... |
class Admin::OrderDetailController < ApplicationController
def update
@order_detail = OrderDetail.find(params[:id])
@order_detail.update(order_details_params)
@order = @order_detail.order
@order_details = @order.order_details
if @order_details.any? {|order_detail| order_detail.production? }
... |
# --- Day 12: JSAbacusFramework.io ---
#
# Santa's Accounting-Elves have a JSON document which contains a variety of
# things: arrays ([1,2,3]), objects ({"a":1, "b":2}), numbers, and strings.
# Your first job is to simply find all of the numbers throughout the document &
# add them together.
def find_numbers(input)
... |
module ToyResources::Methods
def self.included base
base.extend ClassMethods
end
def model
self.class.model
end
def vars_list
instance_variable_get model.member_var_name
end
def parents
[]
end
module ClassMethods
def resources *args
options = args.e... |
class AddHackathonToTeams < ActiveRecord::Migration
def change
add_column :teams, :hackathon_id, :integer
end
end
|
require 'json'
lines = [
"#+title: Report: Overview of the Thel Sector",
"#+author: New Vistas Survey Team",
"#+date:",
"#+roam_tags:",
"* Report: Overview of the Thel Sector",
"",
" The following report, generated 3200.10.05, contains a high-level overview of the Thel Sector. We've summarized our asse... |
Rails.application.routes.draw do # rubocop: disable Metrics/BlockLength
if GalleryConfig.oauth_provider_enabled
use_doorkeeper
end
devise_for :users, controllers: { sessions: 'sessions',
registrations: 'registrations',
confirmations: 'con... |
require './square.rb'
class Rectangle < Square
attr_accessor :s2, :x3, :x4
def initialize(name, x, y)
super
@s2 = 15
@x3 = x+@s2
@x4 = x+@s2
end
end
|
require 'rails_helper'
describe "PUT /api/tags/:id" do
before(:each) do
@tag = FactoryBot.create(:random_tag)
end
it 'updates a tag' do
@new_title = "тестовый тэг"
@new_slug = "testowyj täg"
put "/api/tags/#{@tag.id}", params: { tag: {title: @new_title} }
expect(response.status).to eq(202)
... |
require 'journeylog'
describe JourneyLog do
# mock objects
let(:journey) { double(:journey, fare: 1) }
let(:journey_class) { double(:journey_class, new: journey) }
let(:entry) { :entry }
let(:finish) { :finish }
# logs in two states
let(:in_journey) do
described_class.new(1, 9, start: entry, journ... |
class GiftcardsController < ApplicationController
helper_method :allowed_giftcard_code_chars
helper_method :allowed_giftcard_code_length
before_filter :required_user_login
before_filter :required_restaurant_owner_role
before_filter :is_restaurant_supporting_giftcards
# GET
def manage
@redemptions = Has... |
require 'anima'
class Attribs < Module
attr_reader :defaults, :names
def initialize(*attrs)
@defaults = attrs.last.instance_of?(Hash) ? attrs.pop : {}
@names = (attrs + @defaults.keys).uniq
end
def add(*attrs)
defaults = attrs.last.instance_of?(Hash) ? attrs.pop : {}
self.class.new(*[*(name... |
require_relative '../test_helper'
class GraphqlController3Test < ActionController::TestCase
def setup
@controller = Api::V1::GraphqlController.new
@url = 'https://www.youtube.com/user/MeedanTube'
require 'sidekiq/testing'
Sidekiq::Testing.inline!
super
User.unstub(:current)
Team.unstub(:c... |
require 'spec_helper'
describe "php::extension::runkit" do
let(:facts) { default_test_facts }
let(:title) { "runkit for 5.4.17" }
let(:params) do
{
:php => "5.4.17",
:version => "1.0.3"
}
end
it do
should contain_class("php::config")
should contain_php__version("5.4.17")
... |
require 'spec_helper'
describe ServiceLinkSerializer do
let(:service) { Service.new }
let(:service_link_model) { ServiceLink.new }
before do
service_link_model.linked_to_service = service
end
it 'exposes the attributes to be jsonified' do
serialized = described_class.new(service_link_model).as_json... |
class TransferNotification < ApplicationRecord
enum notice_type: [:send_, :request_, :declined_request]
# Relationships
# It was changed from "belongs_to :transaction" to address the error: #
# ... |
class AbstractPage < ActiveRecord::Base
belongs_to :author, :class_name => 'User'
# default_scope { order(name: :asc) }
belongs_to :parent_control, :class_name => 'AbstractPage'
has_many :access_controls, as: :accessible
accepts_nested_attributes_for :access_controls, :allow_destroy => true
validates :name,... |
# frozen_string_literal: true
class UserUpdater
attr_reader :params, :avatar, :user
def initialize(params, user)
@avatar = params.delete("avatar")
@params = params
@user = user
end
def call
update_user
end
private
def update_user
user.update(params)
update_avatar if avatar.pre... |
class CreateLists < ActiveRecord::Migration[5.1]
def change
create_table :lists, id: false do |t|
t.primary_key :list_id
t.integer :table_id
t.references :creator, index: true, foreign_key: { to_table: :users }
t.string :name
t.datetime :created_at, null: false
end
end
end
|
class AddTimingToCleanings < ActiveRecord::Migration
def change
add_column :cleanings, :timing, :datetime
end
end
|
module DeepStore
class Repository
extend Forwardable
attr_accessor :adapter
attr_reader :bucket, :codec, :resource_class, :dao
def_delegators :dao, :head, :get, :put, :delete
def initialize(data = {})
@data = data
@adapter = data.fetch(:adapter, DeepStore.adapter)
... |
def oxford_comma(array)
if array.size == 1
return array.first
elsif array.size == 2
return "#{array.first} and #{array.last}"
else
last_word = array.pop
sentence = ""
array.each do |str|
sentence << "#{str}, "
end
sentence << "and #{last_word}"
end
end
|
require "io/console"
slides = DATA.read.split("\n\n").map { |lines| lines.split("\n") }
slide_index = 0
def print_slide(io, slide)
height, width = io.winsize
twitter_handle = "@the_bestie"
padding = " " * 5
io.write("\e[H\e[2J")
io.puts "\r"
io.puts "\r"
slide.each do |line|
io.puts padding + line... |
require 'rails_helper'
RSpec.describe UsersController, type: :controller do
context "GET new" do
it "assigns a blank user to the view" do
get :new
expect(assigns(:user)).to be_a_new(User)
end
end
context "POST create" do
let!(:params){ { user: attributes_for(:user) } }
def post_s... |
class Pawn < Piece
WHITE_PAWN_MOVES = [[1, 0],[2, 0],[1, -1],[1, 1]]
BLACK_PAWN_MOVES = [[-1,0],[-2, 0],[-1,-1],[-1,1]]
def regular_valid_move?(current_pos, new_pos)
if @board.in_bounds?(new_pos) && @board[new_pos].empty?
true
else
false
end
end
def moves
pawn_moves = []
if ... |
class Codewars
def initialize
end
def make_negative(n)
if n == 0
return 0
elsif n > 0
return n * -1
else n < 0
return n
end
end
def accum(s)
chars = s.upcase.split("")
chars.map.with_index { |c, index| c + (c.downcase * (index)) }.join("-")
end
def sum_array(a... |
# frozen_string_literal: true
require "spec_helper"
module Decidim
module Participations
describe ParticipationVotesHelper do
let(:organization) { create(:organization) }
let(:limit) { 10 }
let(:votes_enabled) { true }
let(:participation_feature) { create(:participation_feature, organiza... |
require 'find'
module FeatureBox
module Generators
class ViewsGenerator < Rails::Generators::Base
source_root File.expand_path("../../../../", __FILE__)
desc "Copying FeatureBox views to your application folder"
def copy_views
directory 'app/views/feature_box', 'app/views/feature_box'
... |
class Nib < ActiveRecord::Base
validates :nib_type, presence: true
end
|
class SessionsController < ApplicationController
def new
end
def create
request = Request.find_by_request_token(params[:request_token])
user = User.find_by_email(params[:email])
if request && user && user.authenticate(params[:password])
session[:user_id] = user.id
request.user = current_u... |
require 'formula'
class Cdb < Formula
homepage 'http://cr.yp.to/cdb.html'
url 'http://cr.yp.to/cdb/cdb-0.75.tar.gz'
sha1 '555749be5b2617e29e44b5326a2536813d62c248'
def install
inreplace "conf-home", "/usr/local", prefix
system "make setup"
end
end
|
# encoding: UTF-8
#
# Copyright (c) 2010-2017 GoodData Corporation. All rights reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
describe GoodData::Project do
subject { GoodData::Project }
let(:from_project) { double('from_pr... |
class SessionsController < ApplicationController
def new
@streamer = Streamer.new
end
def create
streamer_params = params.require(:streamer).permit(:name, :password)
@streamer = Streamer.confirm(streamer_params)
if @streamer
login(@streamer)
redirect_to @streamer
else
redirect_to login_path
end
|
module Api
class PanesController < ApplicationController
def create
@pane = current_user.panes.new(pane_params)
if @pane.save
render json: @pane
else
render json: @pane.errors.full_messages, status: :unprocessable_entity
end
end
def destroy
@pane = Pane.find(... |
require "application_system_test_case"
class ProdutosTest < ApplicationSystemTestCase
setup do
@produto = produtos(:one)
end
test "visiting the index" do
visit produtos_url
assert_selector "h1", text: "Produtos"
end
test "creating a Produto" do
visit produtos_url
click_on "New Produto"
... |
require 'delegate'
require 'yaml'
module Nom
class Config < SimpleDelegator
FILE_NAME = ".nom"
def initialize
super([
File.join(File.dirname(__FILE__), "..", FILE_NAME),
File.join("~", FILE_NAME)
].inject({}) do |a, file_name|
a.merge(lambda {|f|
File.exists?... |
require 'rails_helper.rb'
RSpec.feature "User logs in successfully", type: :feature do
before(:all) do
User.delete_all
user = User.create(name: "test", password: "password", phone:"+13367071124", email: "test@test.com")
end
scenario "User successfully signs in" do
visit login_pat... |
FactoryGirl.define do
factory :eligibility do
name "Seniors"
end
trait :update_name do
name "LGBT"
end
end |
$: << File.expand_path(File.dirname(__FILE__))
require 'test_helper'
require 'adcenter_client'
class AdministrationServiceTest < Test::Unit::TestCase
def setup
$DEBUG = true
assert_sandboxed(TEST_CREDENTIALS)
@acc = AdCenterClient.new(TEST_CREDENTIALS, nil, false)
@svc = @acc.administration_service
... |
require 'spec_helper'
describe LinksController do
describe 'GET :index' do
before do
get :index, :network => 'freenode', :channel => 'ruby'
end
it { should respond_with(:success) }
it do
assigns(:network).should == 'freenode'
end
it do
assigns(:channel).should == 'ruby'
... |
class ApplicationController < ActionController::Base
#protect_from_forgery with: :exception
#require 'httparty'
protect_from_forgery with: :null_session
private
def current_user
User.where(id: session[:user_id]).first
end
helper_method :current_user
end
|
class AddInfoToPoints < ActiveRecord::Migration[5.2]
def change
add_column :points, :payer, :string
add_column :points, :payer_id, :integer
end
end
|
module UrlHelper
def url_with_protocol(url)
uri = URI.parse(url)
if(!uri.scheme)
"http://#{url}"
elsif(%w{http https}.include?(uri.scheme))
url
end
end
end
|
class AddTypesToListings < ActiveRecord::Migration[5.1]
def change
add_column :listings, :Property_Name, :text
add_column :listings, :Property_Type, :text
end
end
|
class CreateProducts < ActiveRecord::Migration
def change
create_table :products do |t|
t.string :name
t.string :sku
t.string :code
t.text :description
t.float :price
t.boolean :is_taxable, default: true
t.integer :reorder_point
t.string :color_code, defaul... |
require 'rails_helper'
RSpec.describe 'TaskInLists', type: :request do
let!(:registred_user) { create(:user, :registred) }
let!(:registred_user2) { create(:user, :registred) }
let!(:registred_headers) { header_for_user(registred_user) }
let!(:registred_headers2) { header_for_user(registred_user2) }
let!(:tas... |
class Teacher < ActiveRecord::Base
has_many :lessons
has_many :students, :through => :lessons
end
|
class User < ActiveRecord::Base
attr_reader :password
validates :username, :password_digest, :session_token, presence: true
validates :username, uniqueness: true
validates :password, length: {minimum: 6}, allow_nil: :true
after_initialize :ensure_session_token
has_many :playlist_memberships, dependent: :destr... |
class Calendarupdate < ApplicationRecord
has_many :lessons
validates :capacity, presence: true, numericality: { greater_than: 0 }
validates :name, presence: true
validates :description, presence: true
validates :location, presence: true
validates :moment, presence: true
validates_length_of :moment, minim... |
class Solution < ApplicationRecord
belongs_to :problem
belongs_to :user
has_one_attached :image
has_one_attached :document
validates :title, presence: true, length: { maximum: 30 }
validates :body, presence: true, length: { maximum: 500 }
end
|
# frozen_string_literal: true
class ReconcilePresenter < BasePresenter
delegate :name, :organization, :start_time_local, :available_live, :efforts, :unreconciled_efforts, :id, :concealed?,
to: :parent
def initialize(args)
ArgsValidator.validate(params: args,
required: [:p... |
#!/usr/bin/env ruby
# Send an e-mail to all users with the last payment in EUR to let them know
# that we have a new bank account.
Dir.chdir('/opt/vpsadmin/api')
require '/opt/vpsadmin/api/lib/vpsadmin'
# Necessary to load plugins
VpsAdmin::API.default
CURRENCY = 'EUR'
SUBJ = {
cs: "[vpsFree.cz] Změna bankovního ... |
require 'test_helper'
class Piece18sControllerTest < ActionController::TestCase
setup do
@piece18 = piece18s(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:piece18s)
end
test "should get new" do
get :new
assert_response :success
en... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.