text stringlengths 10 2.61M |
|---|
class CustomerAddressesController < ApplicationController
layout 'customer_address'
load_and_authorize_resource
include Trackable
def index
#@customer_addresses = CustomerAddress.all
respond_to do |format|
format.html # index.html.erb
format.json { re... |
#!/usr/bin/env ruby
require 'rubygems'
require 'bundler/setup'
$:.unshift(File.dirname(__FILE__))
require 'TestSetup'
require 'MockPGconn'
require 'RandomThings'
class ConnectionTest < Test
include SqlPostgres
include RandomThings
include TestConfig
include TestUtil
def test_ConnectionNewWrap
Connect... |
#
# Test de la sous-classe PISite::Livre
#
require 'spec_helper'
PISite::set_folder 'test'
describe PISite::Page do
before(:all) do
PISite::set_folder 'test'
end
# -------------------------------------------------------------------
# Classe
# -----------------------------------------------------------------... |
require "openssl"
module SignedXml
class DigestTransform
include DigestMethodResolution
attr_reader :digest
def initialize(method_id)
@digest = new_digester_for_id(method_id)
end
def apply(input)
digest.digest(input)
end
end
end
|
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe DeleteRecurrencesJob, type: :job do
include ActiveJob::TestHelper
before(:each) do
f = FactoryGirl.create(
:transaction,
recurrence: FactoryGirl.create(:recurrence)
)
CreateRecurrencesJob.perform_now(f.class.to_s, f.id.to... |
#--
# Copyright (c) 2013 Michael Berkovich, tr8nhub.com
#
# 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, mo... |
# -*- coding: utf-8 -*-
require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
# dummy classes
module Jpmobile::Mobile
class Docomo; end
class Au; end
class Softbank; end
end
describe Jpmobile::Mobile::Terminfo do
def mock_carrier(carrier, stubs={ })
@mock_carrier = eval("Jpmobile::Mob... |
Serendipities::Application.routes.draw do
get '/auth/:provider/callback', to: 'sessions#create'
get '/logout', to: 'sessions#destroy', as: 'logout'
get '/mapdata', to: 'mapdata#show', as: 'mapdata'
get '/admin', to: 'admin#show', as: 'admin'
get '/journal', to: 'journal#show'
root to: 'homepage#show'
end
|
class Series < ApplicationRecord
has_many :series_tracks, dependent: :destroy
serialize :cars, JSON
default_scope { order(race_type: :desc, license: :desc, name: :asc) }
end
|
require 'test_helper'
class OntologyClassTest < ActiveSupport::TestCase
test "initialization" do
o = Seek::Ontologies::OntologyClass.new RDF::URI.new("http://fish#bob")
assert o.uri.kind_of?(RDF::URI)
assert_equal "http://fish#bob",o.uri.to_s
assert_nil o.description
assert_empty o.subclasses... |
class Comment < ActiveRecord::Base
validates :user_id, :text, :commentable_id, :commentable_type, :presence => true
belongs_to :commentable, :polymorphic => true
end
|
require 'net/http'
require './lib/security/signature'
require './lib/http/client'
require './lib/config/security_config'
require 'cgi'
require 'nokogiri'
module Security
module Firewall
API_VERSION = "1.0"
class NetmagicClient
include Http::Client
def initialize(config)
@config = config
... |
class CreateMedicineBillIns < ActiveRecord::Migration[5.0]
def change
create_table :medicine_bill_ins do |t|
t.string :billcode
t.date :dayin
t.string :supplier
t.date :daybook
t.integer :pmethod
t.float :tpayment
t.float :discount
t.float :tpayout
t.text :rem... |
class Artist
attr_reader :name, :years_experience, :donor
@@all = []
def initialize(name, years_experience, donor)
@name = name
@years_experience = years_experience
@donor = donor
@@all << self
end
def self.all
@@all
end
def paintings
Painting.all.select {|painting| painting.... |
class Api::PostsController < ApplicationController
def index
@posts = Post.all.includes(:author)
.includes(:likes)
.includes(:likers)
.includes(:comments)
.includes(:comment_authors)
if @posts
render :index
else
flash.now[:errors] = ['Nothin... |
#!/usr/bin/env ruby
# :title: PlanR::Application::RepoManager
=begin rdoc
=PlanR Repository Manager
(c) Copyright 2016 Thoughtgang <http://www.thoughtgang.org>
=end
require 'plan-r/repo'
require 'plan-r/application'
require 'plan-r/application/revision_control'
module PlanR
module Application
=begin rdoc
An appl... |
class FontNotoTraditionalNushu < Formula
head "https://github.com/google/fonts/raw/main/ofl/nototraditionalnushu/NotoTraditionalNushu-Regular.ttf", verified: "github.com/google/fonts/"
desc "Noto Traditional Nushu"
homepage "https://fonts.google.com/specimen/Noto+Traditional+Nushu"
def install
(share/"fonts... |
class CreateViewNonMonsters < ActiveRecord::Migration
def self.up
connection.execute('DROP VIEW IF EXISTS non_monsters')
connection.execute <<EOF
CREATE VIEW non_monsters AS
SELECT c.id as card_id,
c.name as name,
c.category as category,
max(case when p.name = '#{Property::Names::PROPERTY... |
Sequel.migration do
change do
create_table(:eips) do
primary_key :id
String :author
String :title
DateTime :created_at
end
end
end
|
FactoryGirl.define do
factory :employee do
name "Example User"
company_id 1
end
end |
require "test/unit"
require "#{File.dirname(__FILE__)}/../code/digit"
require "#{File.dirname(__FILE__)}/../code/digit_panel"
require "#{File.dirname(__FILE__)}/../code/digit_horizon"
class TestSimpleNumber < Test::Unit::TestCase
def test_1
assert_equal("\n @\n @\n\n @\n @\n\n", Digit.new(1).print)
... |
class Car
attr_accessor :model, :year
def initialize(model, year)
@model = model
@year = year
end
def favorito
"Mi auto favorito es un #{@model} del año #{@year}!"
end
end
car = Car.new('Camaro', '2016')
puts car.favorito
car = Car.new('Sti', '2019')
puts car.favorito
car = Car.new('Montero', ... |
class CreateCampaigns < ActiveRecord::Migration
def change
create_table :campaigns do |t|
t.integer :campaign_id
t.string :campaign_category_name
t.integer :campaign_category_id
t.string :campaign_phone
t.string :campaign_name
t.string :campaign_hours
t.string :campaign_r... |
class FollowingsController < ApplicationController
before_action :set_user
def new
current_user.follow_user(@user)
redirect_to user_profile_url({username: @user.username}) and return
end
def destroy
current_user.unfollow_user(@user)
current_user.reload
end
priv... |
require 'rails_helper'
require_relative '../support/devise'
RSpec.describe "/vendors", type: :request do
def valid_attributes
{
vendor: attributes_for(:vendor)
}
end
def invalid_attributes
{
vendor: {
name: "",
}
}
end
describe "GET /" do
login_admin
conte... |
# Filters added to this controller will be run for all controllers in the application.
# Likewise, all the methods added will be available for all controllers.
require_dependency "{RAILS_ROOT}/vendor/plugins/active_rbac/app/helpers/rbac_helper"
class ApplicationController < ActionController::Base
helper RbacHelper
... |
require 'rspec'
require 'tests_practice'
describe "Array Utility Methods" do
subject(:array) { [1, 0, 1, 2, 3, 4] }
let(:array_2d) { [[0, 1, 2], [3, 4, 5], [6, 7, 8]] }
describe "#uniq" do
it "makes a unique array" do
expect(array.uniq).to eq([1, 0, 2, 3, 4])
end
end
describe "#to_sum" do
... |
class WhiteboardsController < ApplicationController
def update
@page = current_user.pages.find(params[:page_id])
@whiteboard = @page.whiteboard
if @whiteboard.nil?
@whiteboard = @page.build_whiteboard(params[:whiteboard])
need_save = true
end
respond_to do |format|
if need_sa... |
#
# Copyright 2013, Seth Vargo <sethvargo@gmail.com>
# Copyright 2013, Opscode, 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
#
# Unl... |
require File.dirname(__FILE__) + '/../spec_helper'
describe UsersController do
fuzzy :users
describe "GET show" do
describe "requesting HTML" do
context 'for a valid user' do
before do
@user = fuzzy_users.create!(:password => "testing", :password_confirmation => "testing")
se... |
require 'spec_helper'
describe "Authentication" do
subject { page }
describe "login page" do
before { visit login_path }
let(:signin) { "Sign in" }
it { should have_selector('h2', text: 'Login') }
it { should have_selector('title', text: 'Login') }
it { should_not have_link('New Project', hr... |
# frozen_string_literal: true
module Decidim
module Opinions
module Admin
# A command with all the business logic when an admin imports opinions from
# a participatory text.
class ImportParticipatoryText < Rectify::Command
# Public: Initializes the command.
#
# form - A ... |
class User < ActiveRecord::Base
# write associations here
has_many :rides
has_many :attractions, :through => :rides
has_secure_password
after_initialize :set_default_role
def mood
if self.nausea > self.happiness
"sad"
else
"happy"
end
end
def set_default_role
self.admin = f... |
module RedmineCharts
module ConditionsUtils
include Redmine::I18n
@@default_types = [ :user_id, :issue_id, :activity_id, "issues.category_id".to_sym ]
def self.default_types
@@default_types
end
def self.from_params(params, options)
conditions = {:project_id => project_and_its_child... |
class Mplayer
include Observable
def initialize(options)
@options = options
# assumes options has :cache, :cache_min, :url
end
def play
return if @options[:stub] # HACK
@player_thread = Thread.new do
player = "mplayer -quiet -cache #{@options[:cache]} " \
"-cache-min #{@o... |
require_relative '00_tree_node'
class Board
attr_reader :grid
def new_grid
Array.new(8) {Array.new(8, PolyTreeNode.new)}
end
def initialize(grid = new_grid)
@grid = grid
end
def populate
@grid.each_with_index do |row, idx|
row.each_with_index do |node,idx2|
node.value = [idx, idx2]
end
end
end... |
class Specialization < ActiveRecord::Base
has_and_belongs_to_many :spells
belongs_to :player_class
has_many :characters
validates :name, presence: true
validates :player_class_id, presence: true
end
|
class ApiIndexRenderer
attr_reader :name, :link_ref, :method_type
def initialize(name, link_ref, method_type)
@name = name
@link_ref = link_ref
@method_type = method_type
end
class << self
def user_api_index
index_arr = []
index_arr << ApiIndexRenderer.new("Sign U... |
class DlsClient
include Singleton
def get(path, *args)
args = merge_args(args)
url = Settings.dls_url.chomp('/')
http_client.get(url + path, args)
end
def head(path, *args)
args = merge_args(args)
url = Settings.dls_url.chomp('/')
http_client.head(url + path, args)
end
private
... |
class ChangeAssetToTasks < ActiveRecord::Migration
def change
change_column :tasks, :asset, :string
end
end
|
#!/usr/bin/env ruby
require 'rubygems'
require 'aws/s3'
require 'date'
DAYS_TO_KEEP_DAILIES = 7
DAY_TO_KEEP_WEEKLIES = "Thursday"
def backup_db
db_name = "qameha_production"
db_user = "qameha"
db_pass = "sarek88260"
db_server = "sqlreadwrite.brightbox.net"
sqlfile = "#{@backup_timestamp}/#{db_name}_dump.s... |
class ChangeJobs < ActiveRecord::Migration
def change
remove_column "jobs", "company"
add_column "jobs", "company_id", :integer
end
end
|
class FontLekton < Formula
head "https://github.com/google/fonts.git", verified: "github.com/google/fonts", branch: "main", only_path: "ofl/lekton"
desc "Lekton"
homepage "https://fonts.google.com/specimen/Lekton"
def install
(share/"fonts").install "Lekton-Bold.ttf"
(share/"fonts").install "Lekton-Ital... |
Gem::Specification.new do |s|
s.name = 'nv_gpu_control'
s.version = '0.1.1'
s.licenses = ['MIT']
s.summary = 'A ruby gem for configuring Nvidia GPUs on a Linux system.'
s.authors = ['nuii0']
s.email = 'nuii0@tuta.io'
s.files = Dir.glob("{bin,lib}/**/*") + %w(README.md)
... |
#
# Be sure to run `pod lib lint NextResponderTextField.podspec' to ensure this is a
# valid spec and remove all comments before submitting the spec.
#
# Any lines starting with a # are optional, but encouraged
#
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|... |
class RemoveDogSmMdLgFromPet < ActiveRecord::Migration[5.0]
def change
remove_column :pets, :dog_lg, :integer
remove_column :pets, :dog_md, :integer
remove_column :pets, :dog_sm, :integer
remove_column :pets, :other, :integer
end
end
|
#!/usr/bin/env ruby
require 'rubygems'
require 'bundler/setup'
$:.unshift(File.dirname(__FILE__))
require 'TestSetup'
require 'RandomThings'
class PgInetTest < Test
include SqlPostgres
include RandomThings
def test
ipAndMask = randomString
assertEquals(PgInet.new(ipAndMask), PgInet.from_sql(ipAndMask)... |
require 'date'
require 'baldr'
require_relative '832_v3050_baldr_grammer'
module Baldr
module Grammer
module Version3050
module Set832
extend self
def structure
STRUCTURE
end
def record_defs
Baldr::Grammar::Version3050::RECORD_DEFS
end
# VERSION = '00403' #versi... |
# encoding: UTF-8
require 'test_helper'
module Whitehall::Uploader
class DetailedGuideRowTest < ActiveSupport::TestCase
setup do
@attachment_cache = stub('attachment cache')
@default_organisation = stub('Organisation', url: 'url')
@line_number = 1
end
def new_detailed_guide_row(csv_dat... |
class Gallery < ActiveRecord::Base
belongs_to :event
has_many :photos, dependent: :destroy
accepts_nested_attributes_for :photos, reject_if: :all_blank
end
|
json.array!(@documents) do |document|
json.extract! document, :id, :name, :comment, :file_location, :created_by_id, :updated_by_id, :project_id_id
json.url document_url(document, format: :json)
end
|
#!/usr/bin/ruby
require 'socket'
# Usage:
# Terminal 1: $ ruby <SERVER_FILE>.rb
# Terminal 2: $ ruby <CLIENT_FILE>.rb
# Note: Both terminal sessions must be in the same directory
server = TCPServer.new(2008)
connection = server.accept
while (input = connection.gets)
puts input
end
|
class AddDefaultsToUsers < ActiveRecord::Migration
def change
remove_column :users, :admin, :boolean
add_column :users, :admin, :boolean, default: false
remove_column :users, :trailblazer, :boolean
add_column :users, :trailblazer, :boolean, default: false
remove_column :users, :points, :inte... |
module Centerstone #:nodoc:
module AssociationExtensions
module DateRanged
def current
containing(Time.now)
end
end
end
end |
class CompaniesOffice
require 'mechanize'
require 'audible'; include Audible;
def search(opts={})
query = opts[:query] || fail("Query is required")
earl = "http://www.business.govt.nz/companies/app/ui/pages/companies/search?mode=standard&type=entities&q=#{query}"
a = Mechanize.new do |agent|
... |
class AddSalePriceToOrderItems < ActiveRecord::Migration
def change
add_column :order_items, :sale_price, :decimal
end
end
|
# As seen in the previous exercise, the time of day can be represented as the number of minutes before or after midnight. If the number of minutes is positive, the time is after midnight. If the number of minutes is negative, the time is before midnight.
# Write two methods that each take a time of day in 24 hour form... |
class Api::V1::OrderEntriesController < Api::V1::BaseController
# skip_before_action :verify_authenticity_token
before_action :logged_in_user_filter, only: [:create, :destroy, :index, :show]
before_action :correct_user_filter, only: [:destroy, :index, :create, :show]
# before_action :admin_user... |
class AddExpirationDateOnInstagramAccessToken < ActiveRecord::Migration[5.2]
def change
add_column :instagram_access_tokens, :expires_at, :string
end
end
|
require File.dirname(__FILE__) + '/../test_helper'
class MessageTest < ActiveSupport::TestCase
api_fixtures
fixtures :messages
EURO = "\xe2\x82\xac" #euro symbol
# This needs to be updated when new fixtures are added
# or removed.
def test_check_message_count
assert_equal 2, Message.count
end
de... |
class SessionsController < ApplicationController
def new
end
def create
user = User.find_by(email: params[:email])
if user.authenticate(params[:password])
session[:user_id] = user.id
flash[:success] = "Successfully Signed In."
redirect_to links_path
else
flash[:alert] = "Uns... |
class ChangeNameImgLinkToImgUrl < ActiveRecord::Migration[5.2]
def change
rename_column :restaurants, :img_link, :img_url
end
end
|
Sequel.migration do
change do
create_table :groups do
primary_key :id
String :type
String :name
String :description
TrueClass :is_joinable
end
create_table :group_members do
primary_key :id
foreign_key :group, :groups
String :user
String :roles
... |
# Base mailer
class ApplicationMailer < ActionMailer::Base
default from: Settings.contact_email
layout 'mailer'
end
|
class RenameRubyVersion < ActiveRecord::Migration
def change
rename_column :versions, :ruby_version, :required_ruby_version
end
end
|
class Account::OrdersController < ApplicationController
before_action :authenticate_user!
def index
@orders = current_user.orders.order("id DESC")
end
def new
end
def pay_with_alipay
@order = Order.find_by_token(params[:id])
@order.set_payment_with!("alipay")
@order.make_p... |
class DocHints < Hobo::ViewHints
#including all the child collections for the aside section here as a reference
#for customization. They cause the <aside> param section in the <def tag="show-page" for="Doc">
#in pages.dryml to be generated, which I'm customizing in views/docs/show.dryml to only
#show aside col... |
require 'spec_helper_acceptance'
test_name 'nfs with stunnel'
describe 'nfs stunnel' do
servers = hosts_with_role( hosts, 'nfs_server' )
clients = hosts_with_role( hosts, 'nfs_client' )
let(:el6_nfs_server) { only_host_with_role(hosts, 'el6_nfs_server') }
let(:el7_nfs_server) { only_host_with_role(hosts, 'el... |
module Exit
EXIT_ERR = 1
def self.exit_err(message)
STDERR.puts message
exit EXIT_ERR
end
end
|
class AddRecurrenceOptionsToEvents < ActiveRecord::Migration[5.0]
def change
add_column :events, :recurrence_options, :string
add_column :events, :recurring_until, :date
end
end
|
# frozen_string_literal: true
class OrdersController < ApplicationController
before_action :set_cart
before_action :authenticate_user!, only: %i[new create]
before_action :set_user
def index
@orders = @user.orders.order(created_at: 'DESC')
@orders = @orders.page(params[:page]).per(1)
if @user.car... |
class SubgroupsController < ApplicationController
# GET /subgroups
# GET /subgroups.json
def index
group = Group.find(params[:group_id])
@subgroups = group.subgroups
end
# GET /subgroups/1
# GET /subgroups/1.json
def show
group = Group.find(params[:group_id])
@subgroup = group.subgroups.fi... |
class RequestsController < ApplicationController
before_action :logged_in_user
before_action :correct_user, only: [:destroy]
before_action :set_request, only: [:show, :destroy]
def index
@requests = Request.paginate(page: params[:page])
end
def new
@request = Request.new
end
def show
@co... |
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe "role lifecycle" do
Chef::Log.init()
Chef::Log.level=:info
before(:all) do
include AzureSpecHelper
connection_params = TEST_PARAMS
@connection = Azure::Connection.new(connection_params)
arbitrary = rand(1000) + 1
@pa... |
########################################################
# Step 1: Establish the layers
# Write a list of the layers here
# driver_IDs
# ride share instances / rides
# date, cost, rider_id, rating
########################################################
# Step 2: Assign a data structure to each layer
# Copy your l... |
class Redaction < ApplicationRecord
mount_base64_uploader :picture, PictureUploader
def as_json(options = {})
super(options.merge({ except: [:created_at,:updated_at] }))
end
end
|
class Character
attr_accessor :hp
attr_accessor :outfit
attr_accessor :damage
attr_accessor :armor
attr_accessor :life
def initialize(hp, damage = 0, armor = 0)
@hp = hp
@damage = damage
@armor = armor
@life = @hp
@outfit = []
end
def revive
@life = @hp
end
def wear_outfit... |
module MyFileModule
class MyFile
def self.create_file(path)
fn=::File.new(path, 'w+')
fn.close
end
#"w+" Read-write, truncates existing file to zero length or creates a new file for reading and writing.
#"a+" Read-write, starts at end of file if file exists, otherwise creates a new file fo... |
require 'rails_helper'
RSpec.describe Tournament::Result do
describe '#initialize'
let (:entry_names) {%i(entry1 entry0 entry8 e_2_10_11_16_20_41)}
let (:entries) {entry_names.map {|nm| FactoryGirl.build(nm)}}
subject {Tournament::Result.new(entries).score_table}
describe '#score_table' do
it {is_exp... |
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
# vim: set fileencoding=utf-8
require 'uri'
require 'rexml/document'
require 'net/http'
class LanguagetoolCorrector
# @@baseuri = "https://languagetool.org:8081/?language=en-US&text="
@@baseuri = "http://localhost:8000/?language=en-US&text="
def correct(text)
tex... |
class BooksController < ApplicationController
before_action :authenticate_user, only: [:create, :update, :index, :destroy]
# TEST : Postman complite
def update
booking = Book.find(params[:id])
if (booking.user = current_user)
if booking.update(booking_params)
render json: booking
els... |
module CommonSetup
def self.included(target)
target.let(:gem_root) { File.expand_path('../..', File.dirname(__FILE__)) }
target.let(:ensure_load_paths_valid) do
<<-RUBY
%w(lib spec).each do |include_folder|
$LOAD_PATH.unshift(File.join('#{gem_root}', include_folder))
end
... |
require_relative "./player"
require_relative "./board"
require 'yaml'
class Game
attr_accessor :player1, :player2, :board, :active_player, :inactive_player
def initialize
@player1 = Player.new('white')
@player2 = Player.new('black')
@board = Board.new
set_board
@active_... |
#!/usr/bin/env ruby
# ^ Syntax hint
desc 'Index related functionality'
namespace :index do
desc 'Reindex indexers'
task :refresh do
Hem.ui.title 'Reindex indexers'
run_command 'bin/magento indexer:reindex', realtime: true, indent: 2
Hem.ui.success('Reindexing complete')
end
end
|
module Mediators::Credentials
class Heroku < Mediators::Base
def initialize(args)
@user_id = args[:user_id]
@token = args[:token]
@refresh_token = args[:refresh_token]
end
def call
message = {
token: @token,
refresh_token: @refresh_token,
}
enc... |
json.array!(@power_orders) do |power_order|
json.extract! power_order, :id, :group_id, :item, :power, :item_url
json.url power_order_url(power_order, format: :json)
end
|
require 'spec_helper'
require 'rails_helper'
feature 'user adds mural;
As a user
I want to add a mural
So that I can share a mural' do
scenario 'user tries to add a mural without being signed in' do
visit root_path
click_link 'Add New Mural'
expect(page).to have_content("You need to sign in or si... |
class User < ActiveRecord::Base
has_secure_password
# This line performs the necessary validation disabled above
validates_presence_of :password, :on => :create
# See clearance's User model for more information
before_validation :normalise_email
validates :password,
presence: true,
on: :create
... |
class Medal < ActiveRecord::Base
belongs_to :challenge
has_many :player_medals
mount_uploader :picture, PictureUploader
end
|
# == Schema Information
#
# Table name: reporter_graphics
#
# id :bigint(8) not null, primary key
# user_id :bigint(8)
# title :string
# caption :string
# source :string
# wire_pictures :string
# section_name :string
# used_in_layout :boolean
# created_at ... |
class PoReceiptMsgsController < ApplicationController
before_action :set_po_receipt_msg, only: [:show, :edit, :update, :destroy]
# GET /po_receipt_msgs
# GET /po_receipt_msgs.json
def index
@po_receipt_msgs = PoReceiptMsg.all
end
# GET /po_receipt_msgs/1
# GET /po_receipt_msgs/1.json
def show
en... |
require 'spec_helper'
describe User do
let(:attributes) {attributes_for(:user)}
describe '.encrypt' do
let(:password) {'welcome1'}
it 'should return hashed password' do
hashed_password = '65e82b6f919141bdcc8a45180660bff9f55c6e13'
salt = 'salty string'
expect( User.encrypt(password,salt)... |
class AddGrowthNumToTrend < ActiveRecord::Migration
def change
add_column :trends, :growth_num, :integer
end
end
|
module CCS::FM
def self.table_name_prefix
'fm_'
end
end
|
require './lib/bike_container'
class Station
include BikeContainer
end
describe BikeContainer do
def fill_station(station)
20.times { station.dock(bike) }
end
let(:bike) { double :bike }
let(:holder) { Station.new }
let(:working_bike) { double :bike, broken?: false}
let(:broken_bike) { double :bike, brok... |
unit_tests do
test "should be able to read build status" do
default_vcr_state do
cassette(:load_pr) do
cassette(:read_build_status) do
cassette(:get_commits_for_branch, :record => :new_episodes) do
PRW.reset_build_status
PRW.unpersist_build_status
PRW.b... |
require 'securerandom'
module Cloudpad
class ConfigBuilder
attr_reader :file, :options
def initialize(file, opts={})
@file = file
@options = opts
@multi_document = false
end
def result
eval(File.read(@file))
rescue => ex
puts "Error processing file #{@file}".red
... |
guard :rspec, cmd: 'bin/rspec' do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/api-blueprint/(.+)\.rb$}) { |m| "spec/api-blueprint/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }
end
|
require 'active_support/core_ext/hash/indifferent_access'
module Shanty
# Public: Config mixin for use with any class which is configurable
module ConfigMixin
def config
@config ||= HashWithIndifferentAccess.new { |h, k| h[k] = HashWithIndifferentAccess.new }
end
end
end
|
class Theme
include ContentManagement::Model
def initialize(shop)
@shop = shop
@name = shop.theme
end
def instance_name
if @name.blank?
@shop.name
else
File.join(@shop.name, "theme_#{@name}")
end
end
def content_root
File.join Rails.root, Settings.sites.root, @shop.cl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.