text stringlengths 10 2.61M |
|---|
# coding: utf-8
module Console
class Users
class << self
def order_by_activity limit=100
User.order("updated_at DESC").limit(limit)
end
def order_by_id limit=100
User.order("id DESC").limit(limit)
end
def p_basic u
"U #{u.id}: [#{u.status}]\t#{u.name || "no name"} (#{u.username || "no u... |
class OrganizationChargeTemplatesController < ApplicationController
before_action :set_organization_charge_template, only: [:show, :edit, :update, :destroy]
before_action :set_organization_customer, only: [:new, :create, :show, :edit]
before_action :set_organization, only:[:list_by_organization]
# GET /organi... |
class CurrentWeather
attr_reader :datetime,
:sunrise,
:sunset,
:temperature,
:feels_like,
:humidity,
:uvi,
:visibility,
:conditions,
:icon
def initialize(data)
@datetime = Time.at(data[:c... |
class Link < ApplicationRecord
validates :url, uniqueness: true
end
|
class Department < ActiveRecord::Base
#attr_accessor :name
belongs_to :store, {:foreign_key => :store_id}
has_many :items
end
|
class PostsController < ApplicationController
# initiate CRUD
# R/Index
get '/posts' do
@posts = Post.all
erb :'/posts/index'
end
# C/New
get '/posts/new' do
if logged_in?
erb :'/posts/new'
else
flash[:error] = "You must be logged in to c... |
class AddLanguage1AndLanguage2ToProjects < ActiveRecord::Migration[5.0]
def change
add_column :projects, :language_1, :string
add_column :projects, :language_2, :string
end
end
|
class Api::V1::CategoriesController < ApplicationController
# only logged in user
before_action :specified_category, only: [:show, :destroy, :update]
def create
category = Category.new(create_category_params)
category.save
render_resource(category)
end
def index
@categories = Category.where(... |
require 'spec_helper'
describe ParatureFaqQuery do
let(:fixtures_dir) { "#{File.dirname(__FILE__)}/parature_faq" }
describe '#generate_search_body' do
context 'when options is an empty hash' do
let(:query) { ParatureFaqQuery.new({}) }
it 'generates search body with default options' do
exp... |
class BaseController < ApplicationController
before_action :authenticate_user!, except: [:index, :show]
end
|
class AlterSubscriberDiscussions < ActiveRecord::Migration
def change
drop_table :subscriber_discussions
create_table :subscriber_discussions do |t|
t.belongs_to :user_subscription, null: false
t.belongs_to :discussion, null: false
t.timestamps
end
add_foreign_key :subscriber_discuss... |
module LabelHelper
def label_outside_function(label)
label_inside_function label, nil
end
def label_inside_function(label, function_name)
[function_name, label].join('$')
end
def fresh_label
next_label 'label'
end
def next_label(prefix)
[prefix, @label_number ||= 0].join.tap { @label_nu... |
Rails.application.routes.draw do
root 'static_pages#home'
get '/help', to: 'static_pages#help'
get '/terms', to: 'static_pages#terms'
get '/privacy', to: 'static_pages#privacy'
get '/about', to: 'static_pages#about'
get '/contact', ... |
# Provide an interface to read JSON files from a specified path and return a Ruby hashes of each key value pair
module Higo
module Transport
class JSON < Abstract
def initialize(*)
super
@_raw_file = call
end
# Reads file from path provided by Higo::Transport::Abstract
#
... |
class Api::BaseResource < JSONAPI::Resource
abstract
attribute :created_at
attribute :updated_at
end
|
require "google/api_client"
require "sinatra"
require "twilio-ruby"
require "json"
post "/receivesms" do
client = Google::APIClient.new(:key => "AIzaSyAKXQIM2o3v8IdtJn4poj-6I31cJZ1976k")
client.authorization = nil
search = client.discovered_api('customsearch')
response = client.execute(
:api_method => sea... |
class AddFeatureToPosts < CamaManager.migration_class
def change
add_column "#{PluginRoutes.static_system_info["db_prefix"]}posts", :is_feature, :boolean, default: false
end
end
|
class PostsController < ApplicationController
before_action :set_current_user_post, only: [:destroy]
before_action :authenticate_user!
def index
@posts = Post.page(params[:page]).per(15).order(created_at: :desc)
end
def new
@post = current_user.posts.build
end
def create
@post = Post... |
def caesar_cipher(str, num)
new_str = ""
alphabet = "abcdefghijklmnopqrstuvwxyz"
# iterate through each string
str.each_char do |char|
# get index of all the char
old_index = alphabet.index(char)
new_index = old_index + num
new_char = alphabet[new_index % 26]
new_str += new_char
... |
# encoding: UTF-8
# Copyright 2012 Twitter, Inc
# http://www.apache.org/licenses/LICENSE-2.0
module TwitterCldr
module Shared
class PropertyNormalizer
attr_reader :database
def initialize(database)
@database = database
end
def normalize(property_name, property_value = nil)
... |
# encoding: utf-8
require 'spec_helper'
describe Imagem do
describe "#extensao" do
it 'descobre a extensão adequada de acordo com os dados da imagem' do
png = Imagem.new(ler_fixture("upload/img.png"))
jpg = Imagem.new(ler_fixture("upload/img.jpg"))
gif = Imagem.new(ler_fixture("upload/img.gif")... |
class FavoritePost < ActiveRecord::Base
belongs_to :user
belongs_to :post,:counter_cache => true
validates_presence_of :user_id
validates_presence_of :post_id
def self.create_favorite_post(post,user,params)
favorite_post = FavoritePost.new(params[:favorite_post])
ActiveRecord::Base.transaction d... |
class ValidPennyStockGetter
def initialize(page_count=5)
@stocks = []
@page_count = page_count.to_i
end
def run
add_stocks_from_page(main_doc)
# (2..pagination_count).each do |page_num|
(2..@page_count).each do |page_num|
add_stocks_from_page(Nokogiri::HTML(open(finviz_url(page_num))))... |
require 'rails/generators/active_record'
#require 'generators/coalla/cms/orm_helpers'
module Coalla
module Cms
class SetupRoutesGenerator < ActiveRecord::Generators::Base
argument :name, :type => :string, :default => "administrator"
def create_route
route "devise_for :#{name.pluralize}
dev... |
class Product < ApplicationRecord
belongs_to :user, required: false
validates :title, presence: true
mount_uploader :image, ImageUploader
end
|
require('minitest/autorun')
require_relative('../drinks')
class DrinksTest < MiniTest::Test
def setup
@drink1 = Drink.new("Martini", 6)
@drink2 = Drink.new("Gin & Tonic", 4)
@drink3 = Drink.new("Bottle of beer", 3)
end
def test_drink_has_name
assert_equal("Martini", @drink1.name)
end
def t... |
class AddUserApprovedToUserQualifcations < ActiveRecord::Migration
def change
add_column :user_qualifications, :user_approved, :boolean
end
end
|
class Contact < ActiveRecord::Base
belongs_to :usr
validates_presence_of :name, :mail
validates_uniqueness_of :mail
end
|
class Api::SessionsController < ApplicationController
def create
@user = User.find_by(username: params[:username])
if !@user
render json: ["User does not exist"], status: 422
return
end
if @user && @user.is_password?(params[:password])
login(@user)
@posts = @user.posts.ord... |
pg_version = input('pg_version')
control "V-72917" do
title "When updates are applied to PostgreSQL software, any software
components that have been replaced or made unnecessary must be removed."
desc "Previous versions of PostgreSQL components that are not removed from
the information system after updates ha... |
# This is the controller that provides CRUD functionality for the User model.
class ActiveRbac::UserController < ActiveRbac::ComponentController
before_filter :protect_controller
protected
def protect_controller
if current_user.has_role?("Admin")
return true
else
redirect_to "/devices/index"
... |
require 'spec_helper'
describe Forem::View do
let!(:view) { FactoryGirl.create(:topic_view) }
it "is valid with valid attributes" do
view.should be_valid
end
describe "validations" do
it "requires a viewable type" do
view.viewable_type = nil
view.should_not be_valid
end
it "requi... |
class AddBundleToDevises < ActiveRecord::Migration
def self.up
add_column :devices, :is_bundle, :integer
end
def self.down
remove_column :devices, :is_bundle
end
end
|
require 'spec_helper'
require 'tackle_box/email/template'
describe TackleBox::Email::Template do
let(:file) { File.join(File.dirname(__FILE__),'email_template.eml') }
describe ".open" do
subject { described_class.open(file) }
let(:contents) { File.read(file) }
it "should load the contents of the fi... |
class CreateDocuments < ActiveRecord::Migration
def change
create_table :documents do |t|
t.column :user_id, 'int unsigned'
t.column :archive_id, 'int unsigned'
t.string :status, :null => false, :default => ''
t.string :rev, :null => false, :default => ''
t.string :name, :null =... |
class AddLeaderUriToBuilds < ActiveRecord::Migration
def self.up
add_column :builds, :leader_uri, :string, :null => false, :default => 'unknown'
end
def self.down
remove_column :builds, :leader_uri
end
end
|
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
# , :rememberable, :trackable, :validatable
devise :database_authenticatable, :registerable,
:recoverable, :trackable, :validatable
validates :name, presen... |
require 'minitest_helper'
class TestKasen < Minitest::Test
def test_readme_examples
assert_equal(
[[1, 2], [3, 4]].map { |ary| ary[1] },
[[1, 2], [3, 4]].map(&k[1])
)
assert_equal(
['0', '1', '2'].select { |s| s.to_i.zero? },
['0', '1', '2'].select(&k.to_i.zero?)
)
asser... |
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = %q{browser_stakeout}
s.version = "0.1.1"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Nathan Fixler"]
s.date = %q{2009-05-13}
s.default_executable = %q{browser_stakeout... |
require 'rexml/parsers/pullparser'
module MiniAether
# Simple helper methods around REXML pull parser.
#
# @author Patrick Mahoney <pat@polycrystal.org>
# @since 0.0.1, 1-June-2012
class XmlParser < REXML::Parsers::PullParser
class NotFoundError < RuntimeError; end
# Pull events until the start of a... |
#encoding: UTF-8
require 'open-uri'
require 'net/http'
require 'uri'
require 'nokogiri'
require 'csv'
# nome
# consulta_sql
# parametros
# ic_publica
# caminho
# categoria_id
# organizacao_id
# empresa_id
# descricao
class Consulta < ActiveRecord::Base
belongs_to :organizacao
belongs_to :empresa
belongs_to :cate... |
require 'level_object/base'
require 'geometry_form/collision'
require 'level_object/mixin/state'
require 'level_object/mixin/view'
module LevelObject
module Creature
class Base < LevelObject::Base
include LevelObject::Mixin::State
include LevelObject::Mixin::View
attr_accessor :run_speed, :max... |
# == Schema Information
#
# Table name: playlists_tracks
#
# created_at :datetime
# updated_at :datetime
# playlist_id :integer
# track_id :integer
#
class PlaylistsTrack < ApplicationRecord
belongs_to :playlist,
foreign_key: :playlist_id,
class_name: :Playlist
belongs_to :track,
... |
# frozen_string_literal: true
module FacebookAds
# The base class for all ads objects.
class Base < Hashie::Mash
class << self
# HTTP verbs.
def get(path, objectify:, query: {})
query = pack(query, objectify: objectify)
uri = "#{FacebookAds.base_uri}#{path}?" + build_nested_query(q... |
require_relative '../errors/prestacion_not_exists_error'
require_relative '../errors/coordenadas_invalidas_error'
require_relative '../errors/centro_ya_existente_error'
HealthAPI::App.controllers :centros do
get :index do
param_prestacion = request.params['prestacion']
if param_prestacion.nil?
centros =... |
class CreateAccountTypes < ActiveRecord::Migration
def change
create_table :account_types do |t|
t.string :code, :limit => 20, :null => false
t.string :name, :limit => 100, :null => false
t.string :close_method
t.string :report_type
t.string :note, :li... |
require 'chemistry/element'
Chemistry::Element.define "Copper" do
symbol "Cu"
atomic_number 29
atomic_weight 63.546
melting_point '1357.75K'
end
|
FactoryGirl.define do
factory :agent do
name 'Agent Name'
email 'agent@agent.agent'
password '123456789'
type 'Agent'
factory :internal_agent do
email 'agent_internal@agent.agent'
end
factory :agent_with_tickets do
association :creator, factory: :admin, strategy: :build
c... |
require 'rails_helper'
RSpec.describe HomeController, type: :request do
describe 'GET #index' do
it 'returns the index page' do
get home_index_path
expect(response).to render_template :index
end
end
end
|
module UserConcerns
module Posts
extend ActiveSupport::Concern
included do
has_many :posts
has_many :post_abuses, class_name: 'PostAbuse'
end
end
end
|
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '2.5.3'
gem 'bootstrap', '~> 4.1.3'
gem 'bootstrap-will_paginate'
gem 'devise'
gem 'font-awesome-rails'
gem 'haml'
gem 'jbuilder', '~> 2.5'
gem 'jquery-rails'
gem 'jquery-ui-rails'
gem 'pg'
gem 'puma', '~> 3.11'
gem 'ra... |
class MasterScenariosAddDeletedAt < ActiveRecord::Migration
def self.up
add_column :master_scenarios, :deleted_at, :time
end
def self.down
remove_column :master_scenarios, :deleted_at
end
end
|
require 'spec/helper'
describe 'Recruiter signs up and posts a job' do
behaves_like 'mechanize'
name = Faker::Name::name
email = Faker::Internet::email(name)
password = 'recruiter'
should 'sign up by trying to post a job' do
click_link 'Post job'
click_link "Don't have an account yet?"
click_li... |
class AddIndexesToHorses < ActiveRecord::Migration[5.1]
def change
add_index :horses, :name
add_index :horses, :date
add_index :horses, :race
end
end
|
class ParticipationPolicy < ApplicationPolicy
vattr_initialize :user, :participation
def accept?
participation.event.organizer == user
end
alias_method :reject?, :accept?
def destroy?
# rly? check it!
participation.user == user
end
end
|
class AddColumnTasks < ActiveRecord::Migration[6.1]
def change
add_column :tasks, :task_deadline, :date
end
end
|
#!/usr/bin/ruby -w
require 'dbi'
begin
# connect to the MySQL server
dbh = DBI.connect("DBI:Mysql:TESTDB:localhost", "testuser", "test123")
sth = dbh.prepare("INSERT INTO EMPLOYEE(FIRST_NAME,
LAST_NAME,
AGE,
SEX,
INCOME,
VALUES (?, ?, ?,... |
require 'json'
require 'tmpdir'
require 'net/http'
require 'open-uri'
require "cachalot_client/version"
module CachalotClient
SLEEP_TIME = 0.1
class Error < StandardError; end
class Client
attr_reader :stdout
def initialize(url, service, command, work_dir, uptime=600)
@url = url
@... |
class AddWithdrawableToBirthdayParties < ActiveRecord::Migration
def change
add_column :birthday_parties, :withdrawable, :decimal, precision: 10, scale: 2, default: 0
BirthdayParty.find_each do |party|
party.update_withdrawable
end
end
end
|
class Survey::Choice < ActiveRecord::Base
belongs_to :quest, class_name: "Survey::Quest"
has_many :ans_choices, class_name: "Survey::AnsChoice"
has_many :comments, through: :ans_choices, class_name: "Survey::Comment"
has_many :ans, class_name: "Survey::Ans", through: :ans_choices
structure do
order 0
... |
class CreateMissions < ActiveRecord::Migration
def change
create_table :missions do |c|
c.integer :user_id
c.string :target
c.string :location
c.string :mo
c.boolean :completed
c.timestamps
end
end
end
|
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
# BOX_IMAGE = "ubuntu/trusty32"
Vagrant.configure("2") do |config|
config.vm.define "staging" do |subconfig|
subconfig.vm.box = "ubuntu/trusty32"
... |
require 'spec_helper'
BatchProcessor = TradeLead::FbopenImporter::BatchProcessor
describe 'BatchProcessor' do
describe '#process!' do
it 'should not execute before reaching batch size' do
pentries = []
b = BatchProcessor.new(2) { |x| pentries = x }
b.batched_process(1)
expect(pentries).to... |
class Comment < ActiveRecord::Base
validates :text, presence: true
validates :user_id, presence: true
validates :entry_id, presence: true
belongs_to :entry
belongs_to :user
end
def self.author
author = User.where(:id == comment.user_id)
author
end
|
require 'securerandom'
class ReadingSession < ActiveRecord::Base
belongs_to :book
belongs_to :user
has_many :reading_session_participants
before_validation :generate_guid!, on: :create
private
def generate_guid!
begin
self.guid ||= SecureRandom.uuid
end while self.class.exists?(guid: self.... |
# Tri-Angles
=begin
(Understand the Problem)
Problem:
Write a method that takes the 3 angles of a triangle as arguments, and returns a symbol
:right, :acute, :obtuse, or :invalid depending on whether the triangle is a right, acute, obtuse, or invalid triangle
Inputs: Three Integers
Outputs: Symbol (:acu... |
# 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 RallyOrgApi::Donor
def initialize(options = {})
options.each_pair { |k,v| send("#{k}=", v)}
end
attr_reader :id, :first_name, :last_name, :amount, :cause
def set_cause(cause)
@cause = cause
self
end
def set_fundraiser(fundraiser)
@fundraiser = fundraiser
self
end
def cause
... |
class AddLatitudeLongitudeToAddresses < ActiveRecord::Migration
def change
add_column :addresses, :latitude, :integer
add_column :addresses, :longitude, :integer
end
end
|
class Artist < ActiveRecord::Base
require 'rest-client'
require 'json'
require 'nokogiri'
attr_accessible :large_img, :mbid, :medium_img, :name, :small_img, :url, :bio
validates_uniqueness_of :mbid
has_many :events
@last_fm_base = 'http://ws.audioscrobbler.com/2.0/'
@api_key = 'f9b42601c6a27c4331... |
require 'test/unit'
require File.join( File.dirname(__FILE__), '../lib/graybook.rb' )
require File.join( File.dirname(__FILE__), 'test_helper.rb' )
require 'tempfile'
require 'mocha'
class TestGraybookImporterCsv < Test::Unit::TestCase
include TestHelper
def setup
@importer = Graybook::Importer::Csv.new
en... |
shared_examples_for 'No Testimonials Shown' do
before do
raise "please set let(:initial_path)" if initial_path.blank?
ensure_on(initial_path)
end
it 'displays a message saying no testimonials' do
expect(page).to have_content(::I18n.t('no_items_yet', scope: 'refinery.testimonials.admin.testimonials.re... |
class AddLockableToDoctors < ActiveRecord::Migration
def change
add_column :doctors, :failed_attempts, :integer, default: 0
add_column :doctors, :unlock_token, :string
add_column :doctors, :locked_at, :datetime
end
end
|
require 'series_calc/slot_term'
module SeriesCalc
class Slot
SLOT_DIMENSION_ID = 'slot'.freeze
attr_reader :terms
attr_reader :id
def initialize(time = Time.now, id = nil)
@terms = {SLOT_DIMENSION_ID => SlotTerm.new("time@#{id}", time)}
end
def time
terms[SLOT_DIMENSION_ID].val... |
# -*- coding: utf-8 -*-
INPUT = <<__EOL__
3 3 1
###
#X#
###
__EOL__
# coordinates -- start at up-left
# def split_cases(data)
# lines = data.split("\n")
# for i in 1...lines.size do
# info = lines[i].split.map(&:to_i)
# end
# end
# split_cases(INPUT)
# 3 3 2
# ###
# #X#
# ###
KEYS = [:height, :wi... |
#require './app/till.rb'
#require 'json'
#describe Till do
#file = File.read('./spec/test_data/hipstercoffee.json')
#let(:store_details){ JSON.parse(file) }
#let(:menu){ double(:menu, :shop_details => store_details[0]) }
#let(:menu_klass){ double(:menu_klass, :new => menu)}
#subject(:till){ described_... |
class Admin::AdZonesController < ApplicationController
layout "admin/admin"
before_filter :admin_login_required
before_filter :get_adpage
before_filter :set_ad_admin_active
def index
@ad_zones = @adpage.ad_zones
end
def new
@ad_zone = @adpage.ad_zones.new
end
def create
@ad_zone =... |
require 'spec_helper'
describe PagesController do
describe "index" do
it "assigns all pages" do
page1 = FactoryGirl.create(:page)
page2 = FactoryGirl.create(:page)
get :index
assigns(:pages).should == [page1, page2]
end
end
describe "show" do
it "displays right page" do
page1 = FactoryGirl.cr... |
class User < ApplicationRecord
acts_as_token_authenticatable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :validatable
has_many :contacts, dependent: :destroy
end
|
class Api::Lessons::LessonsController < ApplicationApiController
before_action :set_user, only: [:lesson_user]
def index
pag = params[:page] ? params[:page] : 1
limit = params[:limit] ? params[:limit] : 30
mes = params[:mes] ? params[:mes] : nil
ano = params[:ano] ... |
Rails.application.routes.draw do
root to: 'landing#index'
namespace :settings do
resources :setup, only: [:index, :create]
resources :clients
resources :proxies do
get :test, on: :member
end
end
end
|
# -*- coding: utf-8 -*-
Pod::Spec.new do |s|
s.name = 'RRFoundation'
s.version = '0.0.1'
s.summary = 'Foundation dependent classes and extensions.'
s.description = <<-DESCRIPTION
Adds various classes and class extensions for the Apple Foundation framework,
iOS or OS X. The classes support both platforms.
... |
require 'nokogiri'
require 'open-uri'
require 'fileutils'
require 'tmpdir'
require 'zipruby'
BASE_URL = 'http://www.post.japanpost.jp/zipcode/dl/'
@ticker_code_list = {
'ken_all' => 'kogaki/zip/ken_all.zip',
# 'ken_all_rome' => 'roman/ken_all_rome.zip',
}
tmp_dir = Dir.mktmpdir('zip_')
@ticker_code_list.eac... |
class Companies::ShowPresenter
attr_accessor :company
def initialize(company)
@company = company
end
def comments
@comments ||= @company.comments.all
end
end |
require 'active_support/core_ext'
# If a version of Cassandra is specified in the cequel require, propagate that
# requirement to cassandra-cql. Otherwise, use the default that cassandra-cql
# uses (i.e. Cassandara 1.1)
if Cequel.respond_to?(:CASSANDRA_VERSION)
require "cassandra-cql/#{Cequel.CASSANDRA_VERSION}"
els... |
#!/usr/bin/env ruby
require_relative 'libinstructions/libinstructions-html'
class HTMLFilter
def convert(io)
doc = Document.new(io).root
doc.context[:attribute_quote] = :quote
doc.each_element('//td|//th') do |e|
set_cell_attributes(e)
attrs =
e.attributes['class'] ? e.attributes['cla... |
BEGIN {
$LOAD_PATH << 'lib'
require 'n0'
require 'securerandom'
require 'csv'
}
task :default => :help
task :list_simpledb do
db = N0.db(:admin)
db.domains.each do |domain|
p domain
p domain.metadata.to_h
end
end
desc 'fetch newest submissions'
task :fetch do
# First load local cache
puts "... |
Rails.application.routes.draw do
mount RedactorRails::Engine => '/redactor_rails'
require 'api_v1'
root 'home#index'
devise_for :admins, skip: [:registrations], path: "auth", path_names: { sign_in: 'login', sign_out: 'logout', password: 'secret'}, controllers: { sessions: "users/sessions" }
as :ad... |
class Api::V1::CsManagersController < ApplicationController
before_action :Authenticate_user
before_action :Classify_user
before_action :Authorize_user
def create_par
par= Par.new(cs_params)
par.status='pending'
par.employer_id = @classified_user.employer_id
manager= GeneralManager.find_by(id: ... |
require File.expand_path('../lib/omniauth-islykill/version', __FILE__)
Gem::Specification.new do |gem|
gem.name = 'omniauth-islykill'
gem.version = OmniAuth::ISLYKILL::VERSION
gem.summary = 'SAML strategy to handle Icelands Íslykill for OmniAuth.'
gem.description = 'This is a specific SA... |
require File.dirname(__FILE__) + '/../../spec_helper'
describe "/ficha_tematicas/new.html.erb" do
include FichaTematicasHelper
before(:each) do
@ficha_tematica = mock_model(FichaTematica)
@ficha_tematica.stub!(:new_record?).and_return(true)
@ficha_tematica.stub!(:autor).and_return("MyString")
@f... |
class GetDropboxFiles
include Sidekiq::Worker
def perform( user_id )
logger.info "Things are happening. DROP! BOX!"
files = []
user = User.find( user_id )
files = user.append_dropbox_files(path: '/', files: files)
files.each do |file_to_request|
puts "--------> file_to_request... |
module API
module V1
class Userss < Grape::API
include API::V1::Defaults
resource :userss do
params do
requires :email,type: String
requires :password,type: String
end
post :sign_in do
user = User.where(email: params[:email]).first
if us... |
class Single < ActiveRecord::Base
include ComparableSolve
extend Humanizeable
belongs_to :user, :counter_cache => true, :touch => true
belongs_to :puzzle
has_and_belongs_to_many :records
attr_accessible :time, :puzzle_id, :scramble, :penalty, :comment
validates_presence_of :user_id, :puzzle_id, :time
... |
class User < ActiveRecord::Base
has_many :submissions
has_many :games, through: :submissions
end
|
require File.dirname(__FILE__) + '/../../spec_helper'
describe "/alcaldes/index.html.erb" do
include AlcaldesHelper
before(:each) do
alcalde_98 = mock_model(Alcalde)
alcalde_98.should_receive(:nombre).and_return("MyString")
alcalde_98.should_receive(:telefono).and_return("MyString")
alcalde_98.s... |
class LessonsController < ApplicationController
before_action :set_lesson, only: [ :show ]
def index
@course = Course.find(params[:course_id])
@lessons = policy_scope(@course.lessons)
end
def setup
@lesson = Lesson.find(params[:lesson_id])
authorize @lesson
@course = @lesson.course
end
... |
module PageObjects
module Assets
class ShowPage < PageObjects::BasePage
set_url '/assets/{id}'
element :home_breadcrumb, 'li a.govuk-breadcrumbs__link[href="/"]'
element :assets_breadcrumb, 'li a.govuk-breadcrumbs__link[href="/assets"]'
element :title_header, 'h1.govuk-heading-xl'
... |
module Gibbon
class Request
attr_accessor :api_key, :api_endpoint, :timeout, :open_timeout, :proxy, :faraday_adapter, :symbolize_keys, :debug, :logger
DEFAULT_TIMEOUT = 60
DEFAULT_OPEN_TIMEOUT = 60
def initialize(api_key: nil, api_endpoint: nil, timeout: nil, open_timeout: nil, proxy: nil, faraday_a... |
require 'rails_helper'
RSpec.describe Tweet do
it { should validate_presence_of :user }
it { should validate_presence_of :text }
it { should validate_length_of(:text).is_at_most(140) }
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.