text stringlengths 10 2.61M |
|---|
require 'rails_helper'
RSpec.describe "form_responses/show", type: :view do
before(:each) do
@form_response = assign(:form_response, FormResponse.create!(
:form => nil
))
end
it "renders attributes in <p>" do
render
expect(rendered).to match(//)
end
end
|
require 'uri'
require 'digest/md5'
module Sword2Ruby
class Utility
#Method to cast a (typically) string value into a boolean value
#===Parameters
#value:: the string value to be cast, e.g. "true" or "no"
#nil_value:: (optional) value to return if value=nil. If not supplied, this will default to fals... |
require_relative '../helper'
class PigeonLauncherTest < Minitest::Test
def test_default_launcher
pid = Pigeon::Launcher.launch(logging: false)
assert pid, "PID should be returned from launcher call"
assert Pigeon::Engine.running?
Pigeon::Engine.stop
assert !Pigeon::Engine.running?
... |
class District < ApplicationRecord
include Sluggable
searchkick
has_many :services
belongs_to :city
validates :name, presence: true, uniqueness: { case_sensitive: true, messsage: 'Nome em uso.' }
validates :city_id, presence: true
def search_data
{ name: self.name,
permalink: self.permalink,... |
#!/usr/bin/env jruby
require 'java'
require 'fileutils'
require 'design'
def dendogram(table)
n = table.size
return Dendogram.new agg_hier_cluster(n, CompleteLinkage.new(TableSimilarity.new(table)))
end
def name_generator(filename)
dirname = File.dirname(filename)
basename = File.basename(filename)
compone... |
require 'rake/clean'
require 'haml'
require 'dotenv'
Dotenv.load
require './config/database.rb'
require './project'
require './file_source'
require './dropbox_source'
require './publisher'
def project_dirname
ENV['PROJECT'] || begin STDERR.puts "PROJECT not set"; exit 1; end
end
def current_user
@user ||= Models:... |
# frozen_string_literal: true
# Singleton class that checks if
# a Redis instance is alive
#:nodoc: all
module EasyMonitor
module Util
module Connectors
require 'singleton'
require 'redis'
class RedisConnector
include Singleton
attr_reader :connection
def initialize
... |
class AddChallongeModuleUrlToCompetition < ActiveRecord::Migration
def change
add_column :competitions, :challonge_module_url, :string, :before => :created_at
end
end
|
class Converter
def initialize(number)
@number = number
end
def to_octal
result = []
until @number.eql?(0)
digit = @number % 8
@number /= 8
result << digit
end
result.join().reverse.to_i
end
end |
class Visit < ApplicationRecord
belongs_to :device
belongs_to :company
belongs_to :department
#belongs_to :service_type
enum visitor_type: [:Vendor, :Guest]
enum visit_entry_type: [:Visit, :Signout]
enum visit_status: [:pre_visit, :current]
def kiosk_payload
visitor_class = visitor_type == "Vendor"... |
# frozen_string_literal: true
require 'test_helper'
module Vedeu
module Cells
describe Empty do
let(:described) { Vedeu::Cells::Empty }
let(:instance) { described.new(attributes) }
let(:attributes) {
{
colour: colour,
name: _name,
position: pos... |
require_relative "lib/cassie_rails/version"
Gem::Specification.new do |s|
s.name = 'cassie-rails'
s.version = Cassie::Rails::VERSION
s.summary = "Rails Integration for Apache Cassandra application support"
s.description = <<-EOS.strip.gsub(/\s+/, ' ')
Rails application support for Apache Cas... |
class Idea < ActiveRecord::Base
has_many :good_points, :order => 'created_at DESC', :dependent => :delete_all
has_many :bad_points, :order => 'created_at DESC', :dependent => :delete_all
has_many :consideration_points, :order => 'created_at DESC', :dependent => :delete_all
validates_presence_of :name
valid... |
$LOAD_PATH.push File.expand_path('../lib', __FILE__)
# Maintain your gem's version:
require 'geopolitical/version'
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = 'geopolitical'
s.version = Geopolitical::VERSION
s.platform = Gem::Platform::RUBY
s.authors ... |
module Panel
class EntriesController < BaseController
before_filter :authenticate_member!
layout 'panel'
def index
@entries = current_user.userable.entries.map { |e| EntryDecorator.new(e) }
end
end
end
|
class CreateNods < ActiveRecord::Migration
def change
create_table :nods do |t|
t.integer :benefactor_id
t.integer :beneficiary_id
t.integer :event_id
t.string :event_type
t.timestamps
end
add_index :nods, :benefactor_id
add_index :nods, :beneficiary_id
add_index :no... |
class ProfilesController < ApplicationController
authorize_resource
before_action :load_profile_with_email
respond_to :html, :js
def me
respond_with @profile
end
private
def load_profile_with_email
@profile = Profile.includes(:user).find_by(user_id: current_user.id)
end
end
|
# product = Product.new()
# product.save
# 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 War... |
class VariablesController < ApplicationController
def create
variable = Variable.new(variable_params)
if variable.save
response = { success: true, variable: {
name: variable.name,
path: variable.path
}}
else
response = { success: false }
end
render json: response
... |
require 'unimidi'
@input = UniMIDI::Input.gets
def print_exception(exception, explicit)
puts "[#{explicit ? 'EXPLICIT' : 'INEXPLICIT'}] #{exception.class}: #{exception.message}"
puts exception.backtrace.join("\n")
end
begin
loop do
midi = @input.gets
puts "midi: #{midi}"
sleep(0.1)
end
rescue Int... |
class RenameColumnTitleinTablePostsToMejenga < ActiveRecord::Migration
def change
rename_column :posts, :title, :mejenga
end
end
|
require './app/data_mapper_setup'
describe Peep do
it "will have a timestamp on creation" do
#I could also have utilised the TimeCop gem.
peep = Peep.create(content: 'Testing 123', time: Time.now)
expect(peep.time.to_s).to eq Time.now.to_s
end
context "Checking that datamapper works" do
let(:user) { ... |
class BookInfo < ApplicationRecord
belongs_to :book, optional: true
mount_uploader :cover, ImageUploader
end
|
class AddTopicIdAndVersionToTopic < ActiveRecord::Migration
def change
add_column :topics, :topic_id, :integer
add_column :topics, :version, :string
end
end
|
class SessionSerializer < UserSerializer
attributes :token_type, :access_token
def token_type
'Bearer'
end
end |
class User < ActiveRecord::Base
authenticates_with_sorcery!
attr_accessor :updating_password
has_many :projects, dependent: :destroy
validates :username,
presence: true,
length: { in: 1..20 },
format: { with: /\A[a-zA-Z0-9_]+\z/i,
message: "Names must have an alphanumeric format!" },
... |
class Market < ActiveRecord::Base
has_many :market_comments
end
|
# coding: utf-8
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "flux_hue/version"
DEV_STUFF = %r{
\A
(
reference/
|
spec/
|
Gemfile
|
[^/]*\.(md|sh)
|
\.
)
}x
Gem::Specification.new do |spec|
spec.name = "flux_hu... |
class Product < ActiveRecord::Base
has_many :orders
has_many :comments
belongs_to :user
validates :name, presence: true
# validates :body, presence: true
# validates :user, presence: true
# validates :product, presence: true
# validates :rating, numericality: { only_integer: true }
validates :price_in_cents, :num... |
require_relative '../../spec/rspec_helper'
require_relative '../../spec/pages/login_page'
require_relative '../../spec/pages/account_page'
describe 'Story#Add_Validations_to_New_Transaction_View_TNGVAA-40_spec.rb' do
include DriverUtility
before(:all) do
initializeConfigurations(BASE_URL)
@logInPage = Log... |
# 33 3C 460615060E 081614 460615060E
# 301,4/6/14,21:06:06,4/6/14 21:06:06,,,,60,Percent,10:00:00,,,,,,,,,,,,,,,,,,,,,,,,ChangeTempBasalPercent,"PERCENT_OF_RATE=60, DURATION=36000000, ACTION_REQUESTOR=pump",12753293982,53119725,90,MiniMed 530G - 551
# 33 46 533414050e 081618 533414050e
# 700,4/5/14,20:52:19,4/5/14 20:... |
class Room < ApplicationRecord
has_many :bookings
has_many :users, through: :bookings
validates :room_type, presence: true, allow_nil: false
validates :room_number, presence: true, numericality: { only_integer: true,
greater_than_or_equal_to: 100, less_than: 1000 }
scope :booked, ... |
# frozen_string_literal: true
require 'rails_helper'
RSpec.feature 'QuizManagements', type: :feature, js: true do
include_context 'login as current_user'
given(:current_user) { create(:user) }
given(:quiz_title) { 'Awesome MGS Quiz' }
given(:quiz_description) { 'Questions about Kojima Hideo' }
given(:questio... |
class Review < ActiveRecord::Base
validates :review_body, :presence => true
validates :dish_id, :presence => true, :numericality => { :only_integer => true }
belongs_to :dish
belongs_to :user
end
|
class RemovePlantTypeFromPlants < ActiveRecord::Migration
def up
remove_column :plants, :plant_type
end
def down
end
end
|
require 'rails_helper'
RSpec.describe District, type: :model do
subject { FactoryGirl.create :district }
it { expect(subject).to be_valid }
end
|
module Payout
module V1
RSpec.describe Card do
let(:token) { 'CTxb2czBhlBrFQSQeabm8bTo' }
describe '::retrieve' do
subject { Card.retrieve(token) }
it { should_request_with(:get, '/v1/cards/%s' % token) }
end # ::retrieve
describe '::tokenize' do
subject { Card.to... |
Rails.application.routes.draw do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
root to: 'static_pages#root'
namespace :api, defaults: {format: :json} do
resources :users, only: [:create, :show]
resource :session, only: [:create, :destroy]
match "/... |
#
# Cookbook Name:: redmine
# Recipe:: default
#
# Copyright 2014, bageljp
#
# All rights reserved - Do Not Redistribute
#
%w(
openssl-devel
readline-devel
zlib-devel
curl-devel
libyaml-devel
ruby20-devel
subversion
ImageMagick
ImageMagick-devel
).each do |pkg|
package pkg do
options "--enabler... |
require "rails_helper"
describe ServiceResponse do
let(:service) {ServiceResponse}
let(:entity) {{some: "thing"}}
let(:error) {"some error"}
describe ".build_success" do
it "returns a successful service response" do
success_response = service.build_success(entity)
expect(success_response.suc... |
module Link
class Window < Gosu::Window
SCREEN_HEIGHT = 700
SCREEN_WIDTH = 700
def initialize
super(SCREEN_HEIGHT, SCREEN_WIDTH, false)
self.caption = 'A Legend of Link'
@player = Player.new(self)
@running = true
@offset = 0
end
def upd... |
# 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... |
# Delegator to convert strings to boolean values in ENV hash
module EnvBooleans
class EnvWrapper < SimpleDelegator
def [](key)
value = super
value_string = value.to_s.downcase
value = EnvBooleans.to_bool(value_string) if value_string == 'true' || value_string == 'false'
value
end
... |
# encoding: utf-8
require 'spec_helper'
describe Castache do
let(:obj) { OpenStruct.new :string => 'Test',
:integer => 42,
:float => 1.0,
:array => [:a,:b,:c],
:hash => {'key'=>'value'},
... |
class Course
include Mongoid::Document
field :route_code, type: String, unique: true
field :route_name, type: String
field :title, type: String
field :university_course_title, type: String
field :degree, type: String
belongs_to :degree_schem... |
namespace :admin do
desc 'Create admin user'
task create: :environment do
require 'highline/import'
begin
email = ask('Email: ')
existing_user = User.find_by_email(email)
# check if user account already exists
if existing_user
admin = existing_user
# user already e... |
Devise.setup do |config|
config.mailer_sender = 'no-reply@krtodolist.herokuapp.com'
require 'devise/orm/active_record'
config.case_insensitive_keys = [ :email ]
config.strip_whitespace_keys = [ :email ]
config.skip_session_storage = [:http_auth]
config.stretches = Rails.env.test? ? 1 : 10
config.re... |
require "fog/core/model"
module Fog
module Compute
class Brkt
class Network < Fog::Model
# @!group Attributes
identity :id
attribute :cidr_block, :aliases => [:cidr, "cidr"]
attribute :name
attribute :description
attribute :computing_cell
attri... |
class User < ActiveRecord::Base
has_many :uploads, class_name: "Video", foreign_key: "uploader_id"
has_many :descriptions, foreign_key: "writer_id"
has_many :notifications
validates :username, uniqueness: true,
presence: true
validates :email, uniqueness: true,
presence: true,
format: { with: /\w... |
class ComponentStatusTransition < ActiveRecord::Base
belongs_to :component
after_create :publish
private
def publish
redis = Redis.new
redis.publish "crier:transitions", self.to_json
end
end
|
require 'helper'
class TestMLP < Test::Unit::TestCase
should "contain 4 layers" do
a = MLP.new(:hidden_layers => [2, 2, 2], :output_nodes => 2, :inputs => 2)
assert_equal 4, a.inspect.size
end
should "create an output neuron with 3 weights" do
a = MLP.new(:hidden_layers => [2], :output_nodes =>... |
require "rails_helper"
describe "As an admin" do
describe "when on admin kids show" do
it "can add a user to view kid" do
admin = create(:admin)
kid = create(:kid)
admin.kids << kid
user = create(:user)
allow_any_instance_of(ApplicationController).to receive(:current_user).and_retu... |
# 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... |
class Inventory < ApplicationRecord
self.table_name = "inventory"
has_many :rental #1
belongs_to :film #3
belongs_to :customer #4
belongs_to :rental_pending
end
|
class Importer::BostonRetirementSystem < Importer::Importer
def self.import_all
parser = Parser::BostonRetirementSystem.new("data/boston_retirement_system_20200909.csv.gz")
new(parser).import
end
def import
Pension.transaction do
Pension.delete_all
records.each do |r|
import_recor... |
class IaScore < ActiveRecord::Base
belongs_to :student
belongs_to :exam
belongs_to :batch
belongs_to :ia_indicator
validates_numericality_of :mark,:allow_blank=>true
before_save :mark_validation
def mark_validation
if self.mark.to_f > self.ia_indicator.max_mark.to_f
errors.add(:ia_score,"Mark c... |
require 'fog/core'
require 'fog/json'
require 'fog/sakuracloud/compute'
require 'fog/sakuracloud/volume'
require 'fog/sakuracloud/network'
module Fog
module SakuraCloud
extend Fog::Provider
SAKURACLOUD_API_VERSION = '1.1' unless defined? SAKURACLOUD_API_VERSION
SAKURACLOUD_API_ZONE = "is1b" unless defin... |
module Nokogiri
module XML
class Attr < Node
alias :value :content
alias :to_s :content
alias :content= :value=
end
end
end
|
require 'fileutils'
require 'json'
module Spec
module Builders
def write_puppetfile(*modules)
repo_base = tmp('repos')
File.open(workdir.join('Puppetfile'), 'w') do |p|
modules.each do |module_name|
p.write <<EOT
mod '#{module_name}', :git => 'file://#{repo_base}/#{module_name}.git... |
module Kickstarter
module DailyReports
class BuildDailyReportJob < ApplicationJob
queue_as :daily_scrapers
def perform(campaign_id)
campaign = Campaign.find(campaign_id)
Builders::BuildDailyReportService.new(campaign).call
end
end
end
end
|
class StarsController < ApplicationController
def add_star
params.require(:id)
unless user_signed_in?
render status: 500 and return
end
project_id = params[:id]
user_id = current_user.id
Star.create!(user_id: user_id, project_id: project_id)
render status: 200, text: "success"
... |
# == Schema Information
#
# Table name: chapters
#
# id :bigint not null, primary key
# title :string
# description :string
# content :text
# history_id :bigint
# created_at :datetime not null
# updated_at :datetime not null
#
class Chapter < ApplicationRecord
b... |
require "spec_helper"
describe Bowling do
context "when validate is defined" do
let(:dummy_class) {
Class.new(described_class) do
METRICS_NAMESPACE = "ExtendedClass.Metrics.namespace"
end
}
it "does nothing" do
dummy_class
end
end
end |
class CreateTriedRecipes < ActiveRecord::Migration
def change
create_table :tried_recipes do |t|
t.integer :cook_id
t.integer :recipe_id
t.date :date_tried
t.timestamps
end
end
end
|
# frozen_string_literal: true
require "concurrent/promise"
module Dry
module Monads
# Lazy is a twin of Task which is always executed on the current thread.
# The underlying mechanism provided by concurrent-ruby ensures the given
# computation is evaluated not more than once (compare with the built-in
... |
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.0', '>= 5.0.0.1'
# Use postgresql as the database for Active Record
gem 'pg', '~> 0.18'
# Use Puma as the app server
gem 'puma', '~> 3.0'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglif... |
module ErbSafety
class Error
attr_reader :token, :erb, :message
def initialize(token, erb, message)
@token = token
@erb = erb
@message = message
end
def to_s
<<-EOF
Found: #{@message}
#{@token}
The unsafe interpolation is:
#{@erb.parts.join.inspect}
EOF
end
end
... |
class Route < ApplicationRecord
belongs_to :destination, class_name: 'Station'
belongs_to :origin, class_name: 'Station'
# this should make sure that no route is entered in twice
validates_uniqueness_of :origin_id, :scope => :destination_id
end
|
class AddTamanhoToMatricula < ActiveRecord::Migration
def change
add_column :matriculas, :tamanho, :string, :size => 3
end
end |
class ReviewsController < ApplicationController
def new
@review = Review.new
@product = Product.find(params[:product_id])
end
def create
@review = Review.new(review_params)
@product = Product.find(params[:product_id])
@review.product = @product
@review.save
redirect_to product_path(@... |
# frozen_string_literal: true
require 'http'
class EventFetcher
class Error < StandardError; end
def initialize(url)
@url = url
end
def get
response = HTTP.get(url)
return JSON.parse(response.body) if response.status.success?
raise JSON.parse(response.body).fetch('message', 'Invalid request... |
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
Rails.application.load_tasks
task :package do
changed_files = `git status --porcelain`.split("\n"... |
require_relative "transaction"
class Customer
attr_reader :name
@@customers = []
def initialize(options={})
@name = options[:name]
add_to_customers
end
def self.find_by_name(name)
@@customers.find {|x| x.name == name}
end
def self.all
@@customers
end
def purchase product
Tran... |
class PagesController < ActionController::Base
LAYOUTS = {
help: 'help'
}
def show
render params[:page], layout: LAYOUTS[params[:page].to_sym] || 'application'
end
end
|
# frozen_string_literal: true
require "dry/logic/builder"
RSpec.shared_examples "built rule" do |rule_type, *args|
subject(:built_rule) { Dry::Logic::Builder.call(&expression) }
let(:rule_type) { rule_type }
case rule_type
when :predicate
include_examples "built rule predicate", *args
else
include_... |
class Vector
attr_accessor :x, :y
def initialize(x,y)
@x=x
@y=y
end
def to_s
"(#{@x},#{@y})"
end
def length
Math.sqrt(@x**2+@y**2)
end
def add(v)
x=@x+v.x
y=@y+v.y
Vector.new(x,y)
end
end
|
class Module # define deprecation api
DEPS = Hash.new { |h,k| h[k] = {} }
def tu_deprecation_warning old, new = nil, kaller = nil
kaller ||= caller[1]
unless DEPS[old][kaller] then
msg = "#{self}##{old} deprecated. "
msg += new ? "Use ##{new}" : "No replacement is provided"
msg += ". From... |
def create_spec_tasks
require 'spec/rake/spectask'
desc "Run the specs"
Spec::Rake::SpecTask.new do |t|
t.spec_opts = ['--options', "spec/spec.opts"]
t.spec_files = FileList['spec/**/*_spec.rb']
end
namespace :spec do
desc "Run all specs in spec directory with RCov"
Spec::Rake::SpecTask.new(:... |
require 'rails_helper'
RSpec.feature "User can delete an artist" do
scenario "they can delete an existing artist" do
artist = Artist.create!(name: "Crayon Pop", image_path: "ohyeah.jpg")
visit artists_path
click_on("Crayon Pop")
click_on "Delete"
expect(current_path).to eq artists_path
expe... |
# frozen_string_literal: true
require "spec_helper"
module Decidim
module Opinions
describe NotifyOpinionsMentionedJob do
include_context "when creating a comment"
subject { described_class }
let(:comment) { create(:comment, commentable: commentable) }
let(:opinion_component) { create(:... |
# -*- coding: utf-8 -*-
# Url 関係設定.
module OpensocialWap
module Config
class Url
def self.configure(*args, &block)
new(*args).tap{|o|o.instance_eval(&block)}
end
def initialize(context = nil)
@context = context
end
def container_host(host = nil)
if host
... |
class CreateReasons < ActiveRecord::Migration
def change
create_table :reasons do |t|
t.integer :t_id
t.string :question
t.string :title
t.text :description
t.integer :score
t.boolean :is_pro
t.string :correct_answer
t.string :wrong_answer1
t.string :wrong_ans... |
class UserMailer < ApplicationMailer
default from: 'plataformamillas@gmail.com'
def welcome_email
@user = params[:user]
mail(to: 'jerrysebastianlagosc@gmail.com', subject: 'Welcome to My Awesome Site')
end
end
|
class User
include Mongoid::Document
include Mongoid::Timestamps
include ActiveModel::SecurePassword
field :name, type: String
field :email, type: String
field :password_digest, type: String
field :updated_at, type: Time
field :remember_token, type: String
field :admin, type: Boolean, :default => fa... |
class AddGenerationToPokemon < ActiveRecord::Migration[5.2]
def change
add_column :pokemons, :generation, :string
end
end
|
class ParatureFaqQuery < Query
def initialize(options)
super
@question = options[:question].downcase if options[:question].present?
@answer = options[:answer].downcase if options[:answer].present?
@q = options[:q].downcase if options[:q].present?
@update_date = options[:update_date] if options[:u... |
require_relative 'card'
class Deck < Card
attr_reader :cards
def self.build_deck
all_cards = []
SUITS.each do |suit, sym|
VALUES.each do |name, value|
all_cards << Card.new(name, suit)
end
end
all_cards
end
def initialize(cards = Deck.build_deck)
@cards = cards
end... |
Pod::Spec.new do |s|
s.name = 'OpenWhisk'
s.version = '0.1.4'
s.summary = 'Mobile SDK to use OpenWhisk server-less environment'
s.license = { :type => 'Apache License, Version 2.0' }
s.authors = 'IBM'
s.description = <<-DESC
OpenWhisk is a cloud-first distributed event-based programming ... |
class Company < ActiveRecord::Base
extend FriendlyId
has_many :jobs
belongs_to :user
friendly_id :slug_candidates, use: [:slugged, :finders]
validates :name, presence: true
validates :information, presence: true
def slug_candidates
[
:name,
[:name, :id]
]
end
def should_generat... |
# frozen_string_literal: true
class UniformNotifier
class JavascriptConsole < Base
class << self
def active?
!!UniformNotifier.console
end
protected
def _inline_notify(data)
message = data.values.compact.join("\n")
options = UniformNotifier.console.is_a?(Hash) ? ... |
class UserMailer < ActionMailer::Base
default from: "adminteam@rottenmangoes.com"
def user_delete_notification(user)
@user = user
mail(to: @user.email, subject: "Account Deletion Yo!")
end
end
|
require File.dirname(__FILE__) + '/test_helper'
class CampfireNotifierTest < Test::Unit::TestCase
def setup
CruiseControl::Log.stubs(:debug)
CruiseControl::Log.stubs(:warn)
@notifier = CampfireNotifier.new
@notifier.subdomain = 'sub'
end
def test_connect_should_true_for_valid_login_and_room
... |
require 'sinatra/json'
require_relative '../model/cart'
require_relative '../lib/errors/mongo_errors'
require 'byebug'
module CartService
module Endpoints
# Module representing GET /:id endpoint
module GetCart
def self.registered(app)
app.get '/:id' do
begin
@cart = Cart.f... |
#!/usr/bin/env ruby
exit if ARGV.size == 0
require 'stringio'
def getio; StringIO.new `top -l 3 -stats pid,command,cpu,time,ports -n 10`; end
io = getio
class Object
def identity
self
end
end
class Array
def from_match(match, transformation = :identity)
hash = {}
transformation = [transformation].... |
class AddHomeworksToAssignments < ActiveRecord::Migration
def change
add_column :assignments, :homework, :text
end
end
|
# Virus VirusPredictor
# I worked on this challenge [by myself, with: only the guide].
# We spent [1] hours on this challenge. But he gave great directions which helped me finish by myself and I spent more [3] hours
# EXPLANATION OF require_relative
#
#
# It is a method to show the path to link a external... |
# -*- encoding: utf-8 -*-
require File.expand_path('../lib/enumerative/version', __FILE__)
Gem::Specification.new do |gem|
gem.authors = ["Nils Jonsson", "C. Jason Harrelson"]
gem.email = ["ninja.loss@gmail.com"]
gem.description = %q{Tools for defining and using enumerations.}
gem.summary ... |
class FlipsController < ApplicationController
before_action :authenticate_user!
load_and_authorize_resource :work
before_action -> { @user = current_user }
def new
end
def create
flash.keep(:alert)
@flip = @work.flips.new
@flip.user = @user
@flip.save
respond_with @flip
end
def s... |
# frozen_string_literal: true
require "rails_helper"
describe "search relevance", type: :feature, js: true do
context "when searching for a specific collection by keyword" do
before do
visit "/?q=james+baker&search_field=all_fields&group=true"
end
it "ranks results with the keyword in the collecti... |
# frozen_string_literal: true
module Application
class Request
attr_reader :connection, :data, :result
attr_reader :id, :action_name
def initialize connection, message
@connection = connection
@data = (JSON.parse message rescue nil)
@data = nil unless Hash === @data
if data
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.