text stringlengths 10 2.61M |
|---|
require 'spec_helper'
describe Lolita::Configuration::NestedList do
let(:dbi){ Lolita::DBI::Base.create(Post) }
let(:comment_dbi){ Lolita::DBI::Base.create(Comment) }
let(:list_class){ Lolita::Configuration::List }
let(:nested_list_class){ Lolita::Configuration::NestedList }
it "should create new nested lis... |
# frozen_string_literal: true
module TugoCommon
module ErrorHandler
class BaseHandler
include Gruf::Errors::Helpers
attr_reader :error, :request
def initialize(request, exception)
@error = Gruf::Error.new
@request = request
@exception = exception
end
def ha... |
=begin
#==============================================================================
Title: Event Trigger Labels
Author: Hime
Date: Dec 22, 2014
------------------------------------------------------------------------------
** Change log
Dec 22, 2014
- fixed bug where page list is not properly reset after exec... |
require_relative '03_searchable'
require 'active_support/inflector'
# Phase IVa
class AssocOptions
attr_accessor(
:foreign_key,
:class_name,
:primary_key,
)
def model_class
p "The model class is #{self.class_name.to_s.constantize}"
self.class_name.to_s.constantize
end
def table_name
... |
module ApplicationHelper
# Get a unique HTML hex color for a particular deployment environment
def uniq_env_color(environment)
environment = environment.to_s.downcase
case environment
when 'production'
#return "#FF7F02" # orange-red
return "#BB0000" # red
when 'staging', 'prince... |
class Exporter::Citations < Exporter::Exporter
def column_definitions
column("ticket_number") { record.citation.ticket_number }
column("issuing_agency") { record.citation.issuing_agency }
column("officer_number") { record.citation.officer_number }
column("ticket_type") { record.citation.ticket_type }
... |
# ----------------------------------------------------------------------------------------------------------------------
#
# Generates txt files that can be cut-and-pasted into a javascript file.
# - Certain characters will be escaped (e.g. \ and ')
# - Each line will be surrounded by single quotes, and all but the la... |
class CommentSerializer
include FastJsonapi::ObjectSerializer
attributes :text, :created_at, :project_id
end |
class SignDocuments < ApplicationUseCase
def initialize(documents, signature, employer)
@documents = documents
@signature = signature
@employee = documents.first.employee
@employer = employer
end
def perform
@documents.reject(&:finalised?).each do |document|
document.update!(processing:... |
FactoryGirl.define do
factory :restaurant do
name 'restaurant 01'
created_at Time.now
updated_at Time.now
end
factory :dish do
name 'dish 01'
price '12.90'
association :restaurant, factory: :restaurant
created_at Time.now
updated_at Time.now
end
end
|
RSpec.describe Knuckles::Keygen do
FakeKeyModel = Struct.new(:id, :updated_at)
describe ".cache_key" do
it "provides a simple default cache key" do
cache_key = Knuckles::Keygen.expand_key(FakeKeyModel.new(123, Time.now))
expect(cache_key).to match(%r{FakeKeyModel/123/\d+})
end
it "respect... |
require 'rails_helper'
RSpec.describe AddsSurveysToCensus, type: :model do
describe 'for a given census adds a survey for each locality' do
before(:each) do
@census = create(:census, name: "2020")
@atlanta = create(:locality, city: 'Atlanta')
@athens = create(:locality, city: 'Athens')
end... |
class ExportsController < ApplicationController
before_filter :login_required
filter_access_to :all
def index
models = Export.get_models.map{|k| k.last}
@exports = Export.paginate(:conditions => ["model IN (?)", models], :per_page => 20, :page => params[:page])
@outdated = @exports.select{ |e| e.is... |
# Your code goes here!
class Anagram
attr_accessor :word
def initialize(word)
@word = word
end
def match(array)
anagrams = []
array.each do |word|
if word.split('').sort == self.word.split('').sort
anagrams << word
end
end
anagrams
end
end
|
module Podio
module File
include Podio::ResponseWrapper
extend self
# Uploading a file is a two-step operation
# First, the file must be created to get a file id and the path to move it to
def create(name, content_type)
response = Podio.connection.post do |req|
req.url "/file/"
... |
require 'rails_helper'
describe FriendRepository do
TAGGABLE_FRIENDS_FIXTURE = [{
'id' => 'some long alphanumeric number',
'name' => 'Joe Boggs',
'picture' => {
'data' => {
'url' => 'https://someurl.com'
}
}
},
{
'id' => 'some other long alphanumeri... |
class Recipe < ApplicationRecord
belongs_to :user
has_many :ingredients, dependent: :destroy
has_many :directions, dependent: :destroy
accepts_nested_attributes_for :ingredients,
reject_if: proc { |attributes| attributes['name'].blank? },
allow_d... |
module Bacon
class Context
include ::Elevate
end
end
describe Elevate do
extend WebStub::SpecHelpers
describe "#async" do
it "runs the specified task asynchronously" do
async do
task do
true
end
on_finish do |result, exception|
@called = result
... |
class CreatePenalties < ActiveRecord::Migration[5.1]
def change
create_table :penalties do |t|
t.integer :amount
t.boolean :paid, :false
t.integer :customer_id
end
end
end
|
class Admin::EmployeesController < Admin::BaseAdminController
include TimelineHelper
load_and_authorize_resource
skip_load_resource only: :birthdays
before_action :set_employees, only: :compare
before_action :set_sections, except: %i[index destroy]
before_action :build_documents, only: %i[new edit]
before... |
class Book < ApplicationRecord
belongs_to :user
#本の感想の本分は最大200文字
validates :body,length: { maximum: 200 }
validates :title,presence: true
end
|
class WalletController < ApplicationController
require 'payjp'
before_action :set_card
before_action :set_user
before_action :get_payjp_info, only: [:new, :create, :destroy, :show, :index]
# カード情報があれば表示して、なければ追加するボタン
def index
wallet = current_user.wallet
if wallet.present?
customer = Payjp::... |
module ParseRedom
class SeanceParser < Parser
NodesPath = '//schedule/section'.freeze
def nodes_xpath
NodesPath
end
def parse_node(section_node)
r_id = section_node.attributes['id'].value
unless Seance.where(r_id: r_id).exists?
Seance.build_me do |seance|
... |
# frozen_string_literal: true
module Zafira
module Api
module TestCase
class Start
include Concerns::Apiable
START_ENDPOINT = '/api/tests'
def start
retryable { HTTParty.post(*request_params) }
end
private
def request_params
[endpoint,... |
require 'bigdecimal/util'
class NilClass
def to_d
BigDecimal("0")
end
end |
class CreateSaque < ActiveRecord::Migration
def change
create_table "deposito" do |t|
t.decimal "valor", precision: 20, scale: 2
t.datetime "created_at"
t.string "conta_destino_id", limit: 6, null: false
t.string "conta_origem_id", limit:... |
class Admin::UsersController < Admin::BaseController
public
# GET /users
def index
@users = User.paginate(:page => params[:page])
end
end |
class ChangeClassOfPublic < ActiveRecord::Migration
def change
remove_column :experiments, :public
add_column :experiments, :public, :integer
end
end
|
class CommentsChannel < ApplicationCable::Channel
def subscribed
stream_for "comments_#{params[:question_id]}"
end
def follow(data)
unfollow
stream_from "question_#{data['id']}_comments"
end
def unfollow
stop_all_streams
end
end
|
require_relative './cart'
require_relative './service/cashier'
require 'tty/prompt'
class Bakery
attr_accessor :cart
def initialize
@cart = Cart.new
@prompt = TTY::Prompt.new
# Set available product
@products = [
{ key: "VS5", name: "Vegemite Scroll", value: "VS5" },
{ key: "MB11", ... |
class Feeder < Cask
url 'http://reinventedsoftware.com/feeder/downloads/Feeder_2.4.4.dmg'
homepage 'http://reinventedsoftware.com/feeder/'
version '2.4.4'
sha1 '44c0b945d65f515be47f62c13710ba01813d1957'
link 'Feeder.app'
end
|
module TimeArray
class NilStartTimeError < RuntimeError
end
class NilVectorError < RuntimeError
end
class DateTimeOutRangeError < RuntimeError
end
end |
class IdeasController < ApplicationController
before_action :authorize
def show
@idea = Idea.find(params[:idea_id])
render json: @idea
end
def create
@idea = current_member.ideas.create(idea_params)
redirect_to team_path(code: current_team.code)
end
protected
def idea_params
par... |
########################################################################
# Creates new mother plant along with other dependency if they doesnt exists.
# This includes: vendor, strain, inventory item
########################################################################
module Inventory
class SetupMother
pre... |
# frozen_string_literal: true
module Milestoner
module Errors
# Raised for duplicate tags.
class DuplicateTag < Base
end
end
end
|
require 'rails_helper'
RSpec.describe 'as a user' do
describe 'can visit an amusement parks show page' do
it 'can see the name and price of admission, all rides in alphabetical order, and the average thrill rating' do
amusement_park1 = AmusementPark.create(name: 'Six Flags', admission_price: 50)
rid... |
class AddContractToExchange < ActiveRecord::Migration
def change
add_column :exchanges, :contract, :boolean
end
end
|
require 'spec_helper'
#Essentially, we use this to control the user interaction with our code.
#Refers to the Tasks controller
describe "Tasks" do
before :each do
@task = Task.create :task => "go to bed"
end
#Here we are looking at the GET request in /tasks.
describe "GET /tasks" do
it "dis... |
module AchievementConcerns
module InstitutionUserAchievementable
extend ActiveSupport::Concern
include AchievementConcerns::SimpleAchievementable
included do
after_update do
accepted_as_institution_user
end
end
private
def accepted_as_institution_user
if self.change... |
# frozen_string_literal: true
class Order < ApplicationRecord
has_many :sold_products
belongs_to :customer
# validates :customer, presence: true
validates :province, presence: true
validates :city, presence: true
validates :street_name, presence: true
validates :street_no, presence: true
end
|
# frozen_string_literal: true
class DataSnapshot < ApplicationRecord
extend Concerns::Statisticable
enum kind: { branch: 0, event: 1 }
validate :validates_datalink
def linked_entity
self.class.class_constant(kind).find(linked_id)
end
class << self
def take_snapshot!(kind, sub_category)
ret... |
class AddFieldsToCharacter < ActiveRecord::Migration
def change
add_column :characters, :description, :text
add_column :characters, :refresh, :integer
end
end
|
require 'rails_helper'
RSpec.describe 'deleting comment' do
it "deletes comment and redirects to the products show page" do
category = Category.create(name: "Category1")
product = category.products.create(name: "Product1", description: "This is good", price: 10.00)
comment = product.comments.create(comment: "Comm... |
class CreateWeeklynotes < ActiveRecord::Migration
def self.up
create_table :weeklynotes do |t|
t.column :user_id, :integer, :null => false
t.column :note, :text
t.column :start_date, :datetime, :null => false
t.column :end_date, :datetime, :null => false
t.timestamps
end
end
... |
class SitterInstructionsPdf < Prawn::Document
def initialize(animal)
super()
@animal = animal
@owner = animal.owner
top_header
demographics
feeding_info
special_instructions
end
def top_header
image "#{Rails.root}/app/assets/images/animal_minder.png", at: [bounds.right - 200, bo... |
require 'spec_helper'
describe Zygote::Seeder do
let(:seeder) { Zygote::Seeder.new }
describe "#define/#seed" do
let(:definition_1) { double(:definition_1) }
let(:definition_2) { double(:definition_2) }
it "upserts defined seeds" do
expect(Zygote::Upsert).to receive(:perform).with(definition_1... |
require 'test/unit'
require 'minitest/reporters'
MiniTest::Reporters.use!
class Proc
def call_handling(an_exception_class,&handler)
call_handling_when lambda { |an_exception | an_exception_class.handles? an_exception },&handler
end
def call_handling_when(a_condition,&handler)
return_continuation = proc ... |
# == Schema Information
#
# Table name: users
#
# id :integer not null, primary key
# user_name :string(255)
# franchise_set_number :string(255)
# user_domain :string(255)
# franchise_set_id :integer
# created_at :datetime
# updated_at :dateti... |
# frozen_string_literal: true
require_relative 'benchmark_base'
# Forest benchmark class
class ForestBenchmark < BenchmarkBase
def default_config
toml_str = syscall(target_cli, '--chain', @chain, 'config', 'dump')
default = Tomlrb.parse(toml_str)
default['client']['data_dir'] = data_dir
default
e... |
class Card
attr_reader :suit, :value
def initialize(suit, value)
@suit, @value = suit, value
end
def value
return 10 if ["J", "Q", "K"].include?(@value)
return 11 if @value == "A"
return @value
end
def to_s
"#{@value}-#{@suit}"
end
end
class Deck
attr_reader :cards
def initialize
... |
# now_i_know_my_abc.rb
# A collection of spelling blocks has two letters per block, as shown in this
# list:
# B:O X:K D:Q C:P N:A
# G:T R:E F:S J:W H:U
# V:I L:Y Z:M
# This limits the words you can spell with the blocks to just those words that
# do not use both letters from any given block. Each ... |
class PlayerController < ApplicationController
get '/players' do
redirect_if_not_logged_in
@players = Player.all
erb :'players/players'
end
get '/players/new' do
redirect_if_not_logged_in
erb :'players/create_player'
end
post '/players' do
redirect_if_not_logged_in
if params[:pl... |
# frozen_string_literal: true
Hanami.application.register_bootable :jay_doubleu_tee do |container|
init do
require 'jay_doubleu_tee'
end
start do
JayDoubleuTee.configure do |config|
config.algorithm = 'RS256'
config.secret = container[:settings].jwt_public_key
end
end
end
|
# Setup currency when object created by time
module CurrencyExchange
def set_currency_exchanges
if self.currency_exchanges.blank?
self.currency_exchanges = SystemConfiguration.currency_exchanges
end
end
end
|
require 'spec_helper'
describe Koite::FileTemplate do
path = File.expand_path('../../templates/post.koi', __FILE__)
raw_string = File.read(path)
subject { described_class.new(path) }
describe "raw_string" do
it "returns template as a string without interpolation" do
expect(subject.raw_string).to b... |
require "base_stitch"
class DoubleCrochet < BaseStitch
def make
self.class.abbrev
end
def self.abbrev
"dc"
end
def count
1
end
end
|
class CreateMoIssue < ActiveRecord::Migration
def change
create_table :mo_issue, id: false do |t|
t.string :uuid, null: false
t.string :budat
t.string :mblnr
t.string :mjahr
t.string :zeile
t.string :aufnr
t.string :matnr, null: false
t.string :charg, null: false
... |
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
describe "/users/show.html.erb" do
include UsersHelper
before(:each) do
assigns[:user] = @user = stub_model(User,
:first_name => "value for first_name",
:middle_name => "value for middle_name",
:last_name => "value for... |
json.extract! @folder, :id, :name, :url_name, :created_at
json.type @folder.class.name
json.filters @folder.filters do |filter|
json.extract! filter, :id, :name
end
json.url profile_submission_folder_url(@profile, @folder)
json.submissions @submissions do |submission|
json.extract! submission, :id, :title, :... |
#encoding:utf-8
class UsersController < ApplicationController
before_action :select_user, only: [:show, :edit, :update, :destroy]
before_action only: [:edit, :update, :destroy] do
validate_permission! select_user
end
def new
@user = User.new
@groups = Group.all
end
def create
if user_param... |
class CreateGameItemAnswers < ActiveRecord::Migration
def change
create_table :game_item_answers do |t|
t.references :game_item, index: true
t.references :user, index: true
t.boolean :correct
t.string :reply_word
t.timestamps null: false
end
add_index :game_item_answers, :co... |
require 'tty-prompt'
require 'tty-command'
class DemoPrompt < TTY::Prompt
def initialize
@quiet_cmd = TTY::Command.new(uuid: false,
pty: true,
printer: :quiet)
super
end
def quiet_command(command)
@quiet_cmd.run!(command)
end
d... |
module AcceptanceHelper
def sign_in(user)
visit new_user_session_path
fill_in 'Email', with: user.email
fill_in 'Password', with: user.password
click_on 'Log in'
end
def sign_out
visit '/'
click_on 'log_out'
end
def create_menu(admin, item)
sign_in(admin)
visit admin_menus_pa... |
class PicksController < ApplicationController
before_action :set_pick, only: [:show, :edit, :update, :destroy]
before_action :authenticate_user!, except: [:index, :show]
before_action :correct_user, only: [:edit, :update, :destroy]
# GET /picks
# GET /picks.json
def index
@picks = Pick.all
end
#... |
class CommentObserver < ActiveRecord::Observer
def after_create(comment)
Notifier.comment_added(comment).deliver
end
end
|
class Item < ApplicationRecord
validates :name, :description, :unit_price, :merchant_id, presence: true
validates_associated :merchant
belongs_to :merchant
has_many :invoice_items, dependent: :destroy
has_many :invoices, through: :invoice_items
has_many :transactions, through: :invoices
def self.obtain_... |
class Stack
def initialize
@top = -1
@stack = []
@minStack = []
@minIndex = -1
end
def size
@top + 1
end
def isEmpty
size == 0
end
def push(item)
@top += 1
@stack[@top] = item
if(@minIndex == -1 || item <= self.minimum)
@minIndex += 1
@minStack[@minIndex]... |
require "ruby_admin/version"
require "ruby_admin/support/ruby18_compat"
# +RubyAdmin+ is a library for interacting, programmatically, with the
# resources that surround a system administrator.
#
# A Unix host is just a resource, a programmable switch is a resource,
# a web service is a resource, and much more can be s... |
require 'sinatra'
require "sinatra/base"
require "sinatra/json"
require 'gitlab'
require 'json'
require 'active_support/all'
class ExceptionHandling
def initialize(app)
@app = app
end
def call(env)
begin
@app.call env
rescue Gitlab::Error::MissingCredentials
[401, {'Content-Type' => 'ap... |
require 'date'
module HelperMethods
def today
Date.today.strftime('%d%m%y')
end
def random_key
'%05d' % rand(0..99999)
end
end
|
class ChangeUserColorRelation < ActiveRecord::Migration[5.0]
def change
remove_reference(:colors, :users, index: true)
end
end
|
module Slickr
module Generators
class Base
attr_accessor :name
attr_accessor :destination
def initialize(name)
@name = name
@destination = Pathname.new(Dir.pwd)
end
# Create an empty directory at +path+ inside the project.
#
# @param path [String] Path i... |
# 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... |
# frozen_string_literal: true
require 'spec_helper'
require 'bolt/executor'
describe 'catch_errors' do
let(:executor) { Bolt::Executor.new }
let(:tasks_enabled) { true }
around(:each) do |example|
Puppet[:tasks] = tasks_enabled
Puppet.override(bolt_executor: executor) do
example.run
end
end... |
module DataMapper
module NestedAttributes
##
# Extensions and customizations for @see DataMapper::Resource
# that are needed if the @see DataMapper::Resource wants to
# accept nested attributes for any given relationship.
# Basically, this module provides functionality that allows
# either as... |
require 'rails_helper'
context 'logged out' do
before do
Restaurant.create(name: 'Ledbury', cuisine: 'French')
end
it 'cannot delete restaurants' do
visit '/restaurants'
expect(page).not_to have_link 'Delete Ledbury'
end
end
context 'logged in as the restaurant creator' do
before do
alex = User.create(em... |
# SOAP4R - SOAP RPC driver
# Copyright (C) 2000, 2001, 2003-2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
# redistribute it and/or modify it under the same terms of Ruby's license;
# either the dual license version in 2003, or any later version... |
json.array!(@pins) do |pin|
json.extract! pin, :id, :order, :tour_id, :title, :caption, :photo, :latitude, :longitude
json.url pin_url(pin, format: :json)
end
|
require "fdb"
class LearningSwitch < Controller
add_timer_event :age_fdb, 5, :periodic
# Cria o Fowarding Data Base
def start
@fdb = FDB.new
end
# Confirmando a execução do Controller dentro do Mininet
def switch_ready datapath_id
info "Caching controller running at switch %#x!" % datapath_id
e... |
require 'test_helper'
class MembersSignupTest < ActionDispatch::IntegrationTest
# test "the truth" do
# assert true
# end
def setup
ActionMailer::Base.deliveries.clear
end
test "invalid signup information" do
get signup_path
assert_no_difference 'Member.count' do
post members_path, memb... |
module Sales
class PackageOrderSerializer
include FastJsonapi::ObjectSerializer
attributes :order_no, :status
attribute :use_type do |x|
'Medical'
end
attribute :fulfilment_date do |x|
['2 Nov 2019', '3 Nov 2019', '4 Nov 2019'].sample
end
attribute :delivery_date do |x|
... |
module TasksHelper
def task_priority_class(priority)
case priority
when "L"
"label label-purple arrowed-in-right arrowed center"
when "M"
"label label-yellow arrowed-in-right arrowed center"
when "H"
"label label-pink arrowed-in-right arrowed center"
end
end
end
|
class PortfoliosController < ApplicationController
def index
@portfolios = Portfolio.all
render layout: false
end
def show
@portfolio = Portfolio.find(params[:id])
render layout: false
end
end
|
class AddAboutMeToProfile < ActiveRecord::Migration
def change
add_column :user_profiles, :aboutme, :string
end
end
|
# encoding: utf-8
# frozen_string_literal: true
module Mail #:nodoc:
module Multibyte #:nodoc:
# Raised when a problem with the encoding was found.
class EncodingError < StandardError; end
end
end |
module OfficeAutomationInvoice
class Invoice
include Mongoid::Document
include Mongoid::Timestamps
## Fields
field :number, type: Integer, default: ->{ self.class.count + 1 }
field :issue_date, type: Date
field :due_date, type: Date
field :schedule_type
field :schedule_period, type: I... |
namespace :find_the_best do
desc 'Generate all videos for FindTheBestLocation records'
task generate_all: :environment do
FindTheBestLocation.includes(:video).find_each do |ftb|
begin
VideoGenerator.new(ftb).generate
rescue => e
Honeybadger.notify(e, context: {find_the_best_location_... |
# classes useful for running test cases
# e represents epsilon
# L represents letters
# D represents digits
# Q represents question mark ? in input
# E represents exclamation mark ! in input
# P represents period . in input
# C represents comma , in input
# K represents colon : in input
# M represents minus sign - in ... |
class ApplicationController < ActionController::Base
protect_from_forgery
check_authorization :unless => :devise_controller?
before_action :configure_permitted_parameters, if: :devise_controller?
before_action :set_help_text
#before_filter :authenticate_user!
helper_method :current_user
helper_method :cur... |
class Author < ActiveRecord::Base
has_many :review
validates(:name, :presence => true)
end
|
class GetCollaborations
include Interactor
def call
tender = Core::Tender.where(id: index_params[:tender_id]).first
unless tender.present?
context.fail! errors: { error: :unprocessable_entity, error_description: 'Tender not found'},
code: :unprocessable_entity
end
profile... |
#!/usr/bin/ruby
require './microtest'
def react(s)
s.chars.reduce("") do |memo, x|
y = memo[-1]
if !y.nil? && x != y && x.upcase == y.upcase
if memo.length == 1
""
else
memo[0..memo.length - 2]
end
else
memo + x
end
end
end
class Tests < Microtest::Test
def test_react_aA
assert_equal... |
class FixUnitsInSections < ActiveRecord::Migration
def change
remove_column :sections, :parsedUnits
add_column :sections, :units, :decimal
end
end
|
class Item < ActiveRecord::Base
belongs_to :user
validates :name, presence: true
mount_uploader :file, FileUploader
def days_left
7 - (DateTime.now.to_date - created_at.to_date).to_i
end
end
|
# frozen_string_literal: true
require "rails_helper"
RSpec.describe "update course", type: :system do
let(:user) { FactoryBot.create(:user) }
let(:subject) { FactoryBot.create(:subject, user: user) }
let!(:course) { FactoryBot.create(:course, subject: subject) }
before { sign_in user }
describe "with empt... |
class Settings::OrganizationsController < ApplicationController
before_action :set_organization, except: :index
layout 'settings'
def index
set_meta_tags title: "Teams | Settings",
description: "List of organization memberships"
@organizations = policy_scope([:settings, Organization])
... |
require_relative '../../test_helper'
class CmsBlankTest < ActiveSupport::TestCase
def setup
@object = Object.new
@object.extend(MomentumCms::Tags::CmsLiquidUtils)
end
def test_context
assert_equal @object.context_get({ :foo => 'bar' }, :bar, :baz), :baz
end
def test_params
params = nil
... |
class ArticleTagType < ActiveRecord::Base
has_many :article_tags
end
|
require 'spec_helper'
describe ContextIO::Folder do
before(:each) do
@fixtures_path = File.expand_path(File.join(File.dirname(__FILE__), 'fixtures'))
account_id = 'abcdef1234567890'
@account = ContextIO::Account.new
@account.instance_eval do
@id = account_id
end
source_label = 'me@examp... |
namespace :users do
desc 'Calculate wasted_time'
task :calculate_wasted_time => :environment do
count = User.count
User.find_each do |user|
puts "User #{user.id}/#{count}: #{user.name}"
user.update_attribute :wasted_time, user.singles.not_dnf.sum("singles.time") / 1000
end
end
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.