text stringlengths 10 2.61M |
|---|
class ChangeTableBannerToPixels < ActiveRecord::Migration
def change
rename_table :pixel, :pixels
end
end
|
require 'rails_helper'
describe 'Account history' do
let(:user) { create(:user, :signed_up) }
let(:account_created_event) { create(:event, user: user) }
let(:identity_with_link) do
create(
:identity,
:active,
user: user,
service_provider: 'http://localhost:3000'
)
end
let(:ide... |
# == Schema Information
#
# Table name: push_notifications
#
# id :integer not null, primary key
# user_id :integer not null
# registration_id :string(255)
# token_type :string(255) not null
# created_at :datetime
# updated_at :datetime
#
# Indexes
#
# i... |
#######################################################################
# The Song class is the model for holding information about a song
# which belongs to an Artist and can be contained in an Album.
#######################################################################
class Song < ActiveRecord::Base
## RELATION... |
class Expense < ActiveRecord::Base
belongs_to :company
has_many :expense_products , :dependent => :destroy
accepts_nested_attributes_for :expense_products , :reject_if => lambda { |a| a[:unit_cost_price].blank? || a[:quantity].blank? }, :allow_destroy => true
validates_associated :expense_products
vali... |
require 'spec_helper'
describe "/transactions/show.html.erb" do
include TransactionsHelper
before(:each) do
view_as_user :communicator
assigns[:transaction] = mock_transaction
mock_transaction.stub \
:title => "value for title",
:name => "value for name",
:definition => moc... |
#! /usr/bin/env ruby -S rspec
require 'spec_helper'
describe 'the dns_cname function' do
let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
it 'should exist' do
expect(Puppet::Parser::Functions.function('dns_cname')).to eq('function_dns_cname')
end
it 'should raise a ArgumentError if there is less th... |
class MfaController < ApplicationController
before_filter :check_user
def create #this function is called when we register the MFA information that was entered by the user (type (sms, voice or google authenticator) and phone number if applicable, nickname)
mfa_type = params[:type]
nickname = params[:nick... |
class Api::V1::FacebookEventsController < ApplicationController
include EnsureToken
include Cors
def index
render json: ::FacebookClient.new.get_events(area: params[:area] || 'dresden', sort_by_date_desc: true)
end
alias_method :facebook_events_for_frontend, :index
private
# for EnsureToken
def ... |
class Post < ActiveRecord::Base
attr_accessible :state, :priority, :text, :author_id
belongs_to :author
scope :approved, where(:state => "approved")
profanity_filter! :text, :method => 'stars'
end
|
class AppearanceController < ApplicationController
def create
Appearance.create!(climb: Climb.find(appearance_params[:climb_id]), tick_list: TickList.find(params[:tick_list_id]))
render nothing: true
end
def destroy
current_user.tick_lists.find(params[:tick_list_id]).appearances.where("climb_id = ?", params[... |
# frozen_string_literal: true
require 'rails_helper'
feature 'Stocks #index', js: true do
let(:user) { create(:user) }
let!(:stock) { create_list(:stock, 3, user: user) }
let(:last_stock) { user.stocks.first.decorate }
context 'when user signed in' do
before do
sign_in user
visit s... |
require 'json'
require 'gibbon'
require_relative '../hash'
require_relative '../articles'
module Campaign
class Base
LIST_ID = "4d1f7a5fc6"
TEMPLATE_ID = 59409
FROM_NAME = "Utisak"
REPLY_TO = "aleksandar@utisak.com"
def initialize(options = {})
@debug = options.fetch(:debug, false)
@... |
Rails.application.routes.draw do
devise_for :users
root to: 'pages#home'
get '/profile', to: 'pages#profile'
get '/coming_soon', to: 'pages#coming_soon'
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
resources :users, only: [:index, :show, :edit, :update... |
# frozen_string_literal: true
# Copyright (C) 2022 Liane Hampe <liaham@xmera.de>, xmera.
require File.expand_path('test_helper', File.dirname(__dir__))
require File.expand_path('with_drawio_settings', File.dirname(__dir__))
module RedmineDrawio
class DrawioSettingsHelperTest < ActiveSupport::TestCase
include R... |
class Game
attr_reader :word, :game_word, :display_word, :game_over, :used_words
def initialize(word)
@word = word
start
end
def set_game_word
@game_word = @word.split(//)
end
def set_display_word
@display_word = Array.new(@game_word.size)
@display_word.map! { |e| "_" }
end
def c... |
module ProcessEngine
class Engine < ::Rails::Engine
isolate_namespace ProcessEngine
config.after_initialize do
# check after initialization to make sure that the implemented
# specs are are in accordance with required methods
ProcessEngine::NodeDataInjection.implementation_check
end
... |
class Shoot
SPEED = 5
attr_reader :x, :y, :radius
def initialize(window, x, y, angle)
@x = x
@y = y
@direction = angle
@image = Gosu::Image.new('images/beam1.png')
@radius = 3
@window = window
end
def move
@x += Gosu.offset_x(@direction, SPEED)
@y += Gosu.offset_y(@direction, SPEE... |
# encoding: UTF-8
require "openid"
require 'openid/extensions/sreg'
require 'openid/extensions/ax'
require 'openid/store/interface'
module OpenID
# also request email
class YavaConsumer < Consumer
def initialize session
super(session, Store::DbStore.new)
end
def redirect_url identifier, host, p... |
class BusesController < ApplicationController
# before_action :set_points, only: [:index]
def index
@q = Bus.ransack(params[:q])
@buses = @q.result(distinct: true)
end
def new
@bus = Bus.new
end
def create
@bus =Bus.new(bus_params)
@bus.available = params[:capacity]
@bus.reserved =0
if @bus.save
... |
class Registrant < ActiveRecord::Base
attr_accessible :login, :avatar_url, :gravatar_id, :name, :company, :blog, :location, :email
def name_or_login
name.blank? ? login : name
end
end |
require 'spec_helper'
module Anticipate
describe Anticipator do
before do
@sleeper = mock("sleeper")
@sleeper.stub!(:sleep)
@anticipator = Anticipator.new(@sleeper)
end
describe "#anticipate" do
describe "when the block eventually stops raising a StandardError" do
... |
class BookSerializer < ActiveModel::Serializer
attributes :id, :title, :author, :description, :cover_url, :complete_date, :review_url, :affiliate_url
root :books
end
|
module Clearance
module Constraints
class SignedIn
def initialize(&block)
@block = block || lambda { |user| true }
end
def matches?(request)
@request = request
signed_in? && current_user_fulfills_additional_requirements?
end
private
def current_user
... |
# frozen_string_literal: true
# Changing transfer status require an email
# This object encapsulates that
class ChangeTransferStatus
attr_reader :transfer, :user
def initialize(transfer, user)
@transfer = transfer
@user = user
end
def perform(new_status)
# calls transfer.mark_as_accepted!
# ... |
# 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... |
module ActsAsTaggableOn
module Taggable
module TaggedWithQuery
class AllTagsQuery < QueryBase
def build
taggable_model.joins(each_tag_in_list)
.group(by_taggable)
.having(tags_that_matches_count)
.order(order_condition... |
require 'rails_helper'
RSpec.describe Achievement, type: :model do
describe 'validations' do
# we can remove this :
# it 'requires title' do
# achievement = Achievement.new(title: '')
# # achievement.valid?
# # here is two ways of not allowing the fields to be empty!, if we use the last one then we dont ne... |
require 'test_helper'
require 'sonda_service'
class SondaServiceTest < ActiveSupport::TestCase
setup do
@sonda = Hash.new
$HEIGHT = 5
$WIDTH = 5
$DIRECTIONS = {"U":0, "R":1, "D":2, "L":3}.freeze
end
test "rotate sonda to left" do
@sonda[:direction] = 0
... |
require "scoped_roles/engine"
#require 'active_support/dependencies'
module ScopedRoles
mattr_accessor :role_model
@@role_model = "Role"
mattr_accessor :user_model
@@user_model = "User"
# set the scope for the role model
mattr_accessor :role_scope
@@role_scope = nil
# set the scope for the user mode... |
module Lb
def self.table_name_prefix
'lb_'
end
end
|
module Ricer::Plug::Extender::AbboTriggers
def is_abbo_trigger(options={})
class_eval do |klass|
klass.register_class_variable('@abbo_for_class')
klass.instance_variable_set('@abbo_for_class', options[:for])
def abbo_class; self.class.instance_variable_get('@abbo_for_class'); e... |
# This file was generated by the docusign_rest:generate_config rake task.
# You can run 'rake docusign_rest:generate_config' as many times as you need
# to replace the content of this file with a new config.
require 'docusign_rest'
DocusignRest.configure do |config|
config.username = Rails.application.credent... |
class SessionsController < ApplicationController
def dashboard
@user = User.find(params[:id])
@product = @user.products
@sales_all = Sale.all
@sales = @user.transactions
@sales_sum = @sales.reduce(0){|sum, sale| sum + sale.product.price}
@purchases = @user.sales
@purchase_sum = @purchases.reduce(0... |
class Project < ActiveRecord::Base
belongs_to :level_number
belongs_to :current_phase, foreign_key: :phase_type_id, class_name: 'PhaseType'
belongs_to :user
has_one :program_size, dependent: :destroy
has_one :settings, dependent: :destroy
has_one :historical_data, class: HistoricalDatum
has_one :estima... |
require "tree_graph/version"
module TreeGraph
def tree_graph
TopDown.new(self).tree_graph
end
def tree_graph_bottom_up
BottomUp.new(self).tree_graph
end
def tree_graph_bottom_up_in_same_order
BottomUpInSameOrder.new(self).tree_graph
end
EMPTY_ARRAY = []
class ::Object
def label_for... |
Warden::Manager.after_set_user do |user, auth, opts|
directory = Foldersize.define_folder("#{Rails.root}/uploads/files/#{user.account.id}")
usage = directory.size_in_bytes
user.account.update(storage_usage: usage)
end
|
class PagesController < ApplicationController
def index
@pages = Page.all
end
def new
@page = Page.new
end
def edit
@page = Page.find(params[:id])
end
def update
@page = Page.find(params[:id])
if @page.update(params[:page].permit(:name, :title))
redirect_to pages_url
else
... |
ActiveAdmin.register Store do
index do
selectable_column
column :id
column :name
column :summary
column :stripe_id
column :user
column 'Products' do |store|
link_to store.products.count, admin_store_products_path(store)
end
column 'Shipping profiles' do |store|
link_t... |
require 'test/unit'
require_relative '../lib/forkout'
class TestForkout < Test::Unit::TestCase
def test_1
results = (1..100).to_a.forkout {|i| i*i}
assert_equal 100, results.length
assert_equal 10000, results.max
end
def test_2
results = (1..10).to_a.forkout {|i| i**i}
assert_equal 10, resul... |
require 'test_helper'
class CategoryAnswersControllerTest < ActionDispatch::IntegrationTest
setup do
@category_replay = category_answers(:one)
end
test "should get index" do
get category_answers_url
assert_response :success
end
test "should get new" do
get new_category_replay_url
assert... |
# -*- encoding: utf-8 -*-
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'sprockets-dotjs/version'
Gem::Specification.new do |gem|
gem.name = "sprockets-dotjs"
gem.version = Sprockets::Dotjs::VERSION
gem.authors = ["Le Duc Duy"]
g... |
class RemoveImagePathFromMonsters < ActiveRecord::Migration
def change
remove_column :monsters, :image_path
end
end
|
# Encoding: utf-8
require_relative 'spec_windowshelper'
describe package('Microsoft .NET Framework 4.6.2 SDK') do
it { should be_installed }
end
|
require 'test_helper'
class PackageTest < Minitest::Test
def setup
@weight = 100
@dimensions = [5, 6, 7]
@value = 1299
@currency = "USD"
@cylinder = false
@tube = false
@gift = false
@oversized = false
@unpackaged = false
@dim_units = :metric
@units = :metric
@weight_u... |
class LessonsController < ApplicationController
def index
@lessons = Lesson.where({user_id: current_user.id}).all.map { |l| l }
end
def update
@lesson = Lesson.find(params[:id])
@lesson.update(update_params)
render json: {status: 'ok'}
end
def player_notes
@lesson = Lesson.find(search_p... |
class Place < ActiveRecord::Base
belongs_to :user
reverse_geocoded_by :latitude, :longitude do |place,results|
if geo = results.first
place.street = Place.address_only geo.address, geo.city
place.city = geo.city
place.state = geo.state_code
place.postal_code = geo.postal_code
#... |
Rails.application.routes.draw do
root :to => 'stories#index'
get '/stories/images', to: 'stories#images'
resources :stories do
resources :contributions
end
end
|
require 'spec_helper'
require 'jsonapi/serializers/attributes'
RSpec.describe Jsonapi::Serializers::Attributes do
describe '#serialize' do
it 'always returns a hash' do
attributes = []
data = {}
subject = build_serializer(attributes: attributes)
serialized = subject.serialize(data)
... |
if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'ironruby'
require File.expand_path('helpers', File.dirname(__FILE__))
require File.dirname(__FILE__) + '/testrequest'
require File.dirname(__FILE__) + '/../lib/rack/deploy/aspnet'
context "Rack::Handler::ASPNET" do
include JSONTestRequest::Helpers
include IronRubyRackTe... |
class Player
attr_accessor :resources, :board, :color, :name
def initialize(name)
@name = name
@resources = {
sheep: 0,
wood: 0,
wheat: 0,
brick: 0,
ore: 0
}
@choices = {
1 => "Shop",
2 => "Use Development Card",
3 => "Trade"
}
@shop = {
... |
class CreateProjects < ActiveRecord::Migration
def change
create_table :projects do |t|
t.string :miejsce
t.integer :zaplata
t.boolean :faktura
t.text :informacja
t.string :nazwa_obiektu
t.string :gmina
t.string :powiat
t.string :ulica
t.string :rodzaj_id
... |
require_relative '../../../kitchen/data/spec_helper'
# mesos slave service
describe file('/etc/default/mesos') do
it { should be_file }
end
describe file('/etc/default/mesos-slave') do
it { should be_file }
end
describe file('/etc/mesos/zk') do
it { should be_file }
end
describe 'mesos slave service' do
it ... |
line1=Настраиваемые параметры,11
display_max=Максимальное число показываемых пользователей или групп,0
sort_mode=Упорядочивать пользователей и группы по,1,0-Использованным блокам,2-Имени,1-Порядок из repquota
line2=Системные параметры,11
user_repquota_command=Команда вывода пользователей для файловой системы,0
group_re... |
FactoryGirl.define do
factory :match do
association :home_player, factory: :player
association :away_player, factory: :player
table
first_service :first_service_by_home_player
transient do
home_score 5
away_score 6
end
after(:create) do |match, evaluator|
create_list :... |
class QuizPassage < ApplicationRecord
PASSING_SCORE = 75
belongs_to :quiz
belongs_to :user
belongs_to :current_question, class_name: 'Question', optional: true
before_validation :before_validation_set_question, on: %i[create update]
scope :passed, -> { where(passed: true) }
def accept!(answer_ids)
... |
class AgronegocioPage
URLS = { :production => "http://localhost:4000/agronegocio" }
def initialize(browser)
@browser = browser
end
def noticias
noticia_section.ul.lis
end
def noticia_section
@browser.element(:tag_name => 'section', :class => 'noticias')
end
def method_missing(sym, *args... |
require 'rails_helper'
describe Lsi::AsnReader do
let (:file_path) { Rails.root.join('spec', 'fixtures', 'files', 'lsi_advanced_shipping_notification_sample.txt') }
let (:content) { File.read(file_path) }
let (:reader) { Lsi::AsnReader.new(content) }
describe '#read' do
it 'returns the batch header' do
... |
class Room < ApplicationRecord
has_many :relationships
has_many :users, through: :relationships
def get_room_name(current_user)
users.reject{ |user| user == current_user}.map{ |user| user.name}.join("、")
end
end
|
class Piece
attr_accessor :type, :board, :color, :position
DIAGONALS = [[1, 1], [1, -1], [-1, 1], [-1, -1]]
LINEARS = [[1, 0], [0, 1], [-1, 0], [0, -1]]
KNIGHTS = [
[-1, 2],
[1, 2],
[2, 1],
[2, -1],
[1, -2],
[-1, -2],
[-2, -1],
[-2, 1],
]
def initialize(color,... |
class Text < ActiveRecord::Base
belongs_to :index
attr_accessible :content, :index_id
include ActsAsPrioritizable
acts_as_prioritizable("index", "assets")
end
|
When /^I try to setup approx$/ do
@messenger = StringIO.new
approx = Service::Approx.new( :verbose => true, :dry_run => true, :messenger => @messenger )
approx.setup "DEBIAN_REPOSITORY"
end
Then /^an approx configuration file generated$/ do
history.should include( "file write (/etc/approx/approx.conf)" )
end
... |
class Book < ApplicationRecord
def self.murah
order(price: :desc)
end
def self.harga_menengah
where('price > ?',600).where('price < ?',20000)
end
def self.dari_terbesar
order(price: :desc)
end
def self.dari_terkecil
order(price: :asc)
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... |
require 'time'
Then 'the value stored in the key {string} is {string}' do |key_name, expected_value|
expect(@stored_known_values[key_name]).to eq expected_value
end
Then 'the value stored in the key {string} is a GUID-shaped value' do |key_name|
expect(@stored_known_values[key_name]).to match GUID_REGEX
end
Then... |
#!/usr/bin/env ruby
require 'bundler'
Bundler.setup
require 'thor'
require 'smugsync'
require 'smile'
#require_relative '../../smile/lib/smile'
include Smile
include FileUtils
class SmugThorCommand < Thor
desc 'keyword_search', 'Download photos by keyword'
method_option :nickname, :desc => 'Smugmug nickname', ... |
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version.
VAGRANTFILE_API_VERSION = "2"
# Save the vagrant_dir
dir = Dir.pwd
vagrant_dir = File.expand_path(File.dirname(__FILE__))
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "saucy"
config.vm.box_url = "http://cloud... |
#!/usr/bin/env ruby
#
# Copyright:: Copyright 2016, Google Inc. All Rights Reserved.
#
# License:: 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.ap... |
#Pseduocode
=begin
INPUT: Obtain a number
STEPS:
Create a hash called roman_symbols and store the numbers as keys and roman numerals as values
roman_symbols = {
1 => "I",
4 => "IV",
5 => "V",
9 => "IX",
10 => "X",
40 => "XL",
50 => "L",
90 => "XC",
100 => "C",
400 => "CD",
500 => "D",
900 => "C... |
require "active_record"
class Todo < ActiveRecord::Base
def due_today?
due_date == Date.today
end
def to_displayable_string
display_status = completed ? "[X]" : "[ ]"
display_date = due_today? ? nil : due_date
" #{id}. #{display_status} #{todo_text} #{display_date}"
end
def self.to_displaya... |
# frozen_string_literal: true
ENV['RAILS_ENV'] ||= 'test'
require_relative '../config/environment'
require 'rails/test_help'
module ActiveSupport
class TestCase
# Setup all fixtures in test/fixtures/*.yml
# for all tests in alphabetical order
fixtures :all
# Add more helper methods to be used by all... |
Magazine::Application.routes.draw do
devise_for :users, :controllers => {:registrations => "registrations"}
resources :users
resources :categories
resources :articles
resources :comments, only: [:index, :create, :destroy]
get '/comments/new/(:parent_id)', to: 'comments#new', as: :new_comment
root :t... |
class CreatePerformances < ActiveRecord::Migration
def change
create_table :performances do |t|
t.string :employee_id
t.string :project_id
t.string :duration
t.string :grade
t.timestamps
end
end
end
|
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
require 'stringio'
describe "Rednode" do
golden = eval(File.read(File.dirname(__FILE__) + '/golden.rb'))
defined = {}
for package in ['simple', 'pummel'] do
defined[package] = []
describe package do
addspec = proc do |pkg, name, m... |
json.array!(@preparations) do |preparation|
json.extract! preparation, :recipe_id, :step, :instruction
json.url preparation_url(preparation, format: :json)
end |
class HashSerializer
def self.dump(hash)
hash
end
def self.load(hash)
(hash || {}).with_indifferent_access
end
end
|
require 'test/unit'
require '../lib/sreg/lexer'
class TestLexer < Test::Unit::TestCase
def scan(init_string, debug = false)
lexer = Sreg::Builder::Lexer.new({ :debug => debug })
lexer.set_input_string(init_string)
return lexer.tokens[0..-2]
end
def assert_lexical_error(expression)
assert_r... |
class AddUserToGames < ActiveRecord::Migration[5.1]
def change
add_column :games, :player_1_id, :integer
add_index :games, :player_1_id
add_column :games, :player_2_id, :integer
add_index :games, :player_2_id
end
end
|
# frozen_string_literal: true
class Trip::Event < BasicObject
#
# @return [String]
# Returns the type of event as reported by the `Thread#set_trace_func` API
# (eg "c-call", "call", "c-return", "return", ...),
#
attr_reader :type
#
# @api private
#
def initialize(type, event)
@type = type
... |
class AddRelayReferenceToShop < ActiveRecord::Migration[5.2]
def change
add_reference :shops, :relays
end
end
|
class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :validatable
after_create :preset_objects
has_many :categories
... |
# frozen_string_literal: true
require 'singleton'
module Departments
module ThinkTank
##
# Supporting the implementations for the methods that are used in the {Departments::ThinkTank::Api}.
module Services
##
# Consumes the {Departments::Analysis::Api}.
class Analysis
include S... |
class WelcomeController < ApplicationController
# GET /
# GET /welcome/1
# GET /welcome/1.json
def index
@catid = params[:catid]
if @catid==nil
@catid = 0.to_i
else
@catid = @catid.to_i
end
@pageindex = params[:pageindex].to_i
if @pageindex==nil || @pageinde... |
class CruisesController < ApplicationController
def new
@cruise = Cruise.new
end
def create
@cruise = Cruise.new(cruise_params)
@cruise.user = current_user
@project = Project.find(params[:project_id])
@cruise.project = @project
if @cruise.save
redirect_to cruise_path(@cruise)
e... |
class CreateEngineers < ActiveRecord::Migration[5.2]
def change
create_table :engineers, comment: Engineer.model_name.human do |t|
t.string :eng_cd, comment: Engineer.human_attribute_name("eng_cd")
t.references :engineer_registration_type, foreign_key: true,
comment: EngineerRegistrationType.model_name.hum... |
Rails.application.routes.draw do
devise_for :users
root 'welcome#index'
resources :users do
get :edit_password, on: :member
end
resources :billings do
resources :receive_amounts, only: [:new, :create, :edit, :update, :destroy]
get :reopen, on: :member
end
resources :clients do
resources :c... |
class AdminsController < ApplicationController
before_action :authorize_admin # need to get the urls for it
private
def authorize_admin
redirect_to root_path unless @current_user.present? && @current_user.admin?
end
end
|
class Defect < ActiveRecord::Base
default_scope -> {order(date: :desc)}
belongs_to :defect_type
belongs_to :phase_type
belongs_to :project
has_one :review, as: :reviewable, dependent: :destroy
validates :name, presence: true
validates :fix_time, numericality: { only_integer: true, greater_than... |
require 'forwardable'
#Bruce Williams
#http://codefluency.com
#
#
#== LICENSE:
#
#(The MIT License)
#
#Copyright (c) 2006-2007 Bruce Williams (http://codefluency.com)
#
#Permission is hereby granted, free of charge, to any person obtaining
#a copy of this software and associated documentation files (the
#'Software'), ... |
class Ability
include CanCan::Ability
attr_reader :user
def initialize(user)
user ||= User.new(nil) # Guest user
@user = user
if user.role_id == "staff_admin"
can :manage, :all
elsif user.role_id == "staff_user"
can :read, :all
end
end
end
|
Vagrant.configure("2") do |config|
config.vm.define "spacewalkclient01" do |machine|
machine.vm.hostname = "spacewalkclient01"
machine.vm.box = "boxcutter/centos72"
machine.vm.network "forwarded_port", guest: 22, host: 2207, id: "ssh"
machine.vm.network "private_network", ip: "192.168.50.11"
... |
class Redis
class Client
protected
def logging(commands) # Overwrite redis-rb logger
# Determin if Log every thing by Rails.logger because ActiveRecord Callback can't use @logger
return yield unless Rails.logger.debug?
queries = commands.map do |name, *args|
line = "#{name.to_s.upca... |
# frozen_string_literal: true
class TestPageWithPeople < SitePrism::Page
set_url '/page_with_people.htm'
# sections
section :people_list, People, '.people-something'
end
|
require 'ruby_terraform'
require 'fileutils'
module Cloudspin
module Stack
class InstanceConfiguration
attr_reader :stack_definition
attr_reader :base_folder
attr_reader :instance_values
attr_reader :parameter_values
attr_reader :resource_values
attr_reader :stack_values
... |
require 'spec_helper'
describe RakutenWebService::Client do
let(:endpoint) { 'https://api.example.com/resources' }
let(:resource_class) do
double('resource_class', endpoint: endpoint)
end
let(:client) { RakutenWebService::Client.new(resource_class) }
let(:application_id) { 'default_application_id' }
le... |
class Game < ActiveRecord::Base
has_many :moves
def get_coordinates_array
coordinates_array = Array.new
self.moves.each do |move|
coordinates_array << move.move_coordinate
end
coordinates_array
end
def self.generate_board(coordinates_array)
@board = Array.new(9, 0)
move_number ... |
class ImportProductsController < ApplicationController
before_action :set_store
def new
end
def create
@errors = Product.import(params[:file], @store)
if params[:file].nil? || @errors.any?
render :new
else
redirect_to store_products_path(@store), notice: "Products imported."
end
... |
When("I sign up as a student") do
homepage.click_sign_up_student
end
And("I accept criterias") do
newmember.click_sign_up_student
end
And("I login to GitHub") do
github.fill_username(ENV['GITHUB_USERNAME'])
github.fill_password(ENV['GITHUB_PASSWORD'])
github.click_submit
end
Then("I will have signed up as ... |
class Thor #:nodoc:
module CoreExt #:nodoc:
# This class is based on the Ruby 1.9 ordered hashes.
#
# It keeps the semantics and most of the efficiency of normal hashes
# while also keeping track of the order in which elements were set.
#
class OrderedHash #:nodoc:
include Enumerable
... |
# SCRIPT DI AGGIORNAMENTO DEI SALVATAGGI AL NUOVO CAPITOLO
#rimuovere skill 5074 e 508 ad angelo
#rimuovere skill da 480 a 489
#se c'è Volcan o var 175>2, aggiungi :kaji;
#se c'è Fuffi, aggiungi :piramid;
#se la missione 177>3 o kora < var_kora, aggiungi :erm
#
#======================================================... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.