text stringlengths 10 2.61M |
|---|
class PagesController < ApplicationController
skip_before_action :authenticate_user!, only: :home
skip_after_action :verify_authorized, only: :home
def home
@musicians = User.all
end
end
|
class CreateTasks < ActiveRecord::Migration[5.1]
def change
create_table :tasks do |t|
t.string :title , null: false, limit: 20
t.datetime :line
t.text :memo , limit: 500
t.string :priority
t.string :status
t.string :label1
t.string :label2
t.integer :userId
t... |
require './lib/discounts_page'
require './lib/discount_parser'
# Parses discount type by rules specified in config
class DiscountTypeParser
attr_reader :config
def initialize(config)
@config = config
end
def call
puts "DiscountTypeParser: started parsing #{config[:url]}"
discounts = page.discount... |
require 'rails_helper'
RSpec.describe Task, :type => :model do
it { should validate_presence_of :mailchimp_list_uid }
it { should validate_presence_of :position }
it { should validate_presence_of :name }
it { should validate_presence_of :mission }
end
|
#Source: http://kurtstephens.com/node/34
# Helps with date-intensive activities by about 15%
require 'inline'
class Fixnum
inline do | builder |
builder.c_raw '
static
VALUE
gcd(int argc, VALUE *argv, VALUE self) {
if ( argc != 1 ) {
rb_raise(rb_eArgError, "wrong number of arguments (%... |
class Admin::AcessoController < ApplicationController
layout 'painel_admin'
before_action :admin_logged_in?
def index
if params[:iduser].present?
@usuario_id = params[:iduser]
@usuario = Usuario.find(@usuario_id)
@usuariocurso = Usuariocurso.select("
usuariocursos.*,
cur... |
require 'simp/cli/config/items/action/set_server_puppetdb_master_config_action'
require_relative '../spec_helper'
describe Simp::Cli::Config::Item::SetServerPuppetDBMasterConfigAction do
before :each do
@files_dir = File.expand_path( 'files', File.dirname( __FILE__ ) )
@tmp_dir = Dir.mktmpdir( File.basena... |
class Laba11Result < ApplicationRecord
validates :happy_numbers_quantity, uniqueness: true
end
|
class Api::ProductsController < Api::ApplicationController
before_filter :hard_authenticate!, only: :likes
def index
@products = Product.filter(params).feed(@current_user).page(params[:page])
end
def show
@product = Product.feed(@current_user).find(params[:id])
end
def likes
@product = Produc... |
class ActiveStore < PStore
def initialize dbname
super(dbname)
end
def create key, value
transaction do db
db[key] = value
end
end
def read key
transaction do db
db[key]
end
end
def update key, value
exist = transaction do db
db[key]
end
abort if exist.nil?
transaction do db
d... |
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "hashicorp/precise32"
config.vm.define :web do |web_config|
# alterei o ip externo para 192.168.10.30
web_config.vm.network "private_network", ip: "192.168.10.30"
# agora o vagrant vai executar auto... |
# frozen_string_literal: true
require 'copilot/protos/cloud_controller_pb'
require 'copilot/protos/cloud_controller_services_pb'
module Cloudfoundry
module Copilot
class Client
class PilotError < StandardError; end
attr_reader :host, :port
def initialize(host:, port:, client_ca_file:, client... |
require "rails_helper"
RSpec.describe MainController do
describe "GET root" do
action { get :root }
context 'then not login' do
it { is_expected.to redirect_to(new_user_session_path) }
end
context 'then logined' do
let(:current_user) { create :user }
before { sign_in(current_user)... |
# RailsSettings Model
class ShopConfig
def self.shop_id
ENV.fetch("SHOP_ID", "motzi")
end
def self.shop
load_config_for_shop_id!(self.shop_id) # perf: reading from disk multiple times per request
end
def self.uses_sidekiq?
self.shop.queue_adapter == "sidekiq"
end
def self.load_config_for_... |
# @param {Integer[]} nums
# @return {Integer}
def max_sub_array(nums)
max_sum = -Float::INFINITY
cur_sum = 0
nums.each do
|num|
cur_sum = cur_sum + num
max_sum = cur_sum if cur_sum > max_sum
cur_sum = 0 if cur_sum < 0
end
max_sum
end
puts max_sub_array [-2,1,-3,4,-1,2,1,-5,4] |
# Problem 4: Largest palindrome product
# A palindromic number reads the same both ways. The largest palindrome made
# from the product of two 2-digit numbers is 9009 = 91 99.
#
# Find the largest palindrome made from the product of two 3-digit numbers.
# This methods compares a given number with the reverse of
# th... |
class SoldDoneController < ApplicationController
def index
#implementation
year = Time.now.year - 2
@implementations = Implementation.where('N = ? AND YEAR(DAT) >= ?', 9, year).order("DAT DESC")
@month_implementations_arr = []
Time.now.year.to_i.downto (Time.now.year - 1).to_i do |year|
if... |
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 :user_interests, dependent: :destroy
has_ma... |
class ApplicationController < ActionController::Base
include Pundit
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
before_action :configure_permitted_parameters, if: :devise_controller?
rescue_from Pundit::NotAuth... |
require 'rest-client'
before do
unless request.path_info.include? '/docs'
authorization_header = request.env['HTTP_AUTHORIZATION'].to_s
begin
response = RestClient.get('http://lb/users/by_token', headers={'Authorization' => authorization_header})
rescue RestClient::Unauthorized, RestClient::Forbidd... |
require 'rails_helper'
RSpec.describe User, type: :model do
describe 'validations' do
subject { FactoryBot.create(:user) }
it { is_expected.to validate_presence_of(:email) }
it { is_expected.to validate_presence_of(:name) }
it { is_expected.to validate_uniqueness_of(:email) }
end
describe 'asso... |
class AddIsclosedToIncidents < ActiveRecord::Migration
def change
add_column :incidents, :is_closed, :boolean, default: false
end
end
|
module AdminArea
module CardProducts
class Form < Reform::Form
feature Coercion
property :annual_fee, type: Types::Form::Float
property :bank_id, type: Types::Form::Int
property :personal, type: Types::Form::Bool
property :currency_id, type: Types::Form::Int
property :image
... |
require "snapit/version"
require "snapit/storage"
require "snapit/script"
require "snapit/engine"
module Snapit
def self.run!(path, storage)
res = []
script = Snapit::Script.new(path, storage)
Snapit::Engine.run(script.storage) do |driver|
script.urls.each do |obj|
obj.keys.each do |key|
... |
class BECoding::Command::Right
def execute(rover)
rover.spin_right
end
end |
class ItemsController < ApplicationController
def index
items = Item.all
render json: items
end
# GET /items/1
def show
item = Item.find_by(params[:id])
render json: item
end
# POST /items
def create
# byebug
item = Item.new(item_params)
if item.save
render json: ... |
# frozen_string_literal: true
# Rating contains format for rating validation
class Rating
FORMAT = {
numericality: {
greater_than_or_equal_to: MIN_RATING,
less_than_or_equal_to: MAX_RATING,
only_float: true
}
}.freeze
end
|
require 'spec_helper'
describe Request do
context 'factories', factory: true do
it { create(:request).should be }
it { create(:active_request).should be }
it { create(:declined_request).should be }
it { create(:closed_request).should be }
it { create(:blocked_request).should be }
end
descr... |
class GetEpisodesJob < ActiveJob::Base
queue_as :get_episodes
rescue_from(StandardError) do |exception|
Rails.logger.error "An exception happend #{exception.message}"
end
def perform(podcast)
FetchFeed.new(podcast).fetch
end
end
|
# encoding: utf-8
# This is the source code for require_relative, a Ruby gem that backports that
# particular feature to Ruby 1.8.
#
# Please check out the [README](https://github.com/steveklabnik/require_relative/blob/master/README.md)
# for more information on how to build your own copy of the gem, as well as
# contr... |
Rails.application.routes.draw do
resources :users, except: [:new]
get 'welcome/index'
get 'signup', to: 'users#new'
resources :articles
root 'welcome#index'
end
|
class Room < ActiveRecord::Base
has_many :reservations, dependent: :destroy
end
|
require 'rails_helper'
require 'database_cleaner'
describe "Invoices API" do
describe "GET /invoices" do
it "returns a list of all invoices" do
c1 = Customer.create
c2 = Customer.create
m1 = Merchant.create
m2 = Merchant.create
i1 = Invoice.create(status: "shipped", customer_id: c... |
require File.expand_path("../../spec_helper", __FILE__)
describe GoogleMapsApi do
it "should get directions url" do
url = "http://maps.googleapis.com/maps/api/directions/json"
response = {routes: [{a: 1}]}
query = {"origin" => "Chicago,IL",
"destination" => "Denver,CO", "sensor" ... |
namespace :charts do
task :migrate => :environment do
ChartDoneRatio.delete_all
ChartIssueStatus.delete_all
ChartTimeEntry.delete_all
Journal.all(:conditions => {:journalized_type => "Issue"}, :order => "id asc").each do |journal|
journal.details.each do |detail|
if detail.property == "... |
# encoding: UTF-8
class Admin::PagesController < InheritedResources::Base
before_filter :verify_admin
before_action :authenticate_user!
def create
create! { admin_pages_url }
end
def update
update! { admin_pages_url }
end
private
def collection
@pages ||= end_of_association_chain.paginate... |
class Pantry
attr_reader :stock
def initialize
@stock = Hash.new(0)
# @stock_check = 0
end
def stock_check(ingredient)
@stock[ingredient]
end
def restock(ingredient, amount)
@stock[ingredient] += amount
end
def enough_ingredients_for?(recipe)
# Need to iterate over the ingredie... |
class FrameDescription < ActiveRecord::Base
validates :text, presence:true
validates :kind, presence:true
def self.select_at_random body, kind="full"
descriptions = search(body, kind)
if descriptions.count == 0
raise "No descriptions available for frame(#{kind}) with: "+
"race(#{body.char... |
require 'spec_helper'
describe PostFacade do
subject {PostFacade.new(user)}
let(:user) { "testuser" }
describe "#today_posts" do
let(:result) { subject.today_posts }
it "should return a PostCollectionDecorator" do
expect(result).to be_kind_of PostCollectionDecorator
end
end
describe "#user... |
class CreateCompanies < ActiveRecord::Migration
def change
create_table :companies do |t|
t.string :name
t.string :image
t.text :description_short
t.text :description_long
t.string :web_address
t.string :user_id
t.timestamps null: false
end
end
end
|
class PropertiesController < ApplicationController
before_action :set_property, only: [:show, :edit, :update, :destroy]
def index
@properties = Property.all
end
def show
@station = Station.all
end
def new
@property = Property.new
2.times { @property.stations.build }
e... |
module ActiveRecord
module ConnectionAdapters
module Sqlserver
module Quoting
def quote(value, column = nil)
case value
when String, ActiveSupport::Multibyte::Chars
if column && column.type == :binary
column.class.string_to_binary(value)
... |
class Category < ApplicationRecord
has_many :camp_categories
has_many :camps, through: :camp_categories
end
|
class AddDogColumns < ActiveRecord::Migration[5.2]
def change
add_column :dogs, :sex, :string
remove_column :dogs, :price
end
end
|
require "string_utils"
class Pin < ActiveRecord::Base
belongs_to :member
def to_json(options = {})
result = {}
result[:link] = self.link.purify_uri
result[:title] = self.title.purify_html
result[:created_on] = self.created_on.to_time.to_i
result.to_json
end
end
|
require 'csv'
require 'date'
require 'stringio'
require 'time'
require 'zip'
VpsAdmin::API::IncidentReports.config do
module ParserUtils
def strip_rt_prefix(subject)
closing_bracket = subject.index(']')
return subject if closing_bracket.nil?
ret = subject[(closing_bracket+1)..-1].strip
r... |
class CashRegister
attr_accessor :total, :discount, :cart
def initialize(discount = 0)
@total = 0
@discount = discount
@cart = []
end
def add_item(item, price, quantity = 1)
item_hash = {}
item_hash[:name] = item
item_hash[:price] = price
item_hash[:quantity] = quantity
@ca... |
class ProjectSchemasController < ApplicationController
def index
@project_schemas = ProjectSchema.all
end
def show
@project_schema = ProjectSchema.find(params[:id])
end
def new
@project_schema = ProjectSchema.new
end
def create
@project_schema = ProjectSchema.new(params[:project_schema]... |
class InfantFeedingMonth < ApplicationRecord
has_many :baby_infant_feedings, dependent: :destroy
end
|
require('minitest/autorun')
require('minitest/rg')
require_relative('../customer.rb')
require_relative('../pub.rb')
require_relative('../drink.rb')
require_relative('../food.rb')
class TestCustomer < Minitest::Test
def setup()
@drink1 = Drink.new("Jack Daniels Tennessee Whiskey", 26, 4)
@drink2 = Drink.new(... |
class AddForceMoteurToMachines < ActiveRecord::Migration[5.2]
def change
add_column :machines, :force_moteur, :integer
end
end
|
# == Schema Information
#
# Table name: reviews
#
# id :bigint(8) not null, primary key
# user_id :integer
# restaurant_id :integer
# stars :integer not null
# description :text default(""), not null
# created_at :datetime not null
# updated_at ... |
Then(/^I click the file a dispute link$/) do
on(TransactionsDetailsPage) do |page|
page.wait_for_td_page_load
page.click_first_transaction_dispute_link
end
end
And(/^I should see the dispute confirmation modal$/) do
on(TransactionsDetailsPage) do |page|
page.wait_for_dispute_confirmation_modal
end
... |
# frozen_string_literal: true
require_relative '../rest/utils'
require_relative '../account'
require_relative '../relationship'
module Mastodon
module REST
module Accounts
include Mastodon::REST::Utils
# Retrieve account of authenticated user
# @return [Mastodon::Account]
def verify_cre... |
# frozen_string_literal: true
case expression
[when expression [, expression ...] [then]
code ]...
[else
code ]
end
def get_day(day)
day_name = case day
when 'mon'
'monday'
when 'tue'
'Tuesday'
when 'wed'
'Wednsday'
... |
class Admin::ContentsController < Admin::BaseController
before_filter :load_page
before_filter :load_row
before_action :set_content, only: [:edit, :destroy]
def new
load_contents_if_needed
@content = @row.contents.new
respond_with(:admin, @page, @row, @content)
end
def edit
end
def creat... |
class Ivent < ApplicationRecord
belongs_to :user
has_many :photos
validates :ivent_title, presence: true, length: { maximum: 30 }
validates :ivent_content, presence: true, length: { maximum: 100 }
def self.search(search) #self.でクラスメソッドとしている
if search # Controllerから渡されたパラメータが!= nilの場合は、titleカラムを部分一致... |
require 'test_helper'
class CallthroughTest < ActiveSupport::TestCase
def setup
# Basic setup of a new system
#
germany = Country.create(:name => "Germany", :country_code => "49", :international_call_prefix => "00", :trunk_prefix => "0" )
Language.create(:name => 'Deutsch', :code => 'de')
AreaCo... |
class CreateCategoryAssociation < ActiveRecord::Migration[5.0]
def change
remove_column :categories, :category_id
add_reference :categories, :category, index:true
end
end
|
# coding: utf-8
# frozen_string_literal: true
# This file is part of IPsec packetgen plugin.
# See https://github.com/sdaubert/packetgen-plugin-ipsec for more informations
# Copyright (c) 2018 Sylvain Daubert <sylvain.daubert@laposte.net>
# This program is published under MIT license.
module PacketGen::Plugin
# Mix... |
class GamesController < ApplicationController
def new
@letters = []
alphabet = ('A'..'Z').to_a
10.times { @letters.push << alphabet[rand(26)] }
@letters = @letters.join
end
def score
raise
@attempt = params[:attempt]
@letters = params[:letters].split('')
if not_valid?(@attempt, @l... |
class Article < ActiveRecord::Base
belongs_to :user
validates :title ,presence:true ,length: {minimum: 3,maximum: 50}
validates :description ,presence:true ,length: {minimum: 10,maximum: 5000}
has_many :article_categories
has_many :categories, through: :article_categories
end |
Rails.application.routes.draw do
get '/register', to: 'rendezvous_registrations#new'
get '/registration-welcome', to: 'rendezvous_registrations#welcome'
resources :pictures, except: [:index]
get '/gallery', to: 'pictures#index'
get '/t-shirt-gallery', to: 'pictures#t... |
module Mahjong
class Game
attr_accessor :player1
attr_accessor :player2
attr_accessor :player3
attr_accessor :player4
attr_accessor :players
def initialize(**args)
@players = args[:players]
@player1 = args[:players][0]
@player2 = args[:players][1]
@player3 = args[:play... |
class EmailDigestNotificationWorker < BaseWorker
def self.category; :notification end
def self.metric; :email_digest end
def perform(user_id, job_token)
perform_with_tracking(user_id, job_token) do
user = User.find(user_id)
# Only send the digest if the user has been unavailable the entire time ... |
class TimeTrack < ApplicationRecord
belongs_to :user
scope :created_desc, -> { order(created_at: :desc) }
scope :order_sleep, -> { order("-(#{TimeTrack.table_name}.wakeup_at - #{TimeTrack.table_name}.sleep_at)") }
scope :in_last_week, -> { where("created_at >= ?", 7.days.ago.beginning_of_day) }
def sleep_ti... |
class AddLastUpdatedByToJournalArticles < ActiveRecord::Migration
def change
add_column :journal_articles, :last_updated_by, :integer
end
end
|
# LTEsim Parameter Module
#
# Copyright Ericsson AB 2013.
#
# This example shows how to setup and retrieve configuration parameters for LTEsim.
#
#
# Module that contains functions for retrieving configuration values for the LTEsim components.
#
# Copy this file to your home directory with a different name and edit th... |
require('minitest/autorun')
require_relative('./library')
require('minitest/rg')
class TestLibrary < MiniTest::Test
def setup
@volumes = {
title: "lord_of_the_rings",
rental_details: {
student_name: "Jeff",
date: "01/12/16"
}
}
end
def test_book_list
library = Libr... |
class Task < ApplicationRecord
belongs_to :user
validates :name,presence: true
validates :start_time,presence: true
validates :end_time,presence: true
end
|
class OrdersController < ApplicationController
before_action :set_order, only: [:show, :edit, :update, :destroy]
def express_checkout
package = Package.find(params[:id])
response = EXPRESS_GATEWAY.setup_purchase(package.price,
ip: request.remote_ip,
return_url: new_order_url(package_id: package... |
require 'test_helper'
class FullcalendarRailsTest < ActiveSupport::TestCase
def setup
@app = Dummy::Application
end
test "fullcalendar.js is found as an asset" do
assert_not_nil @app.assets["fullcalendar"]
end
test "jquery-ui is found as an asset" do
assert_not_nil @app.assets["jquery-ui"]
... |
class MeasurementDataRenameUrlColumn < ActiveRecord::Migration
def self.up
rename_column :measurement_datas, :url, :uri
end
def self.down
end
end
|
module ReceptionistSessionsHelper
def log_in_receptionist(receptionist)
session[:receptionist_id] = receptionist.id
end
def log_out_receptionist
session.delete(:receptionist_id)
@current_receptionist = nil
end
#Returns the current logged-in user (if any).
def current_receptionist
@current_... |
class CphcCreateUserJob
include Sidekiq::Worker
sidekiq_options queue: :cphc_migration, retry: SimpleServer.env.development?
def perform(facility_id)
facility = Facility.find(facility_id)
# TODO: How do we show the error to the user
OneOff::CphcEnrollment::AuthManager.new(facility).create_user
en... |
class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
has_many :items
has_many :orders
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :validatable
validates :nic... |
class Book < ActiveRecord::Base
belongs_to :category
has_and_belongs_to_many :authors
validates_presence_of :title
validates_presence_of :isbn
end
|
require 'spec_helper'
RSpec.describe "Product", type: :feature, vcr: true do
%w(base insert kit virtual_kit).each do |product_type|
context "type #{product_type}" do
let(:product_class) do
type = Shipwire::Utility.camelize(product_type)
Object.const_get("Shipwire::Products::#{type}")
... |
require 'card_spring'
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :confirmable,
# :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable, :token_authenticatable,
:recoverable, :rememberable, :track... |
require "tty-progressbar"
module IMDb
class Downloader
MIRROR = "ftp://ftp.fu-berlin.de/pub/misc/movies/database"
def self.download(name)
new.download(name)
end
def download(name)
unless File.exists?("data/#{name}.list")
download_file("#{name}.list.gz", "data/#{name}.list.gz")
... |
class Api::ItemsController < ApplicationController
def create
@item = Item.new(item_params)
if @item.save
render "api/items/show"
else
render json: @item.errors.full_messages, status: 422
end
end
def item_params
params.require(:item).permit(:name, :item_number, :description, :ima... |
class Main
helpers do
def current_account
@account ||= User.find_by_username( params[:username] ) || AnonymousUser.new
end
end
get '/' do
redirect '/everyone'
end
resource 'everyone' do |everyone|
everyone.index do
@items = current_account.items.latest.paginate(page: params[:pag... |
class MessagesController < ApplicationController
before_action :load_messages, only: %i[index create]
before_action :build_message, only: %i[index create]
def index
end
def create
message = current_user.messages.build(params_create)
if message.save
ActionCable.server.broadcast('room_channel',... |
FactoryBot.define do
factory :observation do
id { Faker::Number.unique.number }
encounter_id { SecureRandom.uuid }
observable_id { SecureRandom.uuid }
observable_type { "BloodPressure" }
user_id { SecureRandom.uuid }
created_at { Time.now }
updated_at { Time.now }
end
end
|
$LOAD_PATH.push File.expand_path("../lib", __FILE__)
require 'version'
Gem::Specification.new do |spec|
spec.name = 'terrazine'
spec.version = Terrazine::VERSION
spec.authors = ['Aeonax']
spec.email = ['aeonax.liar@gmail.com']
spec.summary = %q(Terrazine is a parser of da... |
require 'spec_helper'
module Alf
describe Tuple, '.type' do
let(:heading){ {name: String, status: Integer} }
subject{ Tuple.type(heading) }
it 'returns a subclass' do
expect(subject).to be_kind_of(Class)
expect(subject.superclass).to be(Alf::Tuple)
end
it 'coerces the heading' do
... |
class Event
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::Attributes::Dynamic
field :account_id, type: BSON::ObjectId
field :server_id, type: BSON::ObjectId
belongs_to :account
belongs_to :server
validates_presence_of :account_id
validates_presence_of :server_id
end
|
# frozen_string_literal: true
require 'rails_helper'
def basic_auth(path)
username = ENV['BASIC_AUTH_USER']
password = ENV['BASIC_AUTH_PASSWORD']
visit "http://#{username}:#{password}@#{Capybara.current_session.server.host}:#{Capybara.current_session.server.port}#{path}"
end
RSpec.describe 'フード', type: :system... |
class User < ApplicationRecord
has_many :workouts
has_many :goals
has_many :workout_exercises, through: :workouts
has_many :goal_exercises, through: :goals
has_secure_password
validates :username, :email, presence: true
validates :username, :email, uniqueness: true
end
|
require 'rails_helper'
RSpec.describe User, type: :model do
context 'Validations' do
subject { build(:user) }
it { should validate_presence_of(:username) }
it { should validate_presence_of(:email) }
it { should validate_presence_of(:name) }
end
it 'has a valid factory' do
user = FactoryBot.... |
class Fluentd::Settings::HistoriesController < ApplicationController
include SettingHistoryConcern
def index
@backup_files = @fluentd.agent.backup_files_in_new_order.map do |file_path|
Fluentd::SettingArchive::BackupFile.new(file_path)
end
end
private
def find_backup_file
#Do not use Back... |
module Adminpanel
class Section < ActiveRecord::Base
include Adminpanel::Base
mount_images :sectionfiles
validates_length_of :description,
minimum: 10,
maximum: 10,
allow_blank: true,
if: :is_a_phone?,
message: I18n.t('activerecord.errors.messages.not_phone')
... |
require 'spec_helper'
require 'quaker/tag_filter'
describe Quaker::TagFilter do
describe 'filter' do
let(:spec) {
{
'svc1' => { 'tags' => ['abcd'] },
'svc2' => { 'tags' => ['dddd'] }
}
}
it 'filters services by tag' do
expect(subject.filter spec, ['a*']).to include 'svc... |
class CreateExplanatoryNotesFiles < ActiveRecord::Migration
def self.up
create_table :explanatory_notes_files do |t|
t.string :name
t.integer :bill_id
t.string :path
t.text :beginning_text
t.text :ending_text
t.timestamps
end
add_index :explanatory_notes_files, :bill_... |
module Ricer::Plugins::Paste
class Paste < Ricer::Plugin
trigger_is :paste
permission_is :voice
# has_usage :execute_with_language, '<programming_language> <..text..>'
# def execute_with_language(programming_language)
# end
has_usage '<..text..>'
def execute(content)
execute_up... |
class MZRTouchView < UIImageView
weak_attr_accessor :touch
def defaultTintColor
@color ||= UIColor.colorWithRed(52/255.0, green:152/255.0, blue:219/255.0, alpha:0.8)
end
def defaultImage
@image ||= begin
rect = CGRectMake(0, 0, 60.0, 60.0)
UIGraphicsBeginImageContextWithOptions(rect.size, ... |
Sequel.migration do
change do
create_table :home_characteristics_filters do
primary_key :id
String :bedrooms, :default => ""
String :bathrooms, :default => ""
String :sq_footage, :default => "0"
end
end
end
|
class PrescriptionsController < ApplicationController
def create
@user = current_user
@medication = Medication.last
@prescriptions = PrescriptionsController.create!(user_id: @user.id, medication_id: @medication.id)
render json: @prescriptions
end
def show
@user = current_user
@prescrip... |
require_relative 'acceptance_helper'
feature 'Show questions list', %q{
In order to find interesting question
As an user
I wanted to see all questions
} do
given(:user_own) { create(:user) }
given(:another_user) { create(:user) }
given!(:question) { create(:question, user: user_own) }
scenario "User ca... |
class Event < ApplicationRecord
has_many :participations
has_many :circles, through: :participations
has_many :checks, through: :participations
has_many :errands, through: :participations
has_many :twitter_informations
has_many :webcatalog_informations
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.