text stringlengths 10 2.61M |
|---|
require 'rails_helper'
describe OpenWeatherMap::Client do
subject { described_class.new('APIKEY') }
describe '#get_weather_by_city' do
let (:parsed_response) {
{
'main' => {
'temp' => 280.32,
'pressure' => 1012,
'humidity' => 81,
'temp_min' => 279.15,
... |
songs = [
"Phoenix - 1901",
"Tokyo Police Club - Wait Up",
"Sufjan Stevens - Too Much",
"The Naked and the Famous - Young Blood",
"(Far From) Home - Tiga",
"The Cults - Abducted",
"Phoenix - Consolation Prizes",
"Harry Chapin - Cats in the Cradle",
"Amos Lee - Keep It Loose, Keep It Tight"
]
def help... |
# This uses ActiveSupport's compress and decompress methods
require 'zlib'
require 'stringio'
class Stream < StringIO
def close
rewind
end
end
def decompress(source)
Zlib::GzipReader.new(StringIO.new(source)).read
end
def compress(source)
output = Stream.new
gz = Zlib::GzipWriter.new(output)
gz.w... |
# require 'spec_helper'
#
# describe RacesController do
#
# def mock_race(stubs={})
# @mock_race ||= mock_model(Race, stubs).as_null_object
# end
#
# describe "GET index" do
# it "assigns all races as @races" do
# Race.stub(:all) { [mock_race] }
# get :index
# assigns(:races).should e... |
# frozen_string_literal: true
require 'sequel'
Sequel.migration do
change do
create_table(:events) do
primary_key :id
foreign_key :organization_id
String :title
String :summary
String :datetime
String :location
String :url, unique: true
String :cover_img_url
... |
# frozen_string_literal: true
require 'dotenv/load'
require 'bundler/setup'
require 'rollbar_api'
project_name = ENV['ROLLBAR_PROJECT_NAME']
project_access_token = ENV['ROLLBAR_PROJECT_ACCESS_TOKEN']
raise 'Must specify ROLLBAR_PROJECT_NAME in .env' if project_name.blank?
raise 'Must specify ROLLBAR_ACCOUNT_ACCESS_T... |
json.error do
json.type "Unauthorized"
json.message "You don't have permission for this action."
end |
class ApplicationController < ActionController::API
def authenticate
if bearer_token.present?
@current_user = User.where(token: bearer_token)
if @current_user.present? && !@current_user.banned
@current_user.resurrect_if_deactivated!
else
unauthorized_bearer
return
... |
#encoding: utf-8
module ModeloQytetet
class TituloPropiedad
attr_reader :nombre, :alquilerBase, :factorRevalorizacion, :hipotecaBase, :precioEdificar
attr_accessor :hipotecada, :casilla
attr_writer :propietario
def initialize(name, ab, fr, hb, pe)
@nombre = name
@hipotecada = fal... |
class ProfilesController < ApplicationController
def new
@profile = current_user.build_profile()
end
def create
@profile = current_user.build_profile(params[:profile])
if @profile.save
redirect_to user_profile_path current_user
else
render action: "new"
end
end
def update... |
# frozen_string_literal: true
module ElasticAPM
# @api private
module Spies
# @api private
class NetHTTPSpy
KEY = :__elastic_apm_net_http_disabled
TYPE = 'ext'
SUBTYPE = 'net_http'
class << self
def disabled=(disabled)
Thread.current[KEY] = disabled
end
... |
require 'formula'
class EmBullet < Formula
homepage 'http://bulletphysics.org/wordpress/'
url 'https://bullet.googlecode.com/files/bullet-2.82-r2704.tgz'
version '2.82'
sha1 'a0867257b9b18e9829bbeb4c6c5872a5b29d1d33'
head 'http://bullet.googlecode.com/svn/trunk/'
depends_on 'cmake' => :build
depends_on ... |
class ChangeDataStartTimeToCook < ActiveRecord::Migration[5.2]
def up
change_column :cooks, :start_time, :date
end
end
|
require 'rails_helper'
RSpec.describe Api::V1::AlbumsController, type: :controller do
describe '#songs' do
let!(:artist) { FactoryBot.create(:artist, name: 'Artist1', genres: ['salsa'], popularity: 3) }
let!(:album) { FactoryBot.create(:album, name: 'album1', artist: artist) }
let!(:song1) { FactoryBo... |
class Mutations::CreateUserAnswer < Mutations::BaseMutation
argument :answers_ids, [Integer, null: true], required: true
field :errors, String, null: false
def resolve(answers_ids:)
answers = Answer.find(answers_ids)
answers_respond(answers)
# TODO: Handle errors
{
errors: 'none' # to be re... |
class ReminderMailer < ActionMailer::Base
include ActionView::Helpers::DateHelper
layout 'email'
default :from => 'GamePlayDate.com <no-reply@gameplaydate.com>'
def remind_organizer(organizer, event)
event_time = distance_of_time_in_words_to_now(event.fromtime)
@organizer = organizer
mail(:to... |
require 'rails_helper'
describe "you must be signed in" do
before(:each) do
@user = create(:user_with_recipes)
end
it "to visit user" do
visit user_path @user
expect(current_path).to eq '/login'
end
it "to edit user" do
visit edit_user_path @user
expect(current_path).to eq '/logi... |
class User < ApplicationRecord
validates :name, presence: true, length: { maximum: 50 }
validates :email, presence: true, uniqueness: { case_sensitive: false},
length: { maximum: 255 }
has_many :posts
has_many :comments
end
|
class AddInstructionsToTestCase < ActiveRecord::Migration
def change
add_column :test_cases, :instructions, :text
end
end
|
# 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... |
# tip_calculator.rb
# Create a simple tip calculator. The program should prompt for a bill amount
# and a tip rate. The program must compute the tip and then display bot the tip
# and the total amount of the bill.
# Pseudo-code:
# Create a loop that begins by asking the user for the bill amount.
# Take the user's inpu... |
class Cart < ActiveRecord::Base
belongs_to :user
has_many :line_items
has_many :items, through: :line_items
enum status: {unsubmitted: 0, submitted: 1}
def total
total = 0
line_items.each {|li| total += (li.item.price * li.quantity)}
total
end
def add_item(item_id)
if line_items.find... |
#
# De::Boolean::Operand class
#
# De::Boolean module provides means for dynamic logical expression building/validation/evaluation
# It is built as extension of De module
#
# Boolean expression example:
#
# true AND (false OR true)
#
module De
module Boolean
# Marker module included to all module classes
# ... |
class KyujinDaichoController < ApplicationController
def index
list
render :action => 'list'
end
# GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
verify :method => :post, :only => [ :destroy, :create, :update ],
:redirect_to => { :action => :list }
# def list_kyuj... |
require File.dirname(__FILE__) + '/../test_helper'
class CardioControllerTest < ActionController::TestCase
fixtures :users, :cardiosessions
# Replace this with your real tests.
def setup
@controller = CardioController.new
@request = ActionController::TestRequest.new
@response = ActionController::Tes... |
module ActiveAggregate
module ApplicationHelper
def event_form(opts = {}, event = @event, &code)
pars = {
remote: true,
path: save_event_path(event),
class: 'form-fields',
id: "form_" + event_type_name(event)
}.merge(opts)
content_tag(:div, id: event_t... |
class Comment < ActiveRecord::Base
belongs_to :commentable, :polymorphic => true
belongs_to :user
after_create :create_notification
private
def create_notification
if self.user_id != self.commentable.user.id
notification = Notification.new(:notificable_type => "Comment",
... |
# frozen_string_literal: true
require 'alba'
module Main
module Serializers
class Article
include Alba::Resource
root_key :article
attributes :id, :title, :excerpt, :thumbnail, :published_on, :state
end
end
end
|
require 'uri'
require 'pathname'
require 'pg'
require 'active_record'
require 'logger'
require 'sinatra'
require "sinatra/reloader" if development?
# Include all of ActiveSupport's core class extensions, e.g., String#camelize
require 'active_support/core_ext'
# Some helper constants for path-centric logic
APP_ROOT ... |
require "spec_helper"
describe NewsController do
describe "routing" do
it "routes to #new" do
get("/news/new").should route_to("news#new")
end
it "routes to #newslist" do
get("/news/newslist").should route_to("news#newslist")
end
it "routes to #edit" do
get("/news/edit").... |
Attributes = Struct.new(:classes, :id, :name)
class Parser
def initialize
@final_array = []
html_array = File.readlines('warmuphtml.html')
html_array.each do |line|
exact_match(line)
end
end
def exact_match (tag)
if tag.include?('class=') || tag.include?('id=')
attributes = Attributes.new
end
... |
# empty
|
class ChangeExpenseDateToPaidOn < ActiveRecord::Migration
def change
remove_column :expenses, :date, :datetime
add_column :expenses, :paid_on, :date
end
end
|
class BusyTime < ActiveRecord::Base
attr_accessible :start_time, :end_time, :user
belongs_to :user
scope :in_future, lambda { where('end_time > ?', DateTime.now) }
end |
class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable, :confirmable
enum sex: { male: 0, female: 1, unanswer... |
# encoding: UTF-8
require 'spec_helper'
describe 'conflicthost' do
context 'puppet_mutex in effect' do
it do
expect {
should compile
}.to raise_error(Puppet::Error, /Duplicate declaration/)
end
end
end
|
# frozen_string_literal: true
require_relative 'algosec-sdk/version'
require_relative 'algosec-sdk/client'
require_relative 'algosec-sdk/exceptions'
# Module for interracting with the AlgoSec API
module ALGOSEC_SDK
ENV_VARS = %w[ALGOSEC_HOST ALGOSEC_USER ALGOSEC_PASSWORD ALGOSEC_SSL_ENABLED].freeze
end
|
require 'spec_helper'
if os[:family] == 'redhat'
describe package 'mariadb' do
it { is_expected.to be_installed }
end
describe package 'mariadb-devel' do
it { is_expected.to be_installed }
end
describe package 'mariadb-libs' do
it { is_expected.to be_installed }
end
describe package 'maria... |
# Class Warfare, Validate a Credit Card Number
# I worked on this challenge [by myself, with: ].
# I spent [#] hours on this challenge.
# Pseudocode
# Input: 16 digit integer
# Output: true or false
# Steps:
## create a class CreditCard
## define initialize method that returns an error if the input is not equal to ... |
Rails.application.routes.draw do
namespace :api, defaults: { format: :json } do
namespace :v1 do
resources :items, only: [:show, :index] do
collection do
get '/random', to: 'items#random'
get '/find', to: 'items#show'
get '/find_all', to: 'items#find_all'
get ... |
class AddComplianceBooleansToOpportunities < ActiveRecord::Migration
def up
add_column :opportunities, :compliant_entrance, :boolean, :default => false
add_column :opportunities, :compliant_exit, :boolean, :default => false
remove_index :opportunities, :name => 'index_opportunities_on_in_range_swipes'
... |
class Recipe < ActiveRecord::Base
validates :name, :presence => true
has_and_belongs_to_many :tags
has_and_belongs_to_many :star_ratings
def average_rating
ratings = []
self.star_ratings.each do |star_rating|
ratings << star_rating.rating
end
result = ratings.sum / ratings.size.to_f
result.round(2) #... |
require "spec_helper"
RSpec.describe "Day 23: Unstable Diffusion" do
let(:runner) { Runner.new("2022/23") }
let(:input) do
<<~TXT
....#..
..###.#
#...#.#
.#...##
#.###..
##.#.##
.#..#..
TXT
end
describe "Part One" do
let(:solution) { runner.execute!(input,... |
require 'spec_helper'
describe 'heat::wsgi::apache' do
let :params do
{
:port => 8000,
}
end
shared_examples_for 'apache serving a service with mod_wsgi' do
context 'valid title' do
let (:title) { 'api' }
it { is_expected.to contain_class('heat::deps') }
it { is_expected.to... |
require_relative './src/minesweeper'
require_relative './src/operation/open_operation'
require_relative './src/operation/flag_operation'
class Play
attr_reader :minesweeper
VALID_OPTIONS = ["o", "f"]
def initialize
@minesweeper = Minesweeper.new
end
def initialize_minesweeper(layout_blueprints)
blueprints... |
require 'state_machine'
class Mms::Email < ActiveRecord::Base
self.table_name = "mms_emails"
validates_presence_of :subject, :on => :save, :message => "邮件主题不能为空"
#validates_presence_of :content, :on => :save, :message => "邮件内空不能为空"
validates_presence_of :send_time, :on => :save, :message => "邮件发送时间不能为空"
#vali... |
# encoding: ascii-8bit
require_relative '../spec_helper'
require_relative '../helpers/fake_blockchain'
require 'benchmark'
[
[:utxo, :sqlite, db: :benchmark],
[:utxo, :postgres],
[:utxo, :mysql],
[:archive, :sqlite, db: :benchmark],
[:archive, :postgres],
[:archive, :mysql],
].compact.each do |backend_nam... |
require 'opentok'
require_relative './event_handler_base'
class ArchiveRecording < EventHandlerBase
def opentok
opentok_config = settings['opentok']
@opentok ||= OpenTok::OpenTok.new opentok_config['api_key'], opentok_config['api_secret']
@opentok
end
def start payload
begin
@payload = pa... |
require 'combine_pdf'
module Gradebook
module Reports
class Renderer
DEFAULT_TEMPLATE_DIR = File.join(Rails.root,'vendor', 'plugins','gradebook_templates')
attr_accessor :report, :template, :controller, :planner,:report_model_obj
def self.render (report, template, planner,report_model_obj)
... |
CarrierWave.configure do |config|
config.storage = :grid_fs
config.grid_fs_access_url = "/images"
if Rails.env.production?
config.grid_fs_database = ENV['MONGOID_DATABASE']
config.grid_fs_host = ENV['MONGOID_HOST']
config.grid_fs_port = ENV['MONGOID_PORT']
config.gri... |
class AdminsController < ApplicationController
before_action :authenticate_admin!
def user_index
@users = User.page(params[:page]).per(20).order(created_at: :desc)
end
def shop_index
@shops = Shop.page(params[:page]).per(20).order(created_at: :desc)
end
end
|
# creates a to integer method that converts a string to an integer
module ToInteger
def self.negative?(num_array)
num_array.include?(nil) || num_array.include?(45)
end
def self.negatve_remover(num_array)
num_array.delete_if(&:nil?)
num_array.delete_if { |num| num == 45 }
end
def self.string_to_c... |
require "test_helper"
class JobSeekersControllerTest < ActionDispatch::IntegrationTest
setup do
@job_seeker = job_seekers(:one)
end
test "should get index" do
get job_seekers_url, as: :json
assert_response :success
end
test "should create job_seeker" do
assert_difference('JobSeeker.count') ... |
class Comment < ActiveRecord::Base
validates_presence_of :name,:email,:body
validate :article_should_be_published
belongs_to :article
has_many :comments
belongs_to :comment
def article_should_be_published
errors.add(:article_id, "is not published yet") if article && !article.published?
end
end
|
require_relative "helper"
class TestPairingParam < TestCase
def test_to_and_init_from_str
assert_raise RuntimeError do
PairingParam.init_from_str("type a")
end
param = PairingParam.init_from_str(TYPE_A_PARAM)
assert_equal TYPE_A_PARAM, param.to_str
end
def test_gen_type_a
param = Pairi... |
# scream_print_words.rb
def scream(words)
words = words + "!!!!"
p words
end
scream("Yippee")
|
require 'test_helper'
class ParticipantsSignupTest < ActionDispatch::IntegrationTest
test "invalid signup information" do
get signup_path
assert_no_difference 'Participant.count' do
post participants_path, params: { participant: { first_name: "",
la... |
require "rails_helper"
RSpec.describe QueryAvailableTrays, type: :command do
context "facility with only flower phase" do
let!(:facility) do
facility = create(:facility, :flower_only)
facility.rooms.each do |room|
room.rows.each do |row|
row.shelves.each do |shelf|
shelf... |
class Task < ApplicationRecord
has_many :task_labels, dependent: :destroy
has_many :labels, through: :task_labels, source: :label
has_many_attached :images
# has_one_attached :image
belongs_to :user
validates :title, presence: true
validates :content, presence: true
paginates_per 7
scope :title_s... |
require 'httparty'
require 'json'
class HardWorker
include Sidekiq::Worker
def perform(search_term)
puts "searching for #{search_term}"
artist = get_artist(search_term)
unless artist.nil?
artist_id = artist[:id]
artist_name = artist[:name]
end
if artist_id.nil?
albums = []... |
class RemoveUrlIndexFromGroups < ActiveRecord::Migration
def change
remove_index(:groups, :name => 'index_groups_on_url')
end
end
|
class Update < ActiveRecord::Base
attr_accessible :body, :campaign_id, :image, :title, :video, :lead, :user_id
belongs_to :campaign
belongs_to :user
validates :body, :campaign_id, :title, :lead, :user_id, presence: true
mount_uploader :image, UpdateImageUploader
default_scope { order("created_at DESC") }
... |
timetable_menu = MenuLink.find_by_name('timetable_text')
if timetable_menu.present?
old_menu_links = ['create_timetable','edit_timetable']
MenuLink.find_all_by_name(old_menu_links).map(&:destroy) # destroy older menu links from timetable
new_links = [{ :name => 'manage_subject', :target_controller => 'subjects', ... |
module HasModerated
module Associations
module Base
# Class methods included into ActiveRecord::Base so that they can be called in
# ActiveRecord models.
module ClassMethods
# Will moderate the passed in associations if they are supported.
# Example: has_moderated_association(:... |
# Copyright (c) 2015 Lamont Granquist
# Copyright (c) 2015 Chef Software, Inc.
#
# 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... |
class CheapBigFile < CheapFile
def self.readblock(fd_in, half_block_size)
fd_in.readpartial half_block_size
rescue EOFError
nil
end
def self.write(fd_out, s)
fd_out.write s if fd_out
end
def self.wipe!(s)
(0...s.length).each {|i| s.setbyte i, 255}
end
def self.eof_sout_from_blocks(ha... |
class GamePresenter
def not_available?
not_available.present?
end
end |
require 'turn'
require 'minitest/autorun'
require 'rack/test'
require 'sinatra/test_helpers'
require 'statsd-server-dash'
# basic conf
StatsdServer::Dash.set :retention, "10:2160,60:10080,600:262974"
ENV['RACK_ENV'] = 'test'
include Rack::Test::Methods
class MiniTest::Spec
before do
# clear out redis
app.... |
module SessionsHelper
def log_in(user)
session[:user_id] = user.id
end
def current_user
return unless session[:user_id]
@current_user ||= User.find_by(id: session[:user_id])
end
def logged_in?
!current_user.nil?
end
def log_out
session.delete(:user_id)
@current_user = nil
end... |
class CompaniesController < ApplicationController
before_filter :load_person
before_filter :load_company, :only => [:show, :edit, :update, :delete, :destroy]
before_filter :new_company, :only => [:new, :create, :index]
filter_access_to :all, :attribute_check => true
# GET /people/1/companies
# GET /people/... |
class Store::RegistrationsController < Devise::RegistrationsController
include ActiveModel::ForbiddenAttributesProtection
layout 'store_layout', :only => [:edit, :update, :destroy, :cancel_account]
# Authentication filters
prepend_before_filter :require_no_authentication, :only => [:new, :create, :cancel]
pr... |
# coding: utf-8
require 'kaede'
require 'fluent-logger'
module Kaede
class Notifier
def initialize
if Kaede.config.fluent_host && Kaede.config.fluent_port
@fluent_logger = Fluent::Logger::FluentLogger.new(
Kaede.config.fluent_tag_prefix,
host: Kaede.config.fluent_host,
... |
class Ticket < ActiveRecord::Base
belongs_to :milestone
has_many :comments, :dependent => :destroy
scope :all_tickets, where(:open => true)
scope :verify_tickets, where(:verify => true)
scope :closed_tickets, where(:close => true)
attr_accessible :title, :body, :assigned_to, :open, :verify, :close, :miles... |
class CreateAppliedJobs < ActiveRecord::Migration[5.2]
def change
create_table :applied_jobs do |t|
t.integer :user_id
t.integer :job_id
t.string :job_title
t.string :company_name
t.text :application
t.integer :application_type_id
t.integer :application_status_id
t... |
class AddDescriptionAndLocationToActivities < ActiveRecord::Migration
def change
add_column :activities, :description, :text
add_column :activities, :location_id, :integer
add_column :activities, :travel_hours, :float, default: 0.0
add_index :activities, :location_id
end
end
|
Rails.application.routes.draw do
devise_for :users
#Mostrar los datos de la tabla
get '/departaments', to: 'departaments#index'
#Crear un nuevo departamento
get '/departaments/new', to: 'departaments#new'
post '/departaments', to: 'departaments#create'
#Tomar los valores con el Id
get '/departaments/:id... |
# vi: set ft=ruby :
ansible_found = system('ansible --version');
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.network "forwarded_port", guest: 9000, host: 9999
config.vm.hostname = 'primangular'
config.vm.network :private_network, ip: "192.168.33.10"
config.vm.hostname ... |
require 'test_helper'
class MetadataTest < Minitest::Test
include TestSupport::Data
def setup
@metadata = FluentECS::Metadata.new(metadata_attributes)
end
def test_accessors
assert_equal 'westeros', @metadata.cluster
end
def test_creating_tasks
tasks = @metadata.tasks
assert tasks.all? {... |
class Specinfra::Command::Base::Group < Specinfra::Command::Base
class << self
def check_exists(group)
"getent group #{escape(group)}"
end
def check_has_gid(group, gid)
regexp = "^#{group}"
"getent group | grep -w -- #{escape(regexp)} | cut -f 3 -d ':' | grep -w -- #{escape(gid)}"
e... |
class CollectionsController < ApplicationController
# before_action :find_collection, only: [:edit, :update]
before_action :signed_in_user, only: [:show, :edit, :update, :create, :destroy]
layout "account"
def create
# @theme = Theme.find_by_slug!(params[:id])
@collection = current_user.collections.bu... |
class AddFailedLoginCountToUsers < ActiveRecord::Migration
def change
add_column :users, :failed_login_count, :integer
end
end
|
# frozen_string_literal: true
module GraphQL
module CParser
VERSION = "1.0.5"
end
end
|
class Notification < ActiveRecord::Base
belongs_to :recipient, class_name: "Profile"
belongs_to :actor, class_name: "Profile"
end |
class AddSceneryAndTwistinessRatingToRoads < ActiveRecord::Migration
def change
add_column :roads, :twistiness_rating, :float
add_column :roads, :twistiness_raters, :integer
add_column :roads, :scenery_rating, :float
add_column :roads, :scenery_raters, :integer
end
end
|
class IndexController < ApplicationController
def index
@boards = Board.where({player: current_player}).paginate(:page => params[:page], per_page: 15)
end
end
|
class PurchaseTicketsForm
include ActiveModel::Model
attr_accessor :email, :ticket_quantity, :payment_token
validates :email, presence: true
validates :email, format: { with: /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i }, allow_blank: true
validates :ticket_quantity, numericality: { only_integer: true, greater_th... |
# == Schema Information
#
# Table name: salaries
#
# id :integer not null, primary key
# year_0 :integer
# year_1 :integer
# year_2 :integer
# year_3 :integer
# year_4 :integer
# year_5 :integer
# year_6 :integer
# year_7 :integer
# year_8 :integer
# playe... |
class EntryContent < ActiveRecord::Base
acts_as_cached
attr_accessible :content
validates_presence_of :content
end
|
class AddAotmFlagToReview < ActiveRecord::Migration[5.0]
def change
add_column :tweet_reviews, :album_of_the_month, :boolean, default: false
end
end
|
# frozen_string_literal: true
# rubocop:disable Metrics/BlockLength
ENV['RAILS_ENV'] ||= 'test'
require 'active_record'
require 'awesome_print'
require 'bundler/setup'
require 'byebug'
require 'database_cleaner'
require 'factory_bot_rails'
require 'faker'
require 'permissions'
require 'shoulda'
require 'table_print'
... |
# == Schema Information
#
# Table name: runs
#
# id :uuid not null, primary key
# distance_in_meters :decimal(, ) not null
# kcal_minute :decimal(, ) not null
# time_in_seconds :decimal(, ) not null
# created_at :datetime not null
# updated_at ... |
require 'rails_helper'
require 'rspec_api_documentation/dsl'
resource 'Sessions' do
subject(:json_response) { json_response_body }
post '/v1/sessions' do
let(:existing_user) { create :user, password: '123456' }
let(:user) { {} }
with_options(required: true, scope: :user) do |u|
u.parameter :ema... |
require 'gtk3'
require './Classes/Page.rb'
require './Classes/JoueurClass.rb'
require './BaseDeDonnees/FonctionsBDD.rb'
#====== Fenetre score du jeu
class FScore < Page
#Initialise la page
# @param monApp //l'application
# @param header //le titre de la page
# @param anciennePage //Le lien de la dernière... |
require 'test_helper'
class BugTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
def setup
@bug = Bug.create(title: "a title", description: "This is the actual description of our bugs", issue_type: 2, priority: 1, status: 0)
end
test "bug must be valid" do
assert @bug... |
class ChangeProductIdToCookieId < ActiveRecord::Migration
def change
rename_column :orders, :product_id, :cookie_id
end
end
|
# See the DataMapper docs for more info.
namespace :dm do
# ~: rake dm:setup
desc 'Creates a new seeded database'
task setup: ['dm:migrate', 'dm:seed']
# ~: rake dm:upgrade
# Or for a single model:
# ~: rake dm:upgrade[model_file_name]
desc 'Auto upgrade the database based on models, non-destructive'
task :... |
FactoryGirl.define do
factory :site do
name "Cosmopolitan Apartments"
address_1 "250 6th St E"
city "St. Paul"
state "MN"
zip_code "55101"
property_type "Commercial"
end
end
|
class MenuPage < SitePrism::Page
# MAPEAMENTO DE ELEMENTOS
element :uniforme_gerencial_link, "a[id*='uniformeGerencial']"
element :uniformes_link, "a[id*='DadosServidor:uniforme']"
element :uniformes_professor_link, "a[onclick*='campanhaDeProfessor']"
element :camp_prof_input, "input[id='campanha... |
require 'spec_helper'
feature 'Organization admin adds phases dates to challenge' do
scenario 'from the dashboard' do
organization = create :organization
challenge = create :challenge, organization: organization
sign_in_organization_admin(organization.admin)
visit edit_dashboard_challenge_path(chall... |
class RemovePartySizefromUser < ActiveRecord::Migration[5.0]
def self.up
remove_column :users, :party_size
end
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.