text stringlengths 10 2.61M |
|---|
WCC::Filters.add 'matches' do |data,args|
WCC::Filters.debug "regex: #{args['regex']}"
# args['flags'] is assumed to be a string that might be empty or
# contains any of the characters 'i','e','m' in any order.
ropts = []
if not args['flags'].nil?
WCC::Filters.debug "flags: #{args['flags']}"
ropts << Regexp::... |
class ReloadTeslaLocalWorker
include Sidekiq::Worker
sidekiq_options retry: false
def perform
TeslaControl.local
end
end
|
module Jekyll
class FeaturesTag < Liquid::Block
def initialize(tag_name, alignment, tokens)
super
end
def render(context)
text = super
rendered = "<ul class=\"meeru_features\">"
features = text.split("\n")
for feat in features
f = feat.strip
... |
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
before_action :authenticate_user!
before_action :configure_permitted_parameters, if: :devise_controller?
rescue_from CanCan::AccessDenied do |exception|
redirect_to main_app.root_url, alert: exception.message... |
require 'pry'
def find_item_by_name_in_collection(name, collection)
# Implement me first!
#
# Consult README for inputs and outputs
counter = 0
while counter < collection.length
if collection[counter][:item] == name
return collection[counter]
end
counter += 1
# binding.pry
end
nil
end... |
class Alarm
extend Forwardable
include Logable
def_delegators :alarm, :exists?, :delete, :alarm_arn
def_delegators :@definition, :name
# @param [AlarmDefinition] definition
# @param [Aws::CloudWatch::Resource] cloudwatch
def initialize(definition, cloudwatch)
@definition = definition
@cloudwatch... |
class OtherThing < ActiveRecord::Base
self.table_name = "things"
acts_as_soft_delete_by_field :removed_at
end
|
RSpec.describe PayoneerApiClient do
let(:configuration) { PayoneerApiClient.configure do |conf|
conf.environment = 'development'
conf.partner_id = 'XXXXXXXX'
conf.partner_username = 'XXXXXXXX'
conf.partner_api_password = 'XXXXXXXX'
end }
it 'has a version number' do
expect(PayoneerApiClient:... |
module LogsHelper
def gravatar_helper user
image_tag "https://www.gravatar.com/avatar/#{Digest::MD5.hexdigest(user.email)}"
end
class CodeRayify < Redcarpet::Render::HTML
def block_code(code, language)
CodeRay.scan(code, language).div
end
end
def markdown(text)
coderayified = CodeRayif... |
class ReposController < ApplicationController
skip_before_filter :require_login, only: [:access]
def access
user = User.find_by_uid params['user']
repo = Repo.find_by_virtual_path params['path']
access = params['access'].to_sym
if user.nil? || repo.nil? || !repo.can_access?(user, access)
render nothing: t... |
require 'rails_helper'
describe CustomersController do
describe "admin creating or updating valid customer" do
before(:each) do
@params = attributes_for(:customer)
login_as_boxoffice_manager
post :create, {:customer => @params}
end
it "should create the customer" do
Customer.find_... |
class Esendex
class Users
# @see Esendex#users
# @api private
def initialize(credentials)
@credentials = credentials
end
end
end
|
# == Schema Information
#
# Table name: messages
#
# id :integer not null, primary key
# author :string not null
# message :string not null
# timestamp :integer not null
# send_at :datetime not null
# created_at :datetime not null
# updated... |
class Account < ActiveRecord::Base
belongs_to :user
validates :name, presence: true
validates_uniqueness_of :name
end
|
class ImportTasksController < ApplicationController
def index
@import_tasks = ImportTask.all
end
def new
@form = ImportTaskForm.new
end
def create
@form = ImportTaskForm.new(import_task_params)
service = CreateImportTaskService.new(@form)
if service.call
redirect_to import_tasks_p... |
require 'rails_helper'
RSpec.describe Transaction, type: :model do
it { should belong_to(:user) }
it { should belong_to(:account) }
it { should validate_presence_of(:account_id) }
it { should validate_presence_of(:user_id) }
it { should validate_presence_of(:total) }
end
|
module Signup
class Exception < StandardError
attr_reader :type
def initialize(args)
@type = args[:type]
super(args[:msg])
end
end
end |
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe NotificationSenderJob do
describe '.perform_later' do
subject(:call) { described_class.perform_later(**note_params) }
before do
create_list :user, 2, email_updates: true
create_list :user, 3, email_updates: false
end
l... |
class SketchupUtils
def self.get_parent_group(ent)
if ent.parent.kind_of? Sketchup::ComponentDefinition and ent.parent.group?
ent.parent.instances[0]
end
end
def self.is_container(ent)
ent.kind_of? Sketchup::Group
end
def self.get_global_transform(ent)
grp = get_parent_group(ent)
... |
class CreateAnnotations < ActiveRecord::Migration
def change
create_table :annotations do |t|
t.belongs_to :image
t.float :x_axis
t.float :y_axis
t.string :details
t.timestamps
end
end
end
|
class ApiController < ActionController::API
### https://blog.rebased.pl/2016/11/07/api-error-handling.html
rescue_from ActiveRecord::RecordInvalid, with: :render_unprocessable_entity_response
rescue_from ActiveRecord::RecordNotFound, with: :render_not_found_response
def render_unprocessable_entity_response(ex... |
require 'spec_helper'
describe Label do
before do
@label = Label.new(name: "Example label")
end
subject { @label }
it { should respond_to(:name) }
it { should respond_to(:expenses) }
it { should respond_to(:users) }
it { should be_valid }
describe "when name is not present" do
before { @lab... |
class AddPointsToCalorie < ActiveRecord::Migration
def change
add_column :calories, :points, :number
add_column :calories, :calories, :number
end
end
|
class ScoresController < ApplicationController
before_action :set_score, only: [:show, :edit, :update, :destroy]
before_action :check_if_can_edit_score, only: [:edit, :update, :destroy]
def check_if_can_edit_score
set_score
unless(is_admin? || @score.user == current_user)
flash['error'] = "Sorry, o... |
require 'spec_helper'
describe CategoriesController do
fixtures :apps, :app_categories
let(:app) { apps(:app1) }
describe '#index' do
it 'returns the apps categories' do
get :index, app_id: app, format: :json
expected = ActiveModel::ArraySerializer.new(
[app_categories(:category1)],
... |
require "spec_helper"
describe "An empty Openreqs application", :type => :request do
it "is empty" do
@docs.find.to_a.should be_empty
end
it "creates an empty index document in the database on first access" do
visit "/"
@docs.find.to_a.should have(1).items
index = @docs.find_one
index.shou... |
require 'rails_helper'
RSpec.describe Item, type: :model do
#pending "add some examples to (or delete) #{__FILE__}"#
before do
@item = FactoryBot.build(:item)
end
describe '商品出品' do
context '商品出品ができる時' do
it '商品出品ができる時' do
expect(@item).to be_valid
end
end
context '商品出品ができない時... |
class OrgParticipation < ApplicationRecord
belongs_to :activity
belongs_to :organisation
attribute :role, :string, default: "implementing"
enum role: {
partner_organisation: 0,
matched_effort_provider: 1,
external_income_provider: 2,
implementing: 3,
service_owner: 99
}
scope :impleme... |
class Package < ActiveRecord::Base
# Associations
belongs_to :company
# Validations
validates :title, presence: true, length: { maximum: 255 }
validates :price, presence: true, numericality: true
validates :body, presence: true
end
|
require 'database_connection'
describe DatabaseConnection do
describe '.setup' do
it 'sets up a connection to a database through PG' do
expect(PG).to receive(:connect).with(dbname: 'makers_bnb_test')
DatabaseConnection.setup('makers_bnb_test')
end
it 'this connection is persistent' do
... |
require 'spec_helper'
describe SessionsController do
describe 'POST login' do
before :each do
account = create :account
@user = account.user
@request.env["devise.mapping"] = Devise.mappings[:user]
end
it 'should return a valid response' do
post :create, {format: 'json', user: {... |
require 'test_helper'
module Radiator
class ChainStatsApiTest < Radiator::Test
def setup
@api = Radiator::ChainStatsApi.new
end
def test_method_missing
assert_raises NoMethodError do
@api.bogus
end
end
def test_all_respond_to
@api.method_names.each do |key|
... |
module Sagashi
class Collection
attr_accessor :query, :docs
def initialize(params={})
@docs = params.fetch(:docs, [])
@query = params.fetch(:query, nil)
def @docs.<<(arg)
self.push(arg)
end
end
def containing_term(term)
@docs.count {|doc| doc.include?(term)}
... |
require 'test_helper'
class Admin::Reporting::MemberReviewControllerTest < ActionController::TestCase
def setup
ssl!
end
test "should require superuser or reporter access" do
login_as(user = Factory(:user))
get :index
assert_redirected_to root_path
end
test "index should redire... |
require File.expand_path(File.join(File.dirname(__FILE__), *%w[.. .. spec_helper]))
describe '/hosts/summary' do
before :each do
@host = Host.generate!(:description => 'Test Host')
end
def do_render
render :partial => '/hosts/summary', :locals => { :host => @host }
end
it 'should display the name o... |
class Paciente < ApplicationRecord
self.table_name = 'paciente'
self.primary_key = 'id_paciente'
alias_attribute :id, :id_paciente
alias_attribute :nome, :paciente_nome
alias_attribute :sexo, :paciente_sexo
alias_attribute :nascimento, :paciente_nascimento
alias_attribute :endereco, :paciente_endereco
... |
require 'rails_helper'
RSpec.describe Piece, type: :model do
it {should validate_presence_of(:title)}
it {should belong_to(:user) }
context "no title is provided" do
it "piece is not created" do
invalid_piece = Piece.new(composer_last: "Creston", composer_first: "Paul", title: "Sonata", user_id: 1)
... |
require 'test_helper'
class UserGenerationsControllerTest < ActionController::TestCase
include Devise::Test::ControllerHelpers
before do
@admin = create :user, :admin
sign_in @admin
end
describe '#new' do
it 'sets user as an instance variable' do
get :new
user = assigns(:user)
... |
json.array!(@forecasts) do |forecast|
json.extract! forecast, :id, :prosumer_id, :interval_id, :timestamp, :forecast_time, :production, :consumption, :storage
json.url forecast_url(forecast, format: :json)
end
|
module Shikake
class Profile
def show
puts common
self
end
def save
FileUtils.mkdir_p("log/") unless FileTest.exist?("log/")
filename = @root_url.gsub(%r{https?://}, "").gsub(%r{/$}, "").gsub(%r{[\\:;*?"<>|]}, "").gsub(%r{/}, "__")
filepath = "log/#{filename}[#{@start.strftime"%Y%m%d_%H%M%S"}].t... |
Rails.application.routes.draw do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
get 'student/signup'
post 'student/login'
get 'student/login'
get 'student/library'
get 'student/sports'
root 'student#signup'
end
|
module Deordinalize
EXPLICITS = {
'first' => 1,
'second' => 2,
'third' => 3,
'ninth' => 9,
'eleventh' => 11,
'twelfth' => 12,
'twentieth' => 20,
'thirtieth' => 30,
'fortieth' => 40,
'fiftieth' => 50,
'sixtieth' ... |
class RoomCharacteristicDecorator < Draper::Decorator
delegate_all
# Define presentation-specific methods here. Helpers are accessed through
# `helpers` (aka `h`). You can override attributes, for example:
#
# def created_at
# helpers.content_tag :span, class: 'time' do
# object.created_at.st... |
class AddBottomLinkToStaticPageData < ActiveRecord::Migration
def change
add_column :static_page_data, :next_page_link, :text
add_column :object_metadata, :next_page_link, :text
end
end
|
# == Schema Information
#
# Table name: products
#
# id :integer not null, primary key
# title :string(255)
# description :text
# image_url :string(255)
# price :decimal(8, 2)
# created_at :datetime
# updated_at :datetime
# locale :string(255)
#
class Product < ActiveReco... |
# frozen_string_literal: true
Rails.application.routes.draw do
devise_for :users
# get 'cart/index'
get '/about', to: 'pages#about', as: 'about'
get '/contact', to: 'pages#contact', as: 'contact'
get '/cart', to: 'cart#index', as: 'cart'
resources :teams, only: %i[index show] do
collection do
ge... |
class CreateRefineryActivitiesLocations < ActiveRecord::Migration
def self.up
create_table :refinery_activities_locations, :id => false do |t|
t.integer :activity_id
t.integer :location_id
end
add_index :refinery_activities_locations, :activity_id
add_index :refinery_activities_locations,... |
require "spec_helper"
describe Paperclip::Thumbnail do
context "An image" do
before do
@file = File.new(fixture_file("5k.png"), "rb")
end
after { @file.close }
[["600x600>", "434x66"],
["400x400>", "400x61"],
["32x32<", "434x66"],
[nil, "434x66"]].each do |args|
context "... |
class ProductSearchesController < ApplicationController
def create
@query = params[:q]
if params[:id]
@category = Category.find_by_param params[:id]
end
@nav_state = NavState.new params
@nav_state[:category] = @category
@nav_state[:per_page] = '24'
begi... |
class Queries::Users::CurrentUser < GraphQL::Schema::Resolver
graphql_name 'CurrentUser'
description '現在アクセスしているユーザーを取得する'
type Types::UserType, null: true
def resolve
context[:current_user]
end
end
|
# encoding: utf-8
require 'spec_helper'
describe TTY::Text, '#truncate' do
let(:text) { 'ラドクリフ、マラソン五輪代表に1万m出場にも含み' }
let(:length) { 12 }
subject { described_class.truncate(text, :length => length) }
it { is_expected.to eq("ラドクリフ、マラソン五…") }
end # truncate
|
require 'rails_helper'
RSpec.describe ReviewProcess do
let(:review) { create(:review) }
let(:reviewer) { create(:user) }
let(:reviewer_process) { ReviewerProcess.new(params: { review_id: review.id, reviewer_id: reviewer.id, relationship: 'Peer' }, current_user: review.reviewee) }
let(:reviewer_process_by_id) {... |
require 'spec_helper'
require 'rails_helper'
describe "LayoutLinks" do
it "devrait trouver une page Accueil à '/'" do
get '/'
expect(response.body).to have_title("Accueil")
end
it "devrait trouver une page Contact at '/contact'" do
get '/contact'
expect(response.body).to have_title("Contact")
... |
# == Schema Information
#
# Table name: incidents
#
# id :integer not null, primary key
# fault_ref :string(255)
# description :text
# date :date
# status :string(255)
# system_id :integer
# created_at :datetime
# updated_at :datetime
# severity :string(255)
# time ... |
require 'rails_helper'
require 'spec_helper'
if RUBY_VERSION>='2.6.0'
if Rails.version < '5'
class ActionController::TestResponse < ActionDispatch::TestResponse
def recycle!
# hack to avoid MonitorMixin double-initialize error:
@mon_mutex_owner_object_id = nil
@mon_mutex = nil
... |
require "test_helper"
class SuperProcessBasicTest < MiniTest::Spec
class Robot
extend SuperProcess::Basic
def i_am_instance_method
"called"
end
end
describe "method_missing" do
should "call like a static method" do
assert_equal Robot.i_am_instance_method, "called"
end
sho... |
class CreateFieldDescriptions < ActiveRecord::Migration
def change
create_table :field_descriptions do |t|
t.references :tenant
t.string :label
t.integer :type
t.integer :sort_order
t.string :mask
t.integer :entity_type
t.timestamps
end
end
end
|
# frozen_string_literal: true
describe FactoryBotRails::DefinitionFilePaths do
describe "#files" do
it "returns a list of definition files that only exist" do
definition_file_paths = ["spec/fixtures/factories", "not_exist_directory"]
files = described_class.new(definition_file_paths).files
ex... |
require 'natives/host_detection/platform'
require 'natives/host_detection/package_provider'
module Natives
class HostDetection
def initialize(opts={})
@detect_platform = opts.fetch(:detect_platform) { Platform.new }
@detect_package_provider = opts.fetch(:detect_package_provider) {
PackagePro... |
class ResourcesController < ApplicationController
before_filter :set_variables
def set_variables
@per_page = 25
end
def index
@filter = false
#for simple filters
# @projects = Item.where(type: 'Project')
query = Tag.all(:tags).items.query_as(:tagitems)
@tags = query.with(:tags, '... |
#encoding: utf-8
require 'rubygems'
require 'open-uri'
#
# 天気予報を取得するクラス
#
class WeatherInfo
#
#東京の天気情報を取得
#天気、最高気温、最低気温、降水率(06-12)、(12-18)、(18-24)を戻す
def get_tokyo_info
xml = parse_xml
date =Time.new.strftime("%Y/%m/%d")
info = {}
return info unless /<area id=\"東京地方\">.*<info date=\"#{date}\">(.*?)<\/info... |
# frozen_string_literal: true
require "rails_helper"
describe Minion do
it { is_expected.to validate_uniqueness_of(:hostname) }
describe ".assign_roles" do
let(:minions) do
FactoryGirl.create_list(:minion, 3, role: nil)
end
context "when there are not enough Minions" do
it "raises NotEnou... |
class Webstorm < Cask
url 'http://download.jetbrains.com/webstorm/WebStorm-8.0.2.dmg'
homepage 'http://www.jetbrains.com/webstorm/'
version '8.0.2'
sha256 '4ba90cec20a7b115f840adc26892d76e71e049a65570af9fa5d0f54ba7caa9f8'
link 'WebStorm.app'
end
|
require 'rails_helper'
describe BuildResponseService do
describe '#call' do
include_context :xml_content
context 'with valid arguments' do
let(:start_date) { '01-12-2017'.to_date }
let(:end_date) { '05-12-2017'.to_date }
it 'return success result' do
expect(described_class.new(data:... |
class String
def to_boolean
ActiveRecord::Type::Boolean.new.cast(self)
end
end
class NilClass
def to_boolean
false
end
end
class TrueClass
def to_boolean
true
end
def to_i
1
end
end
class FalseClass
def to_boolean
false
end
def to_i
0
end
end
class Integer
def to_... |
#动作
假如 /我在(.*)页面/ do |page|
url = ""
case page
when "退出"
url = logout_path
when "登录"
url = login_path
when "游戏列表"
url = games_path
when "网站地图"
url = sitemap_path
end
raise 'visit url is blank' if url.blank?
visit url
end
而且 /我进入(.*)链接/ do |label|
click_link(label)
end
当 /我输入(.*)为(.... |
require 'test_helper'
class SearchAreasControllerTest < ActionController::TestCase
setup do
@search_area = search_areas(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:search_areas)
end
test "should get new" do
get :new
assert_respons... |
# encoding: utf-8
describe Faceter::Coercers, ".create" do
subject { described_class[:create] }
it "coerces arguments" do
expect(subject[:foo, from: :bar]).to eq(name: :foo, keys: :bar)
end
it "coerces arguments" do
expect(subject[:foo, from: [:bar, :baz]])
.to eq(name: :foo, keys: [:bar, :baz... |
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
require 'rubygems'
require 'bson'
gem 'mongoid','>=2.0.0.rc.7'
require 'mongoid'
require File.dirname(__FILE__)+'/../models/page'
require 'open-uri'
require 'kconv'
require 'uri'
require 'nokogiri'
require 'yaml'
$KCODE = 'u'
begin
@@conf = YAML::load open(File.dirname(__F... |
class PartnerProductsChangeSourcePartnerKeyKey < ActiveRecord::Migration
def self.up
remove_index :partner_products, :name => 'partner_products_source_id_index'
add_index :partner_products, [:source_id, :partner_key], :name => 'partner_products_partner_key_source_id_index'
end
def self.down
re... |
require "spec_helper"
describe Paperclip::ProcessorHelpers do
describe ".load_processor" do
context "when the file exists in lib/paperclip" do
it "loads it correctly" do
pathname = Pathname.new("my_app")
main_path = "main_path"
alternate_path = "alternate_path"
allow(Rails)... |
# frozen_string_literal: true
require 'yaml'
module Dappgen
module Machines
class DryRunMachine
def set_thing(thing, opts)
@tree = {}
@thing = thing
@opts = Hashie::Mash.new(opts[:opts])
@base_data_dir = File.join(Gem.loaded_specs['dappgen'].full_gem_path, 'data', 'dappgen'... |
module Searches
class AtomFeedService
class << self
def find_microposts_by(source)
last = source.last.try(&:provider_id).to_s
Feedjira::Feed.fetch_and_parse(source.key).entries.each do |feed|
break if reached_limit? feed.entry_id, last
begin
create_micropost... |
module StaticHelper
def glossary_nav_link_to(letter)
clazz = (@current_letter == letter ? 'current' : '')
smooth_link_to letter, "#glossary-section-#{ letter }", class: clazz
end
def glossary_ref(word, id = nil)
id = UnicodeUtils.downcase(word) if id.nil?
link_to word, "#wo... |
class Animal
attr_reader :name
def self.phyla
['worms', 'the kind of molluscs', 'the other wormy stuff', 'the symmetrical ones with the backend']
end
def initialize(name)
@name = name
end
def eat(food)
"#{name} eats #{food}."
end
end |
# frozen_string_literal: true
RSpec.describe 'kiosks/new', type: :view do
before do
assign(:kiosk, build(:kiosk))
assign(:kiosk_layouts, KioskLayout.all)
render
end
it 'renders new kiosk form' do
assert_select 'form[action=?][method=?]', kiosks_path, 'post' do
assert_select 'input#kiosk_na... |
Rails.application.routes.draw do
resources :countries, only: [:index, :show]
resources :travelers, only: [:index, :show]
resources :vacations, only: [:new, :create]
end
|
system ('clear')
puts "Welcome to My Tournament Generator. Enter a selection: "
puts "1. Enter teams"
puts "2. List teams"
puts "3. List matchups"
puts "0. Exit program"
selection = gets.chomp
class Tournament
def initialize (newTeam)
@newTeam = newTeam
end
#Could this be a Hash? Can you use ins... |
module D13P1
class D13P1
def run(input)
start_time = input[0].to_i
busses = input[1].split(",")
earliest = start_time*2
earliest_buss = nil
busses.each do |buss|
if buss != "x"
buss = buss.to_i
wait_time = (buss-(start_time%buss))
depart = start_... |
require 'spec_helper'
describe Cancannible do
let(:grantee_class) { Member }
let(:grantee) { grantee_class.create! }
describe "#abilities" do
subject { grantee.abilities }
context "when get_cached_abilities provided" do
before do
Cancannible.get_cached_abilities = proc{|grantee| "get_cach... |
require 'net/http'
class Api::WordsController < ApplicationController
def create
@word = Word.find_or_create_by(word: word_params[:secretWord])
if @word.save
render :show
else
render json: @word.errors.full_messages, status: 422
end
end
def show
@word = Word.find_by(params[:id])
... |
require 'bel'
module OpenBEL
module Resource
module Nanopub
class AnnotationTransform
SERVER_PATTERN = %r{/api/annotations/([^/]*)/values/([^/]*)/?}
RDFURI_PATTERN = %r{/bel/namespace/([^/]*)/([^/]*)/?}
URI_PATTERNS = [
%r{/api/annotations/([^/]*)/values/([^/]*)/?},
... |
description 'Engine subsystem'
dependencies 'utils/cache'
# Engine context
# A engine context holds the request parameters and other
# variables used by the engines.
# It is possible for a engine to run sub-engines. For this
# purpose you create a subcontext which inherits the variables.
class Olelo::Context
include... |
#
# Cookbook:: p
# Recipe:: default
#
# Copyright:: 2018, The Authors, All Rights Reserved.
# include_recipe "on_failure::default"
# include_recipe "poise-python"
platform_family = node['platform_family']
# Check if the OS is Windows Subsystem for Linux (WSL)
is_wsl = node['os'] == 'linux' && node['kernel']['release... |
# For advanced users:
# You can put some quick verification tests here, any method
# that starts with the `test_` will be run when you save this file.
# Here is an example test and game
# To run the test: ./dragonruby mygame --eval tests.rb --no-tick
class Stuff
attr_accessor :number, :number2, :string1, :array1
... |
RSpec.describe "Users can edit a comment" do
let(:beis_user) { create(:beis_user) }
let(:partner_org_user) { create(:partner_organisation_user) }
let(:project_activity) { create(:project_activity, organisation: partner_org_user.organisation) }
let!(:project_activity_report) { create(:report, :active, fund: pro... |
module API
module V1
class APIController < ActionController::API
def api_key
key = request.headers['X-Api-Key']
@api_key ||= APIKey.find_by(key: key)
end
before_action :authenticate
rescue_from Exception do |error|
handle_error(error) if error
end
pro... |
#encoding: utf-8
require 'spec_helper'
describe "SaldosBancarios" do
describe "como usuario" do
before do
@user = Factory(:user)
@fecha = "25/09/2012 23:06"
@saldo = Factory(:saldo_bancario, :user => @user, :updated_at => @fecha)
end
describe "formulario edición" do
before do
... |
class EventsController < ApplicationController
def index
@events = Event.all.where(recipient_id: current_user.id).reverse
end
end
|
module QUnited
module Rails
class TestTask < ::Rake::TaskLib
include ::Rake::DSL if defined?(::Rake::DSL)
TMP_DIR_NAME = 'qunited-compiled-js'
# Name of task.
#
# default:
# :qunited
attr_accessor :name
# Array or strings specifying logical paths of Assets. The... |
module Api
module V2
class LocationPackagesController < Api::BaseController
respond_to :json
def show
location = Location.where(id: params[:id]).first
return render status: 404, json: { status: :failed, error: 'Resource not found' } unless location.present?
location_packages ... |
# Pad an Array
# I worked on this challenge with Sarah Finken.
# I spent [3] hours on this challenge.
# Complete each step below according to the challenge directions and
# include it in this file. Also make sure everything that isn't code
# is commented in the file.
# 0. Pseudocode
# What is the input?
# An arr... |
module Mic
module Config
# REPOSITORY_BASE = '/opt/vhod/repositories/'
# SVN_BASE = 'svn://vhod/'
# REPOSITORY_LAYOUT = ['root']
MIN_LOG_MESSAGE_LENGTH = 2
# VHOD_PATH = '/opt/vhod/webapp/current'
# список Ip с участка МОК оборудование MPV(см. IP)
MPV_CD_IP_LIST = %w( 172.17.7.11
... |
require 'rails_helper'
RSpec.describe "V1::Projects", type: :request do
describe '#index' do
let(:team) { create(:team_with_users) }
let(:another_team) { create(:team_with_users) }
let(:project) { create(:project, name: 'Hello world', user: team.users.first, team: team) }
let(:another_project) { crea... |
require "rails_helper"
feature "Job" do
background { sign_in }
context "creation" do
let(:job) { build_with_attributes(Job) }
background do
visit company_path(job.company)
click_link("New Job")
end
scenario "succeeds w/ valid input" do
fill_in :job_title, with: job.title
... |
Rails.application.routes.draw do
resources :relations
resources :relatives
resources :historics
resources :disappeareds
resources :streets
resources :districts
resources :cities
resources :states
resources :countries
resources :statuses
devise_for :users #users/sign_in users/sign_up users/sign_ou... |
class Tweet < ActiveRecord::Base
include ImageCacheable
has_and_belongs_to_many :you_tube_videos
validates_presence_of :twitter_id
validates_uniqueness_of :twitter_id
RATE_REQUESTS_CHUNK = 15
RATE_REQUESTS_LIMIT = RATE_REQUESTS_CHUNK * 10
RATE_SLEEP = 15 * 60
def self.populate(options = {})
unle... |
# coding: utf-8
# 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.creat... |
# frozen_string_literal: true
class Team < ApplicationRecord
has_many :team_users
has_many :users, through: :team_users
has_one :category
validates :name,
presence: true,
uniqueness: true
end
|
#
# Be sure to run `pod lib lint ODCustomFramework.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'O... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.