text stringlengths 10 2.61M |
|---|
# frozen_string_literal: true
class UserForSelectSerializer < ActiveModel::Serializer
attributes :name, :id, :account_number, :current_user, :debt_permitted
end
|
RSpec.describe Cards::Transactions::Sync do
let(:card) { create :card }
let(:transactions) do
[
{
date: Time.parse('20.07.2017'),
title: 'Перечисление з/п по реестру',
amount_cents: 5000000.0,
amount_currency: 'RUB'
},
{
date: Time.parse('02.08.2017'),
... |
# 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... |
# coding: utf-8
class JournalTypesController < ApplicationController
before_filter :auth_required
def index
end
def search
@items = JournalType.order(:name)
if !params[:q].blank?
@items = @items.where("(name LIKE :q)", {:q => "%#{params[:q]}%"})
end
render :layout => false
end
def... |
class Campus < ActiveRecord::Base
has_many :buildings, dependent: :destroy
has_many :polygons, as: :imageable, dependent: :destroy
validates :name, presence: true, length: { maximum: 32}, uniqueness: true
validates :description, length: {maximum: 64}
end
|
class Commitment < ActiveRecord::Base
belongs_to :team
belongs_to :championship
validates_presence_of :team, :championship
end
|
require_relative "lib/bootstrap"
RSpec.configure do |config|
config.before :suite do
AnsibleHelper.playbook("playbooks/install.yml", ENV["TARGET_HOST"], {
env_name: "dev",
install_mysql: true,
new_db_name: "test_db",
new_db_user: "test_db_owner",
new_db_pass: "password123... |
doctype html
html
head
title Dashboard
= csrf_meta_tags
= csp_meta_tag
= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload'
//! Fonts and icons
// Font Awesome
link crossorigin="anonymous" href="https://use.fontawesome.com/releases/v5.0.8/css/all.css" inte... |
require "rails_helper"
RSpec.describe 'News', js: true do
let!(:article) {
NewsArticle.create!({
title: 'first title',
body: 'first body',
subtitle: 'first subtitle',
background_image_url: 'http://lvh.me/testing.png'
})
}
let!(:article2) {
NewsArticle.create!({
title: ... |
module JRuby::Lint
module Checkers
class Gemspec
include Checker
include CheckGemNode
def visitCallNode(node)
# Gem::Specification.new do |s| =>
#
# CallNoArgBlockNode |new|
# Colon2ConstNode |Specification|
# IterNode
# DA... |
class RemoveHstoreFromLists < ActiveRecord::Migration
def change
remove_column :lists, :items
end
end
|
# encoding: UTF-8
require 'test_helper'
class Html5StringInputTest < ActionView::TestCase
[:html5_date, :html5_datetime, :html5_time].each do |type|
html5_type = type.to_s.sub(/^html5_/, '')
test "input should allow type #{type}" do
with_input_for @user, :name, type
assert_select "input[type=#{h... |
# public List<List<Integer>> subsets(int[] nums) {
# List<List<Integer>> list = new ArrayList<>();
# Arrays.sort(nums);
# backtrack(list, new ArrayList<>(), nums, 0);
# return list;
# }
def subsets(nums)
list = []
# nums.sort!
backtrack(list, Array.new, nums, 0)
# p list.size
list
end
# priv... |
class App < HyperComponent
include Hyperstack::Router
class << self
def reload!
@reload = true
end
def reload?
return unless @reload
if Hyperstack.env.production?
`window.newWorker.postMessage({ action: 'skipWaiting' })`
else
after(0.5) { mutate }
end
... |
# Copyright (c) 2006, 2007 Ruffdogs Software, Inc.
# Authors: Adam Lebsack <adam@holonyx.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License.
#
# This program ... |
class User < ActiveRecord::Base
has_many :posts
has_secure_password
#posts created by the user
has_many :posts
#votes ABOUT this user (via votable)
has_many :votes, as: :votable
#votes cast by the user (via user_id foreign key)
has_many :ratings, class_name: 'Vote'
validates :email,
presence: ... |
=begin
Define a method that takes an array of numbers, and returns the total of the addition of all the numbers in the array. Store the result of a call to this method in a well-named variable.
=end
numbers = [3,5,8,6,3,6,5,3]
def total(arr)
arr.reduce( :+ )
end
p result = total(numbers)
|
class AdminController < ApplicationController
before_filter :require_authentication, except: [:login, :logout]
def index
redirect_to articles_path
end
def login
if request.post? && params[:password] == ENV['AUTH_PASSWORD']
session[:authenticated] = true
redirect_to admin_path
end
en... |
require 'spec_helper'
require 'json'
def title_query_params q
{qf: "${title_qf}", pf:"${title_pf}", q: q}
end
def left_anchor_query_params q
{qf: "${left_anchor_qf}", pf: "${left_anchor_pf}", q: "#{q}*"}
end
describe 'title keyword search' do
include_context 'solr_helpers'
before do
delete_all
end
... |
require "application_system_test_case"
class CategoryAnswersTest < ApplicationSystemTestCase
setup do
@category_replay = category_answers(:one)
end
test "visiting the index" do
visit category_answers_url
assert_selector "h1", text: "Category Answers"
end
test "creating a Category replay" do
... |
ActiveRecord::Schema.define do
self.verbose = false
create_table :issues, :force => :cascade do |t|
t.integer :repo_id
t.string :title
t.text :description
t.integer :source_user_id
t.string :state
t.boolean :locked
t.datetime :opened_at
t.datetime :closed_at
t.timesta... |
=begin
Write a method that takes a number as an argument. If the argument is a positive number, return the negative of that number. If the number is 0 or negative, return the original number.
Examples;
=end
def negative(num)
if num.zero?
num
elsif num.negative?
num
elsif num.positive?
-num
end... |
class Skill < ActiveRecord::Base
has_many :divisions
has_many :leagues, through: :divisions
has_many :users, through: :divisions
has_many :members, through: :divisions
end
|
require 'spec_helper'
require "rails_helper"
describe UsersController, :type => :controller do
before :each do
@user1 = create(:user)
@user2 = create(:user)
photo = fixture_file_upload("/images/test.jpg", 'image/jpg')
@params_update_avatar = {
avatar: photo
}
end
context "update avatar"... |
# 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... |
# frozen_string_literal: true
require 'spec_helper'
require 'web_test/util'
include RSpec::WebserviceMatchers
describe '#up?' do
it 'follows redirects when necessary' do
expect(WebTest::Util.up?('perm-redirector.com')).to be_truthy
expect(WebTest::Util.up?('temp-redirector.org')).to be_truthy
end
it 'r... |
class Calendar
include Neo4j::ActiveNode
id_property :personal_id, on: :idHash
property :calendarId, type: String
property :idHash, type: String
property :description, type: String
property :background, type: String
property :lastUpdate, type: DateTime
has_many :in, :meetings, type: "BELONGS", model_... |
require 'rails_helper'
RSpec.describe "elblog/posts/index", :type => :view do
before(:each) do
@posts = FactoryGirl.create_list :elblog_post, 2
assign(:posts, @posts)
end
it "renders a list of posts" do
render
@posts.each do |post|
assert_select "a[href=?]", post_path(post), :text => post... |
class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :validatable
with_options presence: true do
validates :email, un... |
require 'sinatra/base'
require 'sinatra/async'
require 'active_support'
require_relative File.expand_path(File.join(File.dirname(__FILE__),'../app/models/Product'))
module Mapper
class Webserver < Sinatra::Base
set :server, :thin
register Sinatra::Async
configure do
set :threaded, true
set :ro... |
class AddUserIdtoList < ActiveRecord::Migration
def up
create_table :lists do |t|
t.string :name
t.string :organization
t.integer :user_id
t.timestamps
end
def down
end
end
|
class AddDirecotryToAttachmentVersions < ActiveRecord::Migration
def change
add_column(:attachment_versions, :disk_directory, :string) unless column_exists?(:attachment_versions, :disk_directory)
end
end
|
require 'rails_helper'
RSpec.describe PostsController, :type => :controller do
let!(:published_post) { FactoryGirl.create(:post) }
let!(:unpublished_post) { FactoryGirl.create(:post, unpublished_at: DateTime.now) }
describe "GET index" do
before { get :index }
it "returns http success" do
expect... |
#---
# Excerpted from "Rails 4 Test Prescriptions",
# published by The Pragmatic Bookshelf.
# Copyrights apply to this code. It may not be used to create training material,
# courses, books, articles, and the like. Contact us if you are in doubt.
# We make no guarantees that this code is fit for any purpose.
# Visit ... |
require 'minitest/autorun'
require_relative '../contact'
class TestContact < Minitest::Test
def setup
@contact = Contact.create(
first_name: 'Grace',
last_name: 'Hopper',
email: 'grace@hopper.com',
note: 'computer scientist')
end
def teardown
Contact.delete_all
end
def test_all
... |
class Reward < ApplicationRecord
has_many :user_rewards
validates_presence_of :name
end |
class Api::PizzasController < ApplicationController
before_action :set_pizza, only: [:show,:update, :destroy]
def index
render json: Pizza.all
end
def create
@pizza = Pizza.new(pizza_params)
if (@pizza.save)
render json: @pizza
... |
# == Schema Information
#
# Table name: plans
#
# id :integer not null, primary key
# name :string
# number_of_publications :integer
# price :decimal(15, 2) default(0.0)
# duration_in_days :integer default(0)
# created_at ... |
# Section 5, lecture 63
grade = "B"
if grade.downcase == "a"
puts "That's an excellent grade. Good job!"
elsif grade.downcase == "b"
puts "That's a good grade. Let's bring it up next time."
else # acts as a catch-all for all other possible scenarios
puts "Unacceptable..."
end
def odd_or_even(number)
if number... |
Rails.application.routes.draw do
mount RailsAdmin::Engine => '/command_center', as: 'rails_admin'
devise_for :team, controllers: { registrations: "registrations" }
root to: "dashboard#index"
resource :contests, only: [:show]
resources :challenges, only: [:index]
resources :challenge_responses, only: [:inde... |
require 'sqlite3'
require 'singleton'
class QuestionDBConnection < SQLite3::Database
include Singleton
def initialize
super('questions.db')
self.type_translation = true
self.results_as_hash = true
end
end
require_relative 'ORMs/user'
require_relative 'ORMs/question'
require_relative 'ORMs/questio... |
# Modelo Texto
# Tabla textos
# Campos id:integer
# texto:string
# created_at:datetime
# updated_at:datetime
class Texto < ActiveRecord::Base
has_many :textos_favoritos, class_name: 'TextoFavorito', inverse_of: :texto,
dependent: :destroy
validates :texto, presen... |
raise "I can't handle this platform: #{RUBY_PLATFORM}" unless RUBY_PLATFORM =~ /darwin/
module Memetic
class Environment
def initialize
@binary_path = []
@library_path = []
@variables = {}
end
def add_binary_path(path)
@binary_path << path
end
def add_lib... |
class CreateActivities < ActiveRecord::Migration[6.0]
def change
create_table :activities, id: :uuid do |t|
t.string :identifier, unique: true
t.string :sector
t.string :title
t.text :description
t.string :status
t.date :planned_start_date
t.date :planned_end_date
t... |
require 'pry'
module Memorable
def reset_all
self.all.clear
end
def count
self.all.count
end
def find_by_name(name)
self.all.detect {|artist| artist.name == name}
end
end
|
class AboutContentsController < ApplicationController
before_action :set_about_content, only: [:show, :edit, :update, :destroy]
before_action :authenticate_user!, :authorize_record, :injectable_meta#from application_controller
# GET /about_contents/1
# GET /about_contents/1.json
def show
end
# GET /ab... |
# == Schema Information
#
# Table name: weekly_internals
#
# id :integer not null, primary key
# intro :text
# lang :string
# locale_only :boolean default(FALSE)
# created_at :datetime not null
# updated_at :datetime not null
# weekly_id :integer
#
clas... |
class RichMediaLink
attr_accessor :link, :view_context, :render_image
def initialize(link, view_context, options={})
@link = link
@view_context = view_context
@render_image = options.fetch(:render_image, true)
@image = options.fetch(:image, false)
end
def og_attributes
{
title: title,... |
class Cat < Animal
# attr_reader :name
# attr_accessor :mood
include Mammal
def initialize(name, number_of_lives = 9)
@number_of_lives = number_of_lives
super(name)
puts "I'm a cat"
@mood = 'apathetic'
end
def self.twenty_three_and_me
self.ancestors
end
# def self.ancestors
... |
class MoneyChecksController < ApplicationController
before_action :set_money_check, only: [:show, :edit, :update, :destroy]
# GET /money_checks
# GET /money_checks.json
def index
@money_checks = MoneyCheck.all
end
# GET /money_checks/1
# GET /money_checks/1.json
def show
end
# GET /money_chec... |
require 'net/https'
require 'uri'
module CVE
class Crawler
DATA_FEED_DEFAULT = URI('https://nvd.nist.gov/download/nvd-rss.xml')
DATA_FEED_ANALYZED = URI('https://nvd.nist.gov/download/nvd-rss-analyzed.xml')
def initialize(type, verify_cert, user_agent)
@crawl_url = type.downcase == 'analyzed' ? DA... |
class Technik < ActiveRecord::Base
attr_accessible :name
has_many :klasses, class_name: 'Klasse'
end
|
class Ship
attr_reader :name, :ship_length, :health
def initialize(name, ship_length)
@name = name
@ship_length = ship_length
@health = ship_length
@sunk = false
end
def sunk?
@sunk
end
def hit
@health -= 1
@sunk = true if @health <= 0
end
end
|
require File.expand_path(File.join(File.dirname(__FILE__), *%w[.. .. spec_helper]))
describe '/customers/new' do
before :each do
assigns[:customer] = @customer = Customer.new
end
def do_render
render '/customers/new'
end
it 'should include a customer creation form' do
do_render
response.sho... |
module Faker
class School < Base
flexible :school
class << self
def name
parse('school.name')
end
def suffix; fetch('school.suffix'); end
end
end
end
|
class Spaces::SearchService
PRICE_RANGE_REGEX = /(?<min>\d+),(?<max>\d+)/
def self.attrs
@attrs ||= [:classification, :city_id, :ratings, :price_hourly_range, :categories, :amenities, :availabilities]
end
def self.permitted_params
@permitted_params ||= [:classification, :city_id, :price_hourly_range,... |
require_plugin 'tog_core'
require_plugin 'seo_urls'
require_plugin 'flashplayrhelpr'
require_plugin 'paperclip'
require "i18n" unless defined?(I18n)
Dir[File.dirname(__FILE__) + '/locale/**/*.yml'].each do |file|
I18n.load_path << file
end
Tog::Plugins.settings :tog_podcasts, "channel.cover.max_file_size_kb"=> 10... |
TextifierDemo::Application.routes.draw do
resources :adjectives
resources :entities
resources :terms
root :to => "homepage#show"
end
|
require 'csv'
class Person
attr_accessor :name, :lastname
def initialize(name:, lastname:)
self.name = name
self.lastname = lastname
end
def to_s
"#{name} #{lastname}"
end
def self.load_csv(file)
rows = []
CSV.new(file, headers: true).each do |row|
row = row.... |
class Project < ActiveRecord::Base
has_many :project_requirements, :dependent => :destroy
has_many :project_targets, :dependent => :destroy
has_many :startups, through: :startups_projects
belongs_to :startup
validates_presence_of :name, :description, :category
validates_length_of :name, :within => 3 ..... |
# frozen_string_literal: true
module Contentful
class Importer < ApplicationService
def initialize; end
def call
client ||= ::Contentful::Client.new(
space: ENV['CONTENTFUL_SPACE_ID'],
access_token: ENV['CONTENTFUL_ACCESS_TOKEN'],
dynamic_entries: :auto # Enables Content Type c... |
require 'jumpstart_auth'
require 'bitly'
class MicroBlogger
attr_reader :client
def initialize
puts 'Initializing MicroBlogger'
@client = JumpstartAuth.twitter
end
def followers_list
screen_names = []
@client.followers.each {|f| screen_names << @client.user(f).screen_name}
screen_names
end
def shor... |
class AdventuresController < ApplicationController
def new
@adventure = Adventure.new
@page = Page.new
# respond_to do |f|
# f.html
# f.json { render :json => {error: 'Cannot access new page, try create'}, status: 404 }
# end
end
def show
#binding.pry
@adventure = Adventure.fi... |
require 'sass'
require 'base64'
module SassBase64
def sassBase64(string)
assert_type string, :String
Sass::Script::String.new(Base64.strict_encode64(string.value))
end
declare :sassBase64, :args => [:string]
end
module Sass::Script::Functions
include SassBase64
end
|
class PickupsController < ApplicationController
# GET /pickups
# GET /pickups.xml
def index
@pickups = Pickup.order('created_at DESC')
@pickups = @pickups.paginate(:page => params[:page], :per_page => 20)
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @pi... |
class CreateInvestmentEntries < ActiveRecord::Migration
def change
create_table :investment_entries do |t|
t.string :coin_name
t.string :community
t.string :code
t.string :whitepaper
t.integer :user_id
t.datetime :date
end
end
end
|
module Coercell
module Value
def self.coerce(model,attribute_name,value)
attribute_type = (model.columns.select { |a| a.name == attribute_name }).first.type
value = case attribute_type
when :integer
value.to_i if value.is_a? Numeric
else
val... |
require 'pry'
class String
# self refers to the string being passed into method since a string is the object for that String class
def sentence?
return true if self.end_with?(".")
return false
end
def question?
return true if self.end_with?("?")
return false
end
def exclamation?
retur... |
require 'rails_helper'
RSpec.describe Contact, type: :model do
let(:title) { FFaker::BaconIpsum.phrase }
let(:url) { FFaker::Internet.http_url }
let(:intervention) { Fabricate(:intervention) }
let(:contact) { Fabricate(:contact, title: title, url: url, intervention: intervention) }
it 'creates a contact' d... |
module Admin::RemoteTasksHelper
def status_label(task)
case task.status
when 'creating', 'created'
'label label-default'
when 'pending'
'label label-warning'
when 'running'
'label label-primary'
when 'cleaning'
'label label-info'
when 'succeeded', 'finished'
'labe... |
#
# Copyright (c) 2014 Webhippie <http://www.webhippie.de>
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modif... |
#Warm up
def range(start, endpt)
#returns an array of all numbers from start to end excluding end
#returns an empty array if end < start
rarr = []
return rarr if endpt <= start
rarr << start
rarr += range(start+1,endpt)
end
# p range(1,10)
#Sum an array recursive
def re_sum(arr)
r... |
require File.dirname(__FILE__) + '/../test_helper'
require 'entries_controller'
# Re-raise errors caught by the controller.
class EntriesController; def rescue_action(e) raise e end; end
class EntriesControllerTest < Test::Unit::TestCase
fixtures :entries
def setup
@controller = EntriesController.new
@re... |
# coding: utf-8
class Requirement < ActiveRecord::Base
KINDS = %w[Udfald Funktion Finish Holdbarhed Miljø]
belongs_to :work_process
end
|
Copyright (c) 2014 Francesco Balestrieri
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribu... |
class CreateDownVotes < ActiveRecord::Migration
def change
create_table :down_votes do |t|
t.references :like_a_little
t.references :student
t.timestamps
end
add_index :down_votes, [:like_a_little_id, :student_id], unique: true
end
end
|
# This migration comes from atomic_lti (originally 20220428175305)
class CreateAtomicLtiDeployments < ActiveRecord::Migration[6.1]
def change
create_table :atomic_lti_deployments do |t|
t.string :deployment_id, null: false
t.string :client_id, null: false
t.string :platform_guid
t.string :... |
module Wechat::BaseHelper
def full_url url
"#{ENV['WESELL_SERVER']}#{url}"
end
end
|
json.array!(@hairsummaries) do |hairsummary|
json.extract! hairsummary, :id
json.url hairsummary_url(hairsummary, format: :json)
end |
require 'rails_helper'
RSpec.describe CommentsController, type: :controller do
let!(:user) { create(:user) }
before { @request.env['devise.mapping'] = Devise.mappings[:user] }
before { sign_in user }
describe '#index' do
def do_request
get :index
end
let!(:comment_parent) { create(:co... |
class CardsController < AuthenticatedUserController
onboard :owner_cards, :companion_cards, with: [:survey, :save_survey]
def index
# Unfortunately I can't figure out a better way of avoiding all the N+1 issues
# without reloading the current account, since you can't call `includes`
# after the account... |
require_relative "../require/macfuse"
class Mp3fsMac < Formula
desc "Read-only FUSE file system: transcodes audio formats to MP3"
homepage "https://khenriks.github.io/mp3fs/"
url "https://github.com/khenriks/mp3fs/releases/download/v1.1.1/mp3fs-1.1.1.tar.gz"
sha256 "942b588fb623ea58ce8cac8844e6ff2829ad4bc9b4c1... |
class ProjectsController < ApplicationController
rescue_from ActiveRecord::RecordNotFound, with: :record_not_found
def index
if tool = project_params[:tool]
projects = Tool.find_by(name: tool).projects
else
projects = Project.all
end
if type = project_params[:type]
projects = proj... |
# se accede a la informacion sin necesidad de la posición.
# se accede a través del objeto directamente. Formado por CLAVE y VALOR
# se define con { }
# tutor = {"nombre" => "Maria", "edad" => 34, 20 => "veinte", [] => "arreglo" }
# puts tutor["nombre"] # muestro solo el que busco en concreto
# tutor["cursos"] = 10... |
# -*- encoding: utf-8 -*-
require "test/unit"
require "unicode_utils/nfd"
require "unicode_utils/nfc"
# See data/NormalizationTest.txt
class TestNormalization < Test::Unit::TestCase
class Record
def initialize(ary)
@ary = ary
end
def c1
@ary[0]
end
def c2
@ary[1]
end
... |
# module ActsAsTaggable
# extend ActiveSupport::Concern
# included do
# has_many :taggings, as: :taggable, class_name: 'Tagging'
# has_many :tags, through: :taggings, class_name: 'Tag'
# end
# end
# module ActsAsTaggable
# def self.included(base)
# base.extend(ClassMethods)
# end
# module Cl... |
class LivechatController < ApplicationController
def chat
@title = "Live Chat"
end
end
|
require 'formula'
class Chicken < Formula
homepage 'http://www.call-cc.org/'
url 'http://code.call-cc.org/releases/4.9.0/chicken-4.9.0.1.tar.gz'
sha1 'd6ec6eb51c6d69e006cc72939b34855013b8535a'
head 'git://code.call-cc.org/chicken-core'
bottle do
revision 1
sha1 "336ed80fce3e2e2d548ad966b4a60d249523... |
require 'typhoeus'
module Typhoid
class Request < TyphoeusDecorator
decorate ::Typhoeus::Request
ACCESSOR_OPTIONS = [
:method,
:params,
:body,
:headers,
:cache_key_basis,
:connect_timeout,
:timeout,
:user_agent,
:response,
:cache_timeout,
:fol... |
# frozen_string_literal: true
require_relative 'application_repo'
module Repos
class CoinRepo < ApplicationRepo[:coins]
commands(:create, update: :by_pk)
def count_by_denomination(denomination)
coins.where(denomination: denomination).count
end
def count_processed
coins.where(state: 'pr... |
module PPC
module API
class Sm
class Account < Sm
Service = 'account'
AccountType = {
id: :userId,
name: :userName,
balance: :balance,
cost: :cost,
payment: :payment,
budget_type: :b... |
# == Schema Information
#
# Table name: badge_ownerships
#
# id :integer not null, primary key
# user_id :integer
# badge_id :integer
# created_at :datetime not null
# updated_at :datetime not null
#
require 'rails_helper'
RSpec.describe BadgeOwnership, type: :model do
con... |
FactoryBot.define do
factory :item do
name {"タケオキクチ 7分袖シャツ"}
price {12000}
explanation {"7分袖なので、春夏秋で着用できます!"}
category_id {1}
size {"M"}
brand_name {"タケオキクチ"}
condition_id {1}
delivery_fee... |
# frozen_string_literal: true
# rubocop:todo all
# Copyright (C) 2019-2021 MongoDB 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
#
# U... |
require 'database_helpers'
require 'Booking'
describe Booking do
describe 'booking' do
it 'request can be raised' do
test_user = create_test_user
name = 'Makers BNB'
description = 'Lovely space to stay'
price = 99
user_id = test_user['user_id']
image = 'duck.jpg'
space ... |
class Climbing < ActiveRecord::Base
belongs_to :user
belongs_to :gym
end
|
class SearchMain < SitePrism::Page
set_url 'https://www.airbnb.com/'
#Elements on SearchMain
element :where, :id, 'Koan-magic-carpet-koan-search-bar__input'
element :searchOptionOne, :id, 'Koan-magic-carpet-koan-search-bar__option-0'
element :checkIn, :id, 'checkin_input'
element :checkOut, :id, 'ch... |
class Localization < ActiveRecord::Base
self.table_name = 'locations'
include Activable
include Sanitizable
belongs_to :user, foreign_key: :user_id, touch: true
belongs_to :localizable, polymorphic: true, touch: true
after_update :check_main_location, if: 'main and main_changed?'
validates ... |
namespace :localities do
namespace :city do
desc "Rename city FROM to city TO, moving all associated locations"
task :rename do
city_from_name = ENV["FROM"]
city_to_name = ENV["TO"]
if city_from_name.blank? or city_to_name.blank?
puts "usage: missing FROM or TO"
... |
class AddDraftStatDistributions < ActiveRecord::Migration[5.2]
def change
create_table "draft_stat_distributions", id: :integer, force: :cascade do |t|
t.references :defined_stat
t.integer "player_type", default: 1
t.string "label"
t.string "name"
t.float "mean"
t.float "max"
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.