text stringlengths 10 2.61M |
|---|
require 'test/unit'
require 'network'
class TestMiscNetwork < Test::Unit::TestCase
def setup
@idgen = NetworkIdGenerator.new
end
def test_new_id
currentval = @idgen.current
@idgen.generateId("unit_text")
nextval = @idgen.current
assert_not_equal(currentval, nextval)
end
end |
#==============================================================================
# ** Pony
#------------------------------------------------------------------------------
# Pony should poni pony
#==============================================================================
$imported = {} if $imported.nil?
module PONY
... |
class Recipe < ApplicationRecord
include PgSearch::Model
belongs_to :author
has_and_belongs_to_many :tags
pg_search_scope :search_recipes,
against: [:ingredients, :name],
associated_against: {
tags: :name
},
#ignoring:... |
module Fog
module Google
class Pubsub
class Real
include Fog::Google::Shared
attr_accessor :client
attr_reader :pubsub
def initialize(options)
shared_initialize(options[:google_project], GOOGLE_PUBSUB_API_VERSION, GOOGLE_PUBSUB_BASE_URL)
options[:google_... |
class Item < ApplicationRecord
validates_presence_of(:name)
end
|
require 'test/test_helper'
class RpxControllerTest < ActionController::TestCase
should_route :get, '/rpx/login', :controller => 'rpx', :action => 'login'
context "rpx login" do
context "create admin user with rpx token" do
setup do
# stub RPXNow
@rpx_hash = {:name=>'sanjay', :email=>'s... |
# encoding: UTF-8
# Copyright 2011-2013 innoQ Deutschland GmbH
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
class FriendshipsController < ApplicationController
def create
gh_user = GhUser.find_by(gh_id: params[:id])
if gh_user.nil?
flash[:error] = 'Invalid user id.'
redirect_to '/dashboard'
elsif gh_user.gh_id
@friendships = current_user.gh_user.friendships.create(friend_id: gh_user.id)
... |
require 'net/http'
require 'rubygems'
require 'json'
require 'pry'
module Weather
Key = '716a3eaec665ff95'
def self.find_by_zipcode(code='94107')
uri = URI("http://api.wunderground.com/api/#{Key}/forecast10day/q/#{code}.json")
response = Net::HTTP.get_response(uri)
parse_response(JSON.parse(response.b... |
class Palindrome
attr_reader :start, :end
def initialize(range)
@start = range.first
@end = range.last
end
def find_palindromes
palindromes_array = []
(@start..@end).to_a.each do |number1|
(number1..@end).to_a.each do |number2|
product = number1 * number2
palindromes_arra... |
# Exercisis
# Notes:
# - De vegades demano que la funció mostri (puts) o que retorni (return).
# - De vegades he escrit part de l'exercisi ja. On posa "???" has d'escriure el teu codi.
# - Per cada funció, escriu la definició (def) y també crida a la funció per comprovar que és correcte.
# 1. Escriu una funció que m... |
module GroupsHelper
def link_for_leave_group(group, user)
link_to "Leave group", group_membership_path( group, group.get_membership(user) ), :method => :delete,
:confirm => "Are you sure you want to leave this group?"
end
def group_name_helper(group)
membership = group... |
module WWW
class Enbujyo
module ExtendedAgent
def baseurl
URI.parse('http://enbujyo.3594t.com/')
end
def auth_get(url)
url = (baseurl + url).to_s
ret = get(url)
if /error/i =~ page.uri.to_s or /エラー/ =~ page.title
if self.autologin?
login
... |
require 'rails_helper'
describe "When at merchants/:merchant_id/items" do
it "Displays all items sold by that merchant" do
merchant_1 = Merchant.create(name: "Apple",
address: "123 Greedy Ave",
city: "Mountain View",
... |
class AddPreludeToStory < ActiveRecord::Migration
def self.up
add_column :stories, :prelude, :text
end
def self.down
remove_column :stories, :prelude
end
end
|
class Show_char
attr_reader :show, :char
@@all = []
def initialize (show, char)
@show = show
@char = char
@@all << self
end
def self.all
@@all
end
end |
name 'chef-csgo'
maintainer 'Nick Gray'
maintainer_email 'f0rkz@f0rkznet.net'
license 'Apache-2.0'
description 'Installs/configures CSGO dedicated server'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.2.1'
chef_version '>= 12.1' if respond_to?(:chef_version)
issues_url 'https://git... |
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
acts_as_messageable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable, :omniauthable
has_many :micro... |
class ApplicationController < ActionController::Base
protect_from_forgery
add_breadcrumb 'Home', :home_path
rescue_from CanCan::AccessDenied do |exception|
flash[:error] = "Access denied!"
redirect_to root_path
end
def help
Helper.instance
end
class Helper
include Singleton
include Acti... |
module ADCK
class Notification
extend Forwardable
attr_accessor :device_token, :message
def_delegators :message, :alert, :badge, :sound, :other, :as_json
def initialize(device_token, message)
self.device_token = device_token
self.message = Message.build(message)
end
def packaged_... |
class SpaceUpdatesChannel < ApplicationCable::Channel
def subscribed
space = Space.where(id: params[:space_id]).first
stream_for space
end
def unsubscribed
# Any cleanup needed when channel is unsubscribed
end
end
|
class AddFieldsToAnswers < ActiveRecord::Migration[5.0]
def change
change_table :question_answers do |t|
t.column :secondary_answer_text, :string
end
end
end
|
class UsersController < ApplicationController
before_action :logged_in_user
before_action :load_user, only: [:update, :edit, :show]
before_action :permission_user, only: [:show, :edit, :update]
before_action :load_diagnoses, only: :show
before_action :load_owner, only: :show
def show
@title = t "users.i... |
class StripeInvoice
attr_reader :stripe_id, :card_description, :card_charged_at
def initialize(stripe_id, card_description, card_charged_at)
@stripe_id = stripe_id
@card_description = card_description
@card_charged_at = card_charged_at
end
def on_successful_payment
self.subscription.renew
sel... |
require "rails_helper"
RSpec.describe Item, type: :model do
context "with all attributes" do
let!(:item) do
Item.create!(title: "Parka",
description: "Stay warm in the tundra",
price: 3000,
image: "https://s-media-cache-ak0.pinimg.com/236x/90/eb/32/90... |
require 'html5_tokenizer/token_handler'
module Html5Tokenizer
class Scanner
include Html5Tokenizer::TokenHandler
def initialize(html)
@tokenizer = Tokenizer.new()
@tokenizer.insert(html)
@tokenizer.eof()
end
def run()
@tokenizer.run do |token|
handle_token(token)
... |
class Card < ApplicationRecord
belongs_to :employee, optional: true
belongs_to :card_type
validates :card_number, uniqueness: true, numericality: true, length: {is: 16, message: "card number has to be of 16 digit"}
validates :ccv, length: {is: 3, message: "ccv has to be of 3 digits"}, presence: true
validate... |
require 'spec_helper'
describe "Usuario pages" do
subject { page }
describe "signup page" do
before { visit signup_path }
it { should have_content('Registrate') }
it { should have_title(full_title('Registrate')) }
end
describe "edit" do
let(:usuario) { FactoryGirl.create(:usuario) }
b... |
require_relative 'helpers/total_count'
# Used when render_paginated is called with an ActiveModel directly, with will_paginate
# already required. Something like
### render_paginated DummyModel
module Wor
module Paginate
module Adapters
class WillPaginate < Base
include Helpers::TotalCount
... |
class ProtectedUsernamesValidator < ActiveModel::Validator
PROTECTED = %w{anonymous tipfortip tip4tip reputation tip t4t}
def validate(record)
u = record.username.to_s.downcase.strip
if PROTECTED.include?(u) || Obscenity.profane?(u)
record.errors.add :username, :invalid
end
end
end
|
class UserMailer < ApplicationMailer
# Subject can be set in your I18n file at config/locales/en.yml
# with the following lookup:
#
# en.user_mailer.notify_comment.subject
#
default :from => "小農橋"
def notify_comment(user, comment)
@comment = comment
mail(:to => user.email, :subject => ... |
module LibreFrame
module Core
module Pathing
# Given a Cairo context and a point path, plots the point path onto the
# Cairo context. The path is NOT reset; this is the caller's
# responsibility if desired.
# @param ctx [Cairo::Context] The Cairo context to use. The current path
# ... |
require 'yaml'
require 'hashie'
module Dogen
class Configuration
class SetConfigError < StandardError; end
CONFIG_FILE_NAME = '.dogenrc'
def get
File.exist?(config_file) ? load_configuration : {}
end
def set(hash)
raise SetConfigError, 'argument is not kind of hash' unless hash.kin... |
class GeneratedContent < ActiveRecord::Base
####
# MODEL ANNOTATIONS
####
extend ValidationHelper
####
# RELATIONSHIPS
####
belongs_to :cobrand
belongs_to :data_source, :polymorphic => true
####
# VALIDATORS
####
text_validator :name, 1, 64, '[:graph:][:space:]'
text_valida... |
#!/usr/bin/env rake
require "bundler/gem_tasks"
require 'rake/testtask'
Rake::TestTask.new do |t|
t.libs.push "lib"
t.test_files = FileList['test/*_test.rb']
t.verbose = true
end
require 'rspec/core/rake_task'
desc 'Default: run specs.'
task :default => :spec
desc "Run specs"
RSpec::Core::RakeTask.new do |t|... |
require 'date'
module UsersHelper
def get_user_info(screen_name)
requestor = User.find(session[:user_id])
retrieved_information = Twitter.execute({user: requestor, request_type:"users/show.json?screen_name=#{screen_name}"})
user_information = {
profile_picture: retrieved_information["profile_... |
FactoryBot.define do
factory :panel_provider do
code { Faker::IDNumber.valid }
end
end |
class Blog < ActiveRecord::Base
has_many :owners
has_many :posts
has_many :users, through: :owners
validates :name, :description, presence: true
end
|
array = [ "a", 1, nil ]
array.each do |item|
case item
when String
puts "item is a String."
when Numeric
puts "item is a Numeric."
else
puts "item is something."
end
end
# 执行结果为
# > ruby case_class.rb
# item is a String.
# item is a Numeric.
# item is something.
# 在本例中,程... |
# == Schema Information
#
# Table name: product_prices
#
# id :integer not null, primary key
# product_id :integer
# sheet_id :integer
# extend_count :integer
# price :integer
# created_at :datetime not null
# updated_at :datetime not null
#
class ProductPrice... |
require_relative '../scripts/convert_txt_to_sql.rb'
describe ConvertToSql do
let(:table_name) {'teams'}
let(:expected_columns) {["id", "name", "created_at", "updated_at", "external_id"]}
let(:file_lines) do
["id | name | created_at | updated_at | external_id",
"-... |
require File.expand_path("../../../../../../spec/spec_helper", __FILE__)
require File.expand_path("../../event_spec_helper", __FILE__)
describe EventEvent do
it "should require a name and type" do
@event = EventEvent.new
@event.should have(1).error_on(:event_type_id)
@event.should have(1).error_on(:name)... |
# frozen-string-literal: true
module EncryptedFormFields
module Helpers
module FormBuilder
def encrypted_field(method, options = {})
@template.encrypted_field(@object_name, method, objectify_options(options))
end
private
def objectify_options(options)
@default_options.mer... |
# -*- coding: utf-8 -*-
module Mushikago
module Tombo
# キャプチャ一覧取得リクエスト
class CapturesRequest < Mushikago::Http::GetRequest
def path; '/1/tombo/captures' end
request_parameter :id
request_parameter :limit
request_parameter :offset
request_parameter :domain
request_parameter... |
class List < ActiveRecord::Base
attr_accessible :name, :description, :user_id, :min_cost, :max_cost
belongs_to :user
has_many :items
def sections
self.items.map { |i| i.section }.uniq
end
end
|
module Yt
module Models
# @private
# Encapsulates information about the ID that YouTube uses to uniquely
# identify a resource.
class Id < String
end
end
end |
class RemoveDateSinceFromSuppliers < ActiveRecord::Migration
def up
remove_column :suppliers, :date_since
end
def down
add_column :suppliers, :date_since, :date
end
end
|
class RegistrationPage < Howitzer::Web::Page
path '/register'
validate :url, %r{\/register$}
validate :title, /^Create An Account \| Famous Smoke$/
section :header
section :email_modal_blocker
element :email_field, '.register_form [name=email]'
element :password_field, '.register_form ... |
Pod::Spec.new do |s|
s.name = 'CommonUtilsGame'
s.version = '1.0.2'
s.summary = 'CommonUtils extension for Game.'
s.homepage = 'https://bitbucket.org/mrklteam/commonutilsgame/'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { 'Karen Lusinyan' => 'k... |
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
BASE_IP = "192.168.56.10"
MASTER_IP = "192.168.56.20"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define "master" do |master|
master.vm... |
describe SolidusYotpo::Review, type: :model do
let(:user) { create(:user) }
let(:order) { create(:order_ready_to_ship, user: user) }
let(:line_item) { order.line_items.first }
let(:variant) { line_item.variant }
let(:product) { variant.product }
let(:review) { create(:review, product: product, user: user) }... |
# frozen_string_literal: true
require 'spec_helper'
require './lib/anonymizer/model/database/static.rb'
RSpec.describe Database::Static, '#static' do
it 'should exists class Static' do
expect(Object.const_defined?('Database::Static')).to be true
end
it 'should return valid query for some value' do
info... |
# frozen_string_literal: true
FactoryBot.define do
factory :user_exam_variant do
score { (rand(1..100)).to_d }
user { create :user }
exam_variant { create :exam_variant }
end
end
|
module ApplicationHelper
def app_name
@app_name ||= Figaro.env.APP_NAME
end
def avatar_url(user, size=150)
gravatar_id = Digest::MD5::hexdigest(user.email).downcase
"https://www.gravatar.com/avatar/#{gravatar_id}.png?s=#{size}"
end
end
|
FactoryGirl.define do
factory :state do
name "Doing"
end
trait :default do
default true
end
end
|
class RemoveImageFromBuildings < ActiveRecord::Migration
def change
remove_column :buildings, :image, :binary
end
end
|
class SessionsController < ApplicationController
def new
end
def create
# We have the users email and password from the params
#1. first find the user by their email
#2. if found, we authenticate the user with the given password
#3. if authentication not successful, we alert the user with wrong ... |
def prompt(message)
Kernel.puts("=> #{message}")
end
def valid_number?(num)
num.to_i() != 0
end
def operation_to_message(a)
case a
when '1'
'Adding'
when '2'
'Subtracting'
when '3'
'Multiplying'
when '4'
'Dividing'
end
end
prompt("Welcome to calculator! Your name?")
name = ''
loop do
... |
module MobileStores
class AmazonMarketplace
include MobileStore
act_as_html_source
private
def self.apps_url(query = nil, count = nil, country = nil)
url = "http://www.amazon.com/s/?url=search-alias%3Dmobile-apps&"
url = "#{ url }&field-keywords=#{ CGI::escape(query) }&keywords=#{ query... |
# frozen_string_literal: true
require 'singleton'
module Departments
module ThinkTank
module Services
##
# Consumes the {Departments::Intelligence::Api}.
class Intelligence
include Singleton
# @param [Integer] ip {FriendlyResource} ip address.
# @return [Void]
... |
class Power
include Consul::Power
attr_accessor :current_user, :params
def initialize(user, params)
self.current_user = user
self.params = params
end
power :users_index do
User.all
end
power :users_show do
User
end
power :creatable_users do
User
end
power :updatable_users... |
class Alert
include Capybara::DSL
def dark
return find(".alert-dark").text
end
end |
require "amatch"
module Muni
class Direction < Base
def stop_at(place)
if stop = stops.detect { |stop| stop.tag == place }
return stop
end
if stop = stops.detect { |stop| stop.title == place }
return stop
end
pattern = Amatch::Sellers.new(place)
stops.sort_by... |
# pulled from https://github.com/rails/rails/blob/v3.2.22.5/activesupport/lib/active_support/core_ext/numeric/time.rb
class Numeric
def days
ActiveSupport::Duration.new(24.hours * self, [[:days, self]])
end
alias :day :days
def weeks
ActiveSupport::Duration.new(7.days * self, [[:days, self * 7]])
en... |
require_relative 'game_vector'
require_relative 'rectangle'
class Ring
WIDTH = 32
HEIGHT = 32
attr_accessor :pos
attr_accessor :collected
def initialize(pos_x, pos_y)
self.pos = GameVector.new(pos_x, pos_y)
self.collected = false
end
def collected?; collected; end
def rectangle
Rectangl... |
class QueuesController < ApplicationController
rescue_from QueueNotFoundError, with: :render_404
respond_to :html, :json
def index
@queues = queues
end
def show
@queue = queue params[:id]
end
def clear
@queue = queue params[:id]
@queue.clear
respond_to do |format|
format.html... |
module Lazada
module API
module Product
def get_products(params = {})
converted_params = get_product_params(params)
url = request_url('GetProducts', converted_params)
response = self.class.get(url)
process_response_errors! response
response['SuccessResponse']['Body'... |
require "json"
require "yaml"
# Root ProjectRazor namespace
module ProjectRazor
module Slice
# TODO - add inspection to prevent duplicate MK's with identical version to be added
# ProjectRazor Slice Image
# Used for image management
class Image < ProjectRazor::Slice::Base
# Initializes Proje... |
require File.expand_path('../../../../../easy_extensions/test/spec/spec_helper', __FILE__)
describe EasySprintsController do
render_views
let(:project) { FactoryGirl.create(:project) }
let(:sprint) { FactoryGirl.create(:easy_sprint) }
let(:sprints) { FactoryGirl.create_list(:easy_sprint, 3, project: project)... |
class CreateCells < ActiveRecord::Migration[6.0]
def change
create_table :cells do |t|
t.integer :row
t.integer :column
t.integer :status
t.integer :value
t.integer :play_number
t.references :game_board, foreign_key: true
t.timestamps
end
end
end
|
require 'rails_helper'
RSpec.describe MediumDetail, type: :model do
it { should belong_to(:medium)}
it { should have_one(:audio_detail)}
end
|
require 'data_mapper'
class Appstart
include DataMapper::Resource
property :id, String, unique: true, key: true
property :user_softid, String
property :event_trigger, String, default: 'app'
property :event_trigger_type, String, default: 'appstart'
property :app_na... |
module WsdlMapper
module Generation
class YardDocFormatter
def initialize(formatter)
@formatter = formatter
@i = 0
end
def line(line)
buf = '# '
buf << ' ' * @i
buf << strip(line)
@formatter.statement buf
self
end
def inc_ind... |
module AcquiaToolbelt
class CLI
class Tasks < AcquiaToolbelt::Thor
no_tasks do
# Internal: Output information for a single task item.
#
# task - The task object that contains all the information about the
# task.
def output_task_item(task)
completion_... |
class RegionBio < ActiveRecord::Base
self.table_name='Region'
self.primary_key='IdRegion'
alias_attribute :nombre_region, :NombreRegion
alias_attribute :clave_region, :ClaveRegion
alias_attribute :id_region_asc, :IdRegionAsc
alias_attribute :tipo_region_id, :IdTipoRegion
belongs_to :tipo_region, :class... |
FactoryGirl.define do
factory :exercise_session do
user
exercise_plan
sequence(:name) { |n| "NAME#{n}" }
end
end
|
class EasyUserWorkingTimeCalendarsController < ApplicationController
layout 'admin'
before_filter { |c| c.require_admin_or_lesser_admin(:working_time) }
before_filter :find_calendar, :except => [:index, :new, :create, :assign_to_user]
before_filter :prepare_variables, :only => [:show, :inline_show, :inline_edi... |
class Author < ActiveRecord::Base
#new migrations
#has_many :dailyquestion_authors
#has_many :dailyquestions, :through => :dailyquestion_authors
#
has_many :dailyquestions
belongs_to :user
belongs_to :web_user
has_many :articles
has_many :sections
has_many :author_pictures
h... |
class Post < ActiveRecord::Base
validates :title, presence: true
belongs_to :author, class_name: "User"
validates :author, presence: true
belongs_to :category
validates :category, presence: true
validates :body, length: { minimum: 10 }
end
|
require 'minitest'
require 'minitest/autorun'
require 'delve/display/display'
require 'mocha/setup'
class DisplayTests < MiniTest::Test
def setup
@renderer = mock('object')
@renderer.expects(:init)
@display = Display.new @renderer
end
def test_create_display_with_no_renderer_raises_error
assert... |
class Incidentworkflow < ApplicationRecord
belongs_to :incident
belongs_to :workflowtemplate
end
|
class MantaAccount < ActiveRecord::Base
belongs_to :user
before_save :set_active
validates :manta_username, presence: true
validates :manta_host, presence: true
validates :manta_private_key, presence: true
def set_active
if self.active == true || self.user.manta_accounts.any? {|acct| !acct.active? }
... |
# frozen_string_literal: true
require 'stannum/associations/one'
require 'support/examples/association_examples'
RSpec.describe Stannum::Associations::One do
include Spec::Support::Examples::AssociationExamples
subject(:association) do
described_class.new(name: name, type: type, options: options)
end
l... |
Rails.application.routes.draw do
root "dashboard#index"
resources :users, only: [:new, :index, :create, :show]
get '/login', to: 'sessions#new'
post '/login', to: 'sessions#create'
get '/logout', to: 'sessions#destroy'
resources :vendors, only: [:show, :index]
resources :programs, only: [:show, :index]
... |
class ListsController < ApplicationController
before_action :find_list, only: [:show, :edit, :update, :destroy]
def index
@lists = List.all
# respond_to :json
# render json: @lists
end
def show
@task = List.find(params[:id])
# render json: @task
end
def create
@list = List.new(perm... |
require 'spec_helper'
RSpec.describe Smite::ItemEffect do
let(:item) { Smite::Game.item('Sovereignty') }
let(:smite_obj) { item.effects[0] }
describe '#percentage?' do
it 'returns true if the effect is percentage based' do
allow(smite_obj).to receive(:percentage).and_return(40)
expect(smite... |
# 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 ContentObserver < Mongoid::Observer
def after_create(record)
user = record.user
case record.class.to_s.underscore
when 'video'
user.publish_activity(:new_video, :object => record, :target_object => record.community)
when 'article'
user.publish_activity(:new_article, :object => record, :tar... |
class AddDecisionTypeToDecisions < ActiveRecord::Migration
def self.up
add_column :decisions, :decision_type_id, :integer
end
def self.down
remove_column :decisions, :decision_type_id
end
end
|
# frozen_string_literal: true
module Avatarable
include ActiveSupport::Concern
private
def render_avatar_not_found
render json: { error: 'An avatar is not attached to the user.' }, status: :not_found
end
end |
class TransactionStatementPage
include PageObject
include DataMagic
include FooterPanel
include HeaderPanel
# include FilterSortSection
# include Nokogiri
include Watir
require 'date'
PAGE_HEADING = "Transactions & Details"
DATE_COLUMN = 0
MERCHANT_NAME_COLUMN = 1
CATEGORY_COLUMN = 2
AMOUNT_C... |
class Api::V1::MessagesController < ApplicationController
protect_from_forgery with: :null_session
respond_to :json
skip_before_filter :verify_authenticity_token
require 'fcm'
# GET /users.json
def index
@messages = Message.all
render json: @messages, status: 200
end
# POST /users.json
def... |
require 'spec_helper'
describe AuthBlobValidator do
let(:record) { DeploymentTarget.new }
let(:attribute) { 'auth_blob' }
subject { described_class.new(attributes: [attribute]) }
context 'when the auth_blob contains 4 parts' do
let(:value) { Base64.encode64('a|b|c|certificate contents') }
it 'is va... |
Given(/^a customer logged in with canada account and on Manage Account Nick Name page$/) do
DataMagic.load("canada.yml")
visit LoginPage
on(LoginPage) do |page|
@account_data = page.data_for(:can_modify_nickname_account)
username = @account_data['username']
password = @account_data['password']
... |
#!/usr/bin/env ruby
require 'gmp'
require 'prime'
require 'openssl'
class Pell
attr_accessor :x, :y, :d
def initialize(x, y, d)
@x = x
@y = y
@d = d
end
def *(other)
return Pell.new(@x*other.y+@y*other.x,
@d*@x*other.x+@y*other.y,
@d)
end
def **... |
require 'support/doubled_classes'
module RSpec
module Mocks
RSpec.describe 'A class double with the doubled class not loaded' do
include_context "with isolated configuration"
before do
RSpec::Mocks.configuration.verify_doubled_constant_names = false
end
it 'includes the double n... |
require 'ostruct'
require 'MiqVm/MiqVm'
require 'fs/MiqFS/MiqFS'
require 'fs/MiqFS/modules/RealFS'
class MiqLocalVm < MiqVm
def initialize
@ost = OpenStruct.new
@rootTrees = [MiqFS.new(RealFS, OpenStruct.new)]
@volumeManager = OpenStruct.new
@vmConfigFile = "Local VM"
@vmDir = ""
@vmConfig = ... |
require 'test/unit'
require 'wlang'
require File.join(File.dirname(__FILE__), 'test_utils.rb')
require 'wlang/rulesets/basic_ruleset'
require 'wlang/rulesets/context_ruleset'
require 'wlang/rulesets/buffering_ruleset'
# Tests the Basic ruleset
class WLang::BasicRuleSetTest < Test::Unit::TestCase
include WLang::TestU... |
# frozen_string_literal: true
require "test_helper"
require "tty/fzy/version"
module TTY
class FzyTest < Minitest::Test
def test_that_it_has_a_version_number
refute_nil ::TTY::Fzy::VERSION
end
end
end
|
require 'spec_helper'
describe RelationshipsController do
let(:user) { create(:user) }
let(:other_user) { create(:user) }
subject { response }
before do
# Substitute to actually logging in via sign_in_request.
# The scope of these tests are limited to the relationships
# controller, so the... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.