text
stringlengths
10
2.61M
class User < ActiveRecord::Base # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable and :omniauthable devise :database_authenticatable, :registerable, :omniauthable, :recoverable, :rememberable, :trackable, :validatable class << self def oauth_signup(aut...
class Conversation < ActiveRecord::Base belongs_to :story has_many :messages belongs_to :user_one, class_name: 'User', foreign_key: 'user_one_id' belongs_to :user_two, class_name: 'User', foreign_key: 'user_two_id' accepts_nested_attributes_for :messages def partner(current_user_id) [self.user_one, ...
require 'nokogiri' require 'open-uri' require 'json' require "FileUtils" #############################ここを指定して############################################################# # とってきたい旅館のURL url = 'http://www.onsen-companion.jp/ashinomaki/ashinomakigrandhotel.html' # 旅館の住所 hotelAddress = '福島県会津若松市大戸町大字芦牧下タ平1044' # 旅館のgoogl...
require 'test_helper' class StallionsControllerTest < ActionDispatch::IntegrationTest setup do @stallion = stallions(:one) end test "should get index" do get stallions_url, as: :json assert_response :success end test "should create stallion" do assert_difference('Stallion.count') do p...
class SyncService def initialize(api_service = HarvestService) @api_service = api_service @harvest_clients = [] @prefixes = SyncService.organization_prefixes create_clients end def create_clients # Instantiate Harvest clients for each Org set in ENV @prefixes.each do |env_prefix| ...
class Merchant attr_reader :id, :name, :created_at, :updated_at, :merchant_repo def initialize(data, merchant_repo=nil) @id = data[:id] @name = data[:name] @created_at = data[:created_at] @updated_at = data[:updat...
Freight::UpsCalculator.configure do |config| config.username = ENV['UPS_USERNAME'] config.password = ENV['UPS_PASSWORD'] config.access_key = ENV['UPS_ACCESS_KEY'] ADDRESS = Struct.new :postal_code, :country_code config.company_address = ADDRESS.new '97005', 'US' origi...
class Api::Consumer::BaseController < ApplicationController skip_before_filter :verify_authenticity_token before_filter :authenticate_user!, :set_headers respond_to :json def set_headers if request.headers["HTTP_ORIGIN"] #&& /^https?:\/\/(.*)\.some\.site\.com$/i.match(request.headers["HTTP_ORIGIN"]) ...
require('minitest/autorun') require('minitest/reporters') require_relative('../rooms') require_relative('../guests') require_relative('../songs') Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new class TestRoom < MiniTest::Test def setup() @song1=Song.new("Witchy Woman") @song2=Song.new("A Hazy S...
class CreateBillingCollection < ActiveRecord::Migration def change create_table :billing_collections do |t| t.integer :amount, default: 0 t.string :period, null: false t.integer :failure_count, default: 0 t.datetime :bill_at, null: false t.datetime :bill_until t.datetime :retr...
class Review < ApplicationRecord validates :rating, presence: true validates :rating, length: { maximum: 5 } validates :comment, presence: true validates :comment, length: { maximum: 150 } validates :reviewer, presence: true end
require 'spec_helper' describe "Editing todo" do let!(:todo) { Todo.create(title: "Groceries", description: "Grocery list.") } it "is successful when clicking the destroy link" do visit "/todo" within "#todo_#{todo.id}" do click_link "Destroy" end expect(page).to_not have_content(todo.title) expect(To...
Vagrant.require_version ">= 1.6.0" $home_memory = 1024 $cloud_memory = 1024 # stable, beta, alpha $update_channel = "beta" # используем всегда одну версию, если нужно использовать более новую, то ">= 653.0.0" # stable = "647.2.0" # beta = "681.0.0" # etcd2 появился с версии 653.0.0, но он там используется вместе с пер...
class RemoveCommitDatesMonthFromGemGits < ActiveRecord::Migration[5.0] def change remove_column :gem_gits, :commit_dates_month, :text end end
class User < ApplicationRecord has_secure_password validates :first_name, presence: true validates :last_name, presence: true validates :email, presence: true validates_format_of :email, :with => /\A[^@]+@([^@\.]+\.)+[^@\.]+\z/ validates :password, presence: true, :length => {:within => 6..10}, :on => :crea...
class ParentsController < ApplicationController before_action :logged_in?, except: [:new, :create] before_action :set_parent, only: [:show, :edit, :update, :destroy] def new if session[:teacher_id] @parent = Parent.new else flash.now[:alert] = "You can't access this page" end end def...
class AddSeededSymptoms < ActiveRecord::Migration[5.0] def change create_table :seeded_symptoms do |t| t.string :name, presence: true t.string :common_name, presence: true t.string :article, presence: true, allow_nil: true, allow_blank: true t.string :plural, presence: true t.integer...
class OrdersController < ApplicationController def index @orders = Order.all end def show end def new client = Taxjar::Client.new(api_key: "2406573fd9359f2f0e1fd6410c607428") @profile = safe_current_or_guest_user.profile @rates = client.rates_for_location(@profile....
# 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...
#!/usr/bin/env ruby require "optparse" class Char attr_accessor :code attr_accessor :name attr_accessor :swidth attr_accessor :dwidth attr_accessor :bbx attr_accessor :bby attr_accessor :bboffx attr_accessor :bboffy attr_accessor :data def initialize(code) self.data = [] self.code...
class Api::V1::UserResource < Api::V1::BaseResource attributes :email, :password, :old_password, :new_password # before_save do # @model.user_id = context[:current_user].id if @model.changed? # end # before_update do # if @model.id != context[:current_user].id # byebug # raise ActiveRecord...
require File.expand_path('lib/artwork') require 'sinatra' require 'open-uri' module Artwork class Server < Sinatra::Base helpers do def time_for(value) case value when :tomorrow then Time.now + 24*60*60 when :next_week then Time.now + 7*24*60*60 else super end ...
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! VAGRANTFILE_API_VERSION = "2" $tscript = <<TSCRIPT set -o verbose #echo "Additional packages" apt-get update apt-get install ssh apt-get install sshpass TSCRIPT Vagrant.configure("2") do |config| config.vm.box = "ubuntu/trusty64...
class AddUserToPastes < ActiveRecord::Migration def change add_reference :pastes, :user, index: true, foreign_key: true end end
require 'rails_helper' describe "Superheroes API", type: :request do it "gets a list of Superheroes" do Superhero.create(name: 'Flash', age: 24, enjoys:'Quick strolls around the world.') get '/superheros' json = JSON.parse(response.body) expect(response).to have_http_status(:ok) ...
class Api::V1::SingersController < Api::ApiController def index # item = SingerSearchWayItem.select("id").find(params[:serch_item_id]) # singers = item.singers # Singer.includes(:singer_search_way_item_relations).where("singer_search_way_item_relations.singer_search_way_item_id = 1") # Singer.joins(:...
Gem::Specification.new do |s| s.name = 'runcs' s.version = '2.5.0' s.date = '2020-05-28' s.summary = "runcs" s.description = "a automaticly C# Compiler and Runner" s.authors = ["Ederson Ferreira"] s.email = 'edersondeveloper@gmail.com' s.files = ["li...
class RemoveImgPathFromPublisheds < ActiveRecord::Migration[5.1] def change remove_column :publisheds, :img_path, :string end end
class Post < ApplicationRecord belongs_to :user belongs_to :outfit validates :appointed_day, presence: true, uniqueness: { scope: :user_id } def start_time self.appointed_day end end
require 'loghouse_query/parsers' require 'loghouse_query/storable' require 'loghouse_query/pagination' require 'loghouse_query/clickhouse' require 'loghouse_query/permissions' require 'loghouse_query/csv' require 'log_entry' require 'log' class LoghouseQuery include Parsers include Storable include Pagination ...
# == Schema Information # # Table name: brands # # id :bigint not null, primary key # description :text # logo_content_type :string # logo_file_name :string # logo_file_size :bigint # logo_updated_at :datetime # meta_description :text # meta_title :text # name ...
require 'opengl' require 'glut' require 'benchmark' include Gl, Glut #run in such way # ruby --jit-wait --jit --jit-verbose=1 --jit-save-temps --jit-max-cache=1000 --jit-min-calls=1000 22-blines.rb PI = 3.14159 KOEF = PI / 180 class Coord attr_accessor :x, :y def initialize(x, y) @x = x @y =...
# frozen_string_literal: true require 'helper' describe InciScore::CLI do let(:io) { StringIO.new } it 'must warn if no inci is specified' do InciScore::CLI.new(args: ['aqua'], io: io).call _(io.string).must_equal "Specify INCI list as: --src='aqua, parfum, etc'\n" end it 'must print the help' do ...
require 'spec_helper' describe API do before :all do ENV['FRED_KEY'] or raise 'Please set FRED_KEY=y0urAP1k3y before running tests' end let(:fredric) { described_class.new ENV['FRED_KEY'], use_cache: true } describe '#new' do it 'initializes with api key' do fredric = described_class.new 'my-ap...
require_relative '../config/environment.rb' # USERS # steven = User.new("Steven") natasha = User.new("Natasha") # INGREDIENTS # pasta = Ingredient.new("pasta") basil = Ingredient.new("basil") peppers = Ingredient.new("peppers") pine_nuts = Ingredient.new("pine_nuts") tomato = Ingredient.new("tomato") mozzarella = Ingr...
Vagrant.configure(2) do |config| config.vm.box = "ubuntu/wily64" config.vm.synced_folder "./", "/home/vagrant/fpv9-haskell-workshop" config.vm.provision "shell", path: "provision.sh" config.vm.withgui = true config.vm.provider "virtualbox" do |v| v.memory = 2048 end end
class User < ApplicationRecord rolify require 'csv' # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :validatable after_create :assign_default...
require 'rails_helper' describe User do let(:user) { FactoryBot.build(:user, name: "Example User", email: "user@example.com", password: "foobar Z", ...
# frozen_string_literal: true class UserAvatarUploader < CarrierWave::Uploader::Base include CarrierWave::MiniMagick version :thumb do process resize_to_fill: [36, 36] end version :medium do process resize_to_fill: [300, 300] end def default_url(*_args) '/assets/avatar.png' end def exte...
When /^I select the watchlist icon$/ do on(HomePage).watch_link_element.when_present.click end Then /^I receive notification that I need to log in to use the watchlist functionality$/ do on(HomePage).text.should include "Please login or sign up to watch this page." end Then /^When I click Sign In I go to the Log ...
module Inventory # TODO: Make private, since only check_inventory should be using these methods def display_inventory_weapons current_inventory_weapons.empty? ? display_empty : "\n#{current_inventory_weapons.each_with_index(&Procs::DISPLAY_WEAPON_WITH_STATUS)}" end def display_inventory_armor current_i...
module Api::V1 class TrackedTimesController < ApiController before_action :set_user # GET /v1/tracked_times/ def index render json: @user.tracked_times.all end # POST /v1/tracked_times/ def create @tracked_time = TrackedTime.new(tracked_times_params) @tracked_time.user = cu...
#!/usr/bin/env ruby require_relative 'int_code' require_relative 'point' require 'ruby2d' module Day13 class Tile attr_accessor :id, :point # the id is interpreted as follows #0 is an empty tile. No game object appears in this tile. #1 is a wall tile. Walls are indestructible barriers. #2 is a ...
require 'spec_helper' describe ::ServiceBinding::ConjurV5SpaceBinding do let(:service_id) { "service_id" } let(:binding_id) { "binding_id" } let(:org_guid) { "org_guid" } let(:space_guid) { "space_guid" } let(:service_binding) do ::ServiceBinding::ConjurV5SpaceBinding.new( service_id, bindin...
class SearchLog < ActiveRecord::Base SEARCH_TYPE_SEARCH = 0 #検索タイプ: 検索画面→0 SEARCH_TYPE_LINK = 1 #検索タイプ: リンクから→1 def self.create_search_log(search_word, search_type, user_ip) if search_type == "search" search_type = SEARCH_TYPE_SEARCH elsif search_type == "link" search_type = SEARCH_TYPE_LINK ...
module Spree class OrderContents attr_accessor :order, :currency def initialize(order) @order = order end def add(variant, quantity = 1, options = {}) ActiveSupport::Deprecation.warn(<<-EOS, caller) OrderContents#add method is deprecated and will be removed in Spree 4.0. Please u...
json.location do json.partial! '/api/locations/location', location: @location json.photoUrls @location.photos.map { |file| url_for(file) } end
require 'rubygems/command' require 'rubygems/package' require 'rubygems/version_option' require 'rubygems/gem_openpgp' # Verifies a gem signed by the 'sign' command. Iterates through the # gem contents and verifies all embedded files, if possible. Errors # out if the signature is bad or the key is unknown. # # Optio...
require 'rails_helper' feature "Creating a new review" do scenario "redirected to ratings page" do submit_rating expect(page).to have_content("FT.com's ratings") end scenario "submitting a rating of 4" do submit_rating expect(page).to have_content("Score of 4") expect(page).to_not have_cont...
class ApplicationController < ActionController::Base before_filter :require_login private def require_login if !session[:current_user_id] redirect_to '/login' end end end
class PatentsController < ApplicationController before_filter :auth_required def index end def search @items = Patent.order(:description).joins(:participants) if !params[:q].blank? @items = @items.where("(description LIKE :q)", {:q => "%#{params[:q]}%"}) end if params[:filter] == '...
require "formula" class Httrack < Formula homepage "http://www.httrack.com/" # Always use mirror.httrack.com when you link to a new version of HTTrack, as # link to download.httrack.com will break on next HTTrack update. url "http://mirror.httrack.com/historical/httrack-3.48.19.tar.gz" sha1 "7df386a248444c59...
class AppCallback < FatFreeCRM::Callback::Base # Implements application's before_filter hook. #---------------------------------------------------------------------------- def app_before_filter(controller, context = {}) # Only trap leads/create. return unless controller.controller_name == "leads" && ...
class JobVolunteer < ApplicationRecord belongs_to :volunteer belongs_to :city_job end
namespace :job_start do desc "タスクのremindから時間を指定してjobを起動する" task task_status_check: :environment do # タスクを全件取得 tasks = Task.all # 一つずつ取り出してremindを取得し変数に格納 tasks.each{ |task| task.run! # time = task.reminder =begin year = Time.zone.now.year month = Time.zone.now.month day...
class Post # < ActiveRecord::Base include Mongoid::Document field :title field :body # has_many :comments, dependent: :destroy # belongs_to :blog embeds_many :comments embedded_in :blog, :inverse_of => :posts validates :title, presence: true validates :body, presence: true end
# == Schema Information # # Table name: top_invitations # # id :bigint not null, primary key # email :string # token :string(10) # created_at :datetime not null # updated_at :datetime not null # class TopInvitation < ApplicationRecord before_create :generate_token v...
class CertificationsController < ApplicationController def create @student=Student.find(current_student.id) if @student.certifications.create(certification_params) redirect_to(:controller => "welcomes", :action => "profile") end end private def certification_params params.permit(:certificate_name, :c...
require "securerandom" require "test_helper" require "ultimaker/discovery" class UltimakerDiscoveryTest < Minitest::Test def setup @browse_replies = [] DNSSD::Service.stubs(:browse).with("_ultimaker._tcp").returns(stub_service(@browse_replies)) DNSSD::Service.stubs(:resolve).raises("DNSSD::Service.resol...
# -*- coding: utf-8 -*- # # Copyright 2013 whiteleaf. All rights reserved. # require "yaml" class SiteSetting def self.load_file(path) new(path) end def [](key) replace_group_values(key) end def []=(key, value) @match_values[key] = value end def clear @match_values.clear end def ...
class Embed < Dynamic # Re-define class variables from parent class @pusher_options = Dynamic.pusher_options @custom_optimistic_locking_options = Dynamic.custom_optimistic_locking_options end Dynamic.class_eval do after_commit :update_elasticsearch_metadata, on: [:create, :update], if: proc { |d| ['metadata', ...
class Condition < ActiveRecord::Base belongs_to :user has_many :deliveries has_many :accounts acts_as_votable end
# == Schema Information # # Table name: challenge_completions # # id :integer not null, primary key # user_id :integer # challenge_id :integer # created_at :datetime not null # updated_at :datetime not null # # Indexes # # index_challenge_completions_on_challenge_id (c...
class ApplicationController < ActionController::Base protect_from_forgery def after_sign_in_path_for(resource) dashboard_path end protected def search @search = Episode.published.recent.search(params[:q]) if params[:q] redirect_to controller: :episodes, action: :index, q: params[:q] end end ...
require 'selenium-webdriver' module BrowserStackDriver USERNAME = ENV['BROWSERSTACK_USERNAME'] BROWSERSTACK_ACCESS_KEY = ENV['BROWSERSTACK_KEY'] class << self def browserstack_endpoint url = "http://#{USERNAME}:#{BROWSERSTACK_ACCESS_KEY}@hub.browserstack.com/wd/hub" end def caps caps ...
module Comercio module PaymentTwoCreditCards class PaymentTwoCreditCards < SitePrism::Page @@cards = [] @card_num @card_cvv @card_name def generate_card_info card card_file = load_card_file if card == 'random' @@cards = ["visa", "master", "american_expre...
class Sub2CategoriesController < ApplicationController before_action :set_sub2_category, only: [:show, :edit, :update, :destroy] # GET /sub2_categories # GET /sub2_categories.json def index @sub2_categories = Sub2Category.all end # GET /sub2_categories/1 # GET /sub2_categories/1.json def show en...
class RenamePokeIdColumnToFavorites < ActiveRecord::Migration[5.2] def change rename_column :favorites, :poke_id, :poketm_id end end
=begin Modify the following code so that Hello! I'm a cat! is printed when Cat.generic_greeting is invoked. Expected output: Hello! I'm a cat! =end class Cat def self.generic_greeting puts "Hello! I'm a cat!" end end kitty = Cat.new Cat.generic_greeting kitty.class.generic_greeting
require 'csv' require 'set' filename = 'street.csv' field_name = 'Crime ID' unique_values = Set[] puts 'Starting read' count = 0 CSV.foreach(filename, headers: true) do |row| unique_values.add(row[field_name]) count += 1 puts("#{count} records processed") if (count % 1000) == 0 end puts ...
Given /^there is a user with email (?:address )?"([^"]+)" and password "([^"]+)"$/ do |email, password| FactoryGirl.create(:user, email: email, password: password) end Given /^I am signed in as "([^\/]+)\/([^"]+)"$/ do |email, password| visit new_user_session_path within('#main-content') do fill_in 'Email', ...
TOP_SRC_DIR = File.expand_path( File.join(File.dirname(__FILE__), '..') ) $LOAD_PATH.unshift TOP_SRC_DIR $LOAD_PATH.unshift File.join(TOP_SRC_DIR, 'test') require 'roby' require 'roby/transactions' require 'utilrb/objectstats' include Roby TASK_COUNT = 10 RELATION_COUNT = 10 def display_object_count count = Obje...
class GrocerItemsController < ApplicationController before_action :require_login before_action :require_fingerprint def new return redirect_back_data_error items_path, "Data tidak valid" unless params[:id].present? item = Item.find_by_id params[:id] return redirect_back_data_error new_grocer_item_p...
# Filters added to this controller apply to all controllers in the application. # Likewise, all the methods added will be available for all controllers. class ApplicationController < ActionController::Base layout 'application' helper :all helper_method :referer, :current_section, :current_page, :current_articl...
class Api::V1::PokemonsController < ActionController::Base VALID_QUERIES = ['name','attack','stamina','defence'] def index unless validate_queries(request.GET.keys) render json: {error: "Bad Query"} return end render json: build_response(request) end def build_response(request) re...
require 'features_helper' feature 'user signs in and signs out', :js do scenario 'with valid account' do sign_in expect(page).to have_content 'You have signed in.' expect(page).to have_content 'View reports' click_link 'Logout' expect(page).to have_content 'You have signed out.' expect(page...
require 'spec_helper' describe MojoLogger do it 'has a version number' do expect(MojoLogger::VERSION).not_to be nil end before do @api_request = { session_id: "1234-0000", reference_id: "rspec", api: "rspec" } @mojo_params = [ @api_request, "Category", "Messag...
class AddAppointmentFieldColumnsToCustomFields < ActiveRecord::Migration def up add_column :custom_fields, :pricing_table_id, :integer add_column :custom_fields, :show_in_table, :boolean, :default => false add_column :custom_fields, :unique, :boolean, :default => false add_column :custom_fields, :show...
class CommandLine @@prompt = TTY::Prompt.new system 'clear' @@toppings = [] def greeting puts "Welcome To Ice Cream Bot!\n" puts "Please enter your name to start an order!" name = gets.chomp @@user = User.find_or_create_by(name: name) end def ice_cream_list #returns numerical list of ice cream flavor...
require 'bayeux/custom_faye_sender' class DeviceCommandProcessor attr_accessor :faye_messages_controller attr_accessor :vlan_output_buffer attr_accessor :vlan_input_buffer attr_accessor :irc_gateway include CustomFayeSender def initialize(irc_gateway) initialize_faye_processor @irc_gateway = irc...
class LunjianController < ApplicationController # # 获取论剑列表接口 # def get_list re, user = validate_session_key(get_params(params, :session_key)) return unless re list = LunjianPosition.get_list(user) render_result(ResultCode::OK, {users: list}) end # # 更新挑战结果 # def update_result re,...
class Contents < ActiveRecord::Base # validates :title, :format => { :with => /\A[a-zA-Z]+\z/, # :message => "Title Only letters allowed" } # validates :short_description, :format => { :with => /\A[a-zA-Z]+\z/, # :message => "short_description ...
module Nhim module DisplayHelper def nhim_datetime_display(datetime) return '-' if datetime.blank? datetime.strftime("%m/%d/%Y %I:%M%p") end end end
module Puffer class PathSet < ::ActionView::PathSet class_attribute :_fallbacks self._fallbacks = [] def find(path, prefix = nil, partial = false, details = {}, key = nil) prefixes = [prefix].concat _fallbacks paths = prefixes.map {|prefix| "#{prefix}/#{path}"}.join(', ') begin ...
class LineItemsController < ApplicationController include CurrentCart before_action :set_cart, only: [:create] before_action :set_line_item, only: %i[ show edit update destroy ] # GET /line_items or /line_items.json def index @line_items = LineItem.all end # GET /line_items/1 or /line_items/1.json def show en...
# == Schema Information # # Table name: complaints # # id :bigint not null, primary key # content :text not null # created_at :datetime not null # updated_at :datetime not null # user_id :bigint not null # # Indexes # # index_complaints_on_user_id (us...
require 'rails_helper' RSpec.describe AdminArea::CardAccounts::Create do let(:op) { described_class } let(:person) { create_account.owner } let(:card_product) { create(:card_product) } example 'success - creating an open card account' do result = op.( person_id: person.id, card: { card_produc...
class RPNCalculator def calculate(rpn_value) rpn = rpn_value.split if rpn.length < 3 raise "invalid number of arguments" end stack = [] rpn.each do | value | case value when /\d/ stack.insert(0, value.to_i) ...
require 'test_helper' class WorkTest < ActiveSupport::TestCase def setup @work = Work.new @work.image = File::new("/Users/darko/Pictures/2016/2016-01-03\ Galerija\ PIKTO/Output/Pikto\ postav\ 1.jpg") end test "should not be valid without name" do @work.name = nil @work.name = "lorem ipsum" a...
# frozen_string_literal: true # Calculo do PI (Leibniz) em Ruby # Carlos Alves # https://github.com/EuCarlos def calculate_pi(number) denominator = 1.0 operation = 1.0 pi = 0 (1..number).each do |_count| pi += operation * (4.0 / denominator) denominator += 2.0 operation *= -1.0 end pi end d...
class Scenes::CurrentJournalController < SceneController before_action :authenticate_user! def scene @questions = current_journal.ordered_questions @entries = current_journal.entries.order(created_at: :desc) @new_question = Question.new end def add_question if @question = current_journal.creat...
class SchoolClassesController < ApplicationController def new @school_class = SchoolClass.new end def show @school_class = SchoolClass.find(params[:id]) end def edit @school_class = SchoolClass.find(params[:id]) end def create ###Bug fix for test if params.has_key?(:school_classes)...
class CreateEventInvites < ActiveRecord::Migration[5.0] def change create_table :event_invites do |t| t.integer :role, default: EventInvite.roles[:guest], null: false t.integer :status, comment: "rsvp of the invited user" t.references :sender, foreign_key: { to_table: :users }, null: false ...
# coding: utf-8 require "minitest/autorun" require "mywn" class TestWnMprt < MiniTest::Test def setup @human = "human" # 人間 end def test_wn_mprt assert_kind_of Array, @human.wn_mprt human_mprt = [ "loin", # 腰, 腰肉 "material_body", # 人体, 人身 "body_hair", # 体毛 "head_of_hair"...
module Evergreen class Suite attr_reader :driver, :files def initialize(files = []) @files = files paths = [ File.expand_path("config/evergreen.rb", root), File.expand_path(".evergreen", root), "#{ENV["HOME"]}/.evergreen" ] paths.each { |path| load(path) if F...
module TheCityAdmin FactoryGirl.define do factory :user_process, :class => TheCityAdmin::UserProcess do name "Member Process" id 241832976 state "complete" end end end
require 'rails-api' require 'active_model_serializers' module Rockauth class ProviderAuthenticationsController < ActionController::API include ActionController::Helpers include ActionController::Serialization include Rockauth::Controllers::Scope include Rockauth::Controllers::UnsafeParameters be...
class ApplicationController < ActionController::Base before_action :configure_permitted_parameters, if: :devise_controller? protected def configure_permitted_parameters devise_parameter_sanitizer.permit(:sign_up, keys: [:email,:name]) devise_parameter_sanitizer.permit(:sign_in, keys: [:email,:name]) d...
require 'rails_helper' describe CategoriesController do # test for fun it 'shows a list of categories' do expect(Category).to receive(:order).and_return([double]) get :index # expect(response.status).to eq(200) expect(assigns(:categories).length).to eq(1) expect(response).to render_template(:in...
class Alquiler < ActiveRecord::Base belongs_to :car belongs_to :user validates :id_coche, :fecha_ini_anuncio, :fecha_fin_anuncio, :fecha_ini_alquiler, :fecha_fin_alquiler, :precio, presence: true scope :alquileres_disponible, ->{where("alquilers.alquilador IS NULL")} end