text
stringlengths
10
2.61M
#!/opt/ruby/bin/ruby require '/applis/cmd/cmd_line.rb' require 'savon' require 'pp' require 'mixlib/shellout' require 'oci8' require 'html/table' include HTML require 'mail' require 'fileutils' class Histo attr_accessor :cmd, :env, :app, :options, :env_name def initialize(cmd) @cmd = cmd @options = cm...
class DropTempletIdFromPages < ActiveRecord::Migration def change remove_column :pages, :templet_id end end
module ActionComponent module ActionControllerRendering private def render_component(component_class, opts = {}) @_component_class = component_class @_component_options = opts render_opts = { inline: "<% render_component(@_component_class, @_component_options) %>", layout: ...
class V1::Apps::ItemsController < V1::AppsController before_filter :set_resources, :set_amount def add item = @inventory.add_item(@app_item, @amount) render status: :ok, json: item end def take item = @inventory.subtract_item(@app_item, @amount) if item render status: :ok, json: item ...
require 'yt/models/base' module Yt module Models # Provides methods to interact with YouTube ContentID claims. # @see https://developers.google.com/youtube/partner/docs/v1/claims class Claim < Base attr_reader :auth, :data def initialize(options = {}) @data = options[:data] @...
class Rental < ApplicationRecord belongs_to :customer belongs_to :movie validates :customer_id, presence: true validates :movie_id, presence: true def rent_movie(customer, movie) checked_out = customer.movies_checked_out_count customer.update(movies_checked_out_count: checked_out +1) inventory...
class Api::V1::TopicsController < ApplicationController def index respond_to do |wants| begin owner # Load. wants.json { render :json => topics_hash } rescue ActiveRecord::RecordNotFound => e wants.json { render :json => e.message, :status => :not_found } end ...
# -*- encoding: utf-8 -*- require File.expand_path('../lib/fingerprintless/version', __FILE__) Gem::Specification.new do |gem| gem.authors = ["Joost Diepenmaat"] gem.email = ["joost@moneybird.com"] gem.description = "Use the rails image_tag without fingerprinting." gem.summary = "Don't wa...
class CreateFormNumbers < ActiveRecord::Migration def change create_table :form_numbers do |t| t.string :trsType, limit: 2 t.string :yymm, limit: 6 t.integer :seq t.timestamps null: false end end end
require 'rails_helper' feature 'User can see a list of 5 of their Github repositories' do scenario 'with the name of each Repo linking to the repo on Github' do VCR.use_cassette('GitHub Feature User Sees Their Repos') do user = create(:user) GhUser.create(token: ENV['USER_GITHUB_TOKEN_1'], user_id: u...
# 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...
require "open-uri" require "net/https" require "yaml" require "cgi" module Oauth HMAC_SHA1 = "HMAC-SHA1" PLAINTEXT = "PLAINTEXT" @debug_flg = true class Token def initialize(token) @http = token["http"] @method = token["method"] @host = token["host"] @path ...
require "sinatra" require "rack" require "rack/contrib" require "ruby-bandwidth" require "yaml" Call = Bandwidth::Call Bridge = Bandwidth::Bridge client = nil options = YAML.load(File.read("./options.yml")) use Rack::PostBodyContentTypeParser get "/" do if !options["api_token"] || !options["api_secret"] || !op...
require 'rails_helper' describe Assignment do it { should validate_presence_of :course } end
feature 'PremierRequests' do let!(:premier) { create(:premier) } let!(:first_request) { create(:request, user: premier) } let!(:second_request) { create(:request, user: premier) } let!(:third_request) { create(:request) } describe 'Pending requests ' do it 'should transition correctly through request s...
# This class store infomation for person class Person # Init object person with name def initialize(name) # Create an exception throw error when attribute name empty raise ArgumentError, 'No name present' if name.empty? end end # This class BaddataException inherit standard RuntimeError class BadDataExce...
#require_relative "../lib/models/countryholiday.rb" #require_relative "../Seeding_Stuff/populateCountryHoliday.rb" # use .inspect on a file? # PASTE IN ALL DATA !!! (@ top of this file) # move files to Seeding Stuff def find_country_holiday_pairs(data) all_array = [] data.each do |country, server_replies| ...
# frozen_string_literal: true feature 'delete listing' do scenario 'If a user owns a listing they can choose to delete it' do visit '/' click_on 'Sign in' fill_in('username', with: 'poshhouseperson') fill_in('password', with: 'password1') click_button 'Submit' click_on 'poshhouse' click_b...
class ChangeDefaultValue < ActiveRecord::Migration[5.2] def change change_column_default :bids, :status, from: "true", to: "pending" end end
module SessionsHelper def signed_in? !current_user.nil? end def current_user=(user) @current_user = user end def current_user remember_token = cookies[:remember_token] if remember_token.nil? @current_user = nil else session = Session.include(:user).find_by remember_tok...
#!/usr/bin/env ruby # # profile-grep will take a stdin list of collapsed graphs (see note-collapse) # read through the posts, and then take the arguments from the command line # and print out the posts which have the percentage of likes and reblogs # matching the pattern # # By using stdin, this allows one to read over...
# -*- coding: utf-8 -*- # # = bitstring.rb - Bounded and unbounded bit strings # # Author:: Ken Coar # Copyright:: Copyright © 2010 Ken Coar # License:: Apache Licence 2.0 # # == Synopsis # # require 'rubygems' # require 'bitstring' # bString = BitString.new([initial-value], [bitcount]) # bString = Bit...
class Comment < ActiveRecord::Base attr_accessible :comment, :name, :site_id belongs_to :site validates :name, :presence => true validates :comment, :presence => true end
#!/usr/bin/env ruby # Write a method to determine if two strings are anagrams of each other. # e.g. isAnagram(“secure”, “rescue”) → false # e.g. isAnagram(“conifers”, “fir cones”) → true # e.g. isAnagram(“google”, “facebook”) → false class String def anagram?(s) s1 = self.split("").sort.join.strip s2 = s...
require 'codily/elements/service_belongging_base' module Codily module Elements class Dictionary < ServiceBelonggingBase def_attr *%i( ) def fastly_class Fastly::Dictionary end end end end
require 'roda' require 'json' require 'lib/action_handler' module ImageGetter # Start the action handler and its worker $action = ActionHandler.new(items: Page.inprogress) $action.worker.start class App < Roda plugin :slash_path_empty plugin :halt plugin :json plugin :error_handler def r...
class InvoicesController < ApplicationController def index gon.invoices = Invoice.all end def create cart = build_cart @invoice = cart.checkout! @invoice.items << cart.items if @invoice.save session[:cart] = [] session[:coupons] = [] redirect_to invoice_path(@invoice), notic...
require 'httparty' require 'json' def convert_geoip_boolean(value) value == 'yes' ? true : false end def lambda_handler(event:, context:) sourceIp = event['requestContext']['identity']['sourceIp'] certPath = './cosmos/cert.pem' options = { pem: File.read(certPath), verify: false } begin resp...
class Api::V3::AppointmentTransformer class << self def creation_facility_id(payload) payload[:creation_facility_id].blank? ? payload[:facility_id] : payload[:creation_facility_id] end def to_response(appointment) Api::V3::Transformer.to_response(appointment).except("user_id") end de...
class Staffs::StaffsController < Staffs::BaseController before_action :authenticate_staff! def index @staffs = Staff.all.order(:id) end def create @staff = Staff.create(staff_params) @staff.update(password: PasswordService.default, reset_password: true) end def update @staff = Staff.where...
require 'test_helper' class CustomFieldsControllerTest < ActionDispatch::IntegrationTest setup do @custom_field = custom_fields(:one) end test "should get index" do get custom_fields_url assert_response :success end test "should get new" do get new_custom_field_url assert_response :succ...
class RecipeIngredient < ApplicationRecord belongs_to :recipe_ingredient_group belongs_to :ingredient validates :quantity, presence: true # validates :unit, presence: true validates :ingredient_id, presence: true before_save do self.unit = unit.singularize end after_create_commit { bro...
#!/usr/bin/env rake require "bundler/gem_tasks" require "rake/testtask" require "yard" desc "generate documentation" YARD::Rake::YardocTask.new do |task| task.files << 'lib/**/*.rb' end desc "run the minitest specs" Rake::TestTask.new(:spec) do |task| task.libs << "spec" task.test_files = FileList["spec/**/*_sp...
module Motion; module Project class Config alias :original_spec_files :spec_files def spec_files red_green_style_config_file = File.expand_path(redgreen_style_config) return original_spec_files if original_spec_files.include? red_green_style_config_file index = original_spec_files.find_inde...
class QuoteItem < ApplicationRecord belongs_to :quotation_request belongs_to :order_item validates :quantity, presence: true validates :quote_price, presence: true validates :price, presence: true def item_details_hash { price: self.price, quote_price: self.quote_price, quantity: self.quantity, tit...
class Importsession < ApplicationRecord has_many :imports end
module NumberFinder class << self def find_n_numbers(n, num = 1, found =[], &predicate) if found.size == n found elsif predicate.call(num) find_n_numbers(n, num + 1, found + [num], &predicate) else find_n_numbers(n, num + 1, found, &predicate) end end def f...
module Domgen class << self def template_sets template_set_map.values end def template_set(name, options = {}, &block) if name.is_a?(Hash) && name.size == 1 req = name.values[0] options = options.dup options[:required_template_sets] = req.is_a?(Array) ? req : [req] ...
require 'net/scp' require 'net/ssh' require 'archive/tar/minitar' require 'zlib' class LinuxServer < Server def initialize(parent_dir, conf) @conf = conf @logs_dir = server_dir_in File.join(parent_dir, "logs") @report_dir = File.expand_path(File.join(parent_dir, "report")) @ssh_opts = {} @ssh_opt...
# # Copyright 2009 Huygens Instituut for the History of the Netherlands, Den Haag, The Netherlands. # # This file is part of New Women Writers. # # New Women Writers is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundat...
require_relative 'master_method_tests' include MasterMethodTests #Given(/^I am on Hayneedles website$/) do #goto_hayneedle_site #close_popup #end When(/^I click on the Account drop down and click Sign In$/) do @browser.div(:id, 'HN_Accounts_Btn').click @browser.div(:id, 'HN_Accounts_DD').a(:href, '/templat...
class Item < ActiveRecord::Base belongs_to :list validates :name, presence: true validates :name, length: { minimum: 1, message: "you must enter a list name with at least 1 character"} end
class PollChoicesController < ApplicationController before_action :get_poll before_action :get_poll_choice, except: [:index, :new, :create] def index @poll_choices = @poll.poll_choices end def new @poll_choice = @poll.poll_choices.new end def create @poll_choice = @poll.poll_choices.new(pol...
class Calculator attr_accessor :name, :num_calculations def initialize(name="no name") @name = name @num_calculations = 0 end def add(a, b) @num_calculations += 1 a + b end def sum(ary) @num_calculations += 1 sum = ary.inject do |tot, elem| tot + elem end if sum.nil...
class UsersController < ApplicationController before_action :set_user, only: [:show, :edit, :update, :destroy] skip_before_action :logged_in_user, only: [:create, :new] skip_before_action :admin_user, only: [:create,:show, :new, :destroy, :edit, :update] # GET /users # GET /users.json def index @users ...
require 'test_helper' class AgentMailerTest < ActionMailer::TestCase test 'welcome' do email = AgentMailer.welcome(agents(:archer)).deliver assert_equal [agents(:archer).email], email.to assert_equal ['handlers@secretagentplan.shhh'], email.from assert_equal "Welcome to Secret Agent Plan", email.subj...
require 'rails_helper' RSpec.describe Team do context 'is a model and has attributes' do it "exists" do expect(Team.new).to be_a(Team) end it 'has a name attribute' do expect(Team.new).to respond_to(:team_name) end it 'has a info attribute' do expect(Team.new).to respond_to(:inf...
# frozen_string_literal: true require 'test_helper' class UsersControllerTest < ActionDispatch::IntegrationTest def setup @users = create_list(:user, 20) end test 'should get paginated users' do get users_url, params: { page: 1, per_page: 50 } assert_response :success assert_equal @users.first....
module ReportsKit module Reports module Data class FormatTwoDimensions attr_accessor :series, :dimension, :second_dimension, :dimension_keys_values, :order, :limit def initialize(series, dimension_keys_values, order:, limit:) self.series = series self.dimension = series....
# Write two methods that each take a time of day in 24 hour format, and return # the number of minutes before and after midnight, respectively. Both methods # should return a value in the range 0..1439. # You may not use ruby's Date and Time methods. # split the strink into 2 numbers, use split with : # multiply hour...
require 'spec_helper' describe MSFLVisitors::Nodes::Iterator do describe ".new" do subject { described_class.new arg } context "when the argument is not a MSFLVisitors::Nodes::Set instance" do let(:arg) { double('Not a Set node') } it "raises an ArgumentError" do expect { subject }.t...
Factory.sequence :company_unique_identifier do |n| "unique_identifier#{n}" end # Read about factories at http://github.com/thoughtbot/factory_girl FactoryGirl.define do factory :company do name "MyString" brief_description "MyText" city { |c| c.association(:city) } unique_identifier { Fac...
module Moped module Logging def logger return @logger if defined?(@logger) @logger = rails_logger || default_logger end def rails_logger defined?(Rails) && Rails.respond_to?(:logger) && Rails.logger end def default_logger Logger.new(STDOUT).tap do |logger| logger...
require 'rails_helper' RSpec.describe 'admin price expire', settings: false do before :example do sign_in_to_admin_area end it 'expires price' do price = create(:effective_price) expect { patch expire_admin_price_path(price); price.reload } .to change { price.expired? }.from(false).to(true)...
require 'FFMPEG.rb' require 'thread' # VideoConverter enables converting of videos. It is based on FFMPEG. class VideoConverter # VideoConverter constructor. # +video+:: identifier for the to be converted video file def initialize(video) if not File.exist?(video) raise "File #{video} does not exist." ...
module PageHelper include Rails.application.routes.url_helpers def default_url_options {} end def goto_url @session.visit @url end def notice @session.find("#messages .notice").text end end
json.array!(@game_details) do |game_detail| json.extract! game_detail, :id, :game_id, :question_id, :status_id json.url game_detail_url(game_detail, format: :json) end
movies = {'A Man for All Seasons' => 10} print 'What operation: ' choice = gets.chomp until choice == 'end' do case choice when 'add' print 'Movie title: ' title = gets.chomp.to_sym print "\nRating: " rating = gets.chomp.to_i if movies.has_key? ti...
class ApplicationController < ActionController::Base protect_from_forgery with: :exception # before_action :set_breadcrumb # def set_breadcrumb # @breadcrumbs ||= session[:breadcrumbs] # @breadcrumbs.push(request.url) # end # this lets the view access the helper method helper_method :current_user ...
def capfile(config) if config.installed? done "Cap files '#{config.files}' exists, not running `cap install`" else sys_exec! 'cap install' end ruby = :ruby create_initial_file( source: config.source_dir_for.dest_files_that_exist.join( ruby.to_s, config.capfile ), dest: config.capf...
class BottleDepot attr_accessor :total_bottles, :bottle_caps, :investment, :caps, :empties def initialize (investment) @investment = investment @total_bottles = 0 @caps = 0 @empties = 0 end BOTTLE_PRICE = 2 TRADE_CAPS_IN = 4 TRADE_BOTTLES_IN = 2 def trading_in? @caps < TRADE_CAPS_IN...
class AddPhotoToMeetingRoom < ActiveRecord::Migration[5.0] def change add_column :meeting_rooms, :photo, :string end end
module Lita module Handlers class Heartbeat < Handler # insert handler code here http.get "/heartbeat", :heartbeat def heartbeat(request, response) response.body << "I'm alive!" end Lita.register_handler(self) end end end
Rails.application.routes.draw do devise_for :users root to: "categories#index" resources :categories, only: [:show] do resources :tips, only: [:index] end resources :users, only: [:show, :edit, :update] resources :party_challenges, only: [:update] resources :challenges, only: [:index, :show, :new, :...
require_relative "lib/sentry/resque/version" Gem::Specification.new do |spec| spec.name = "sentry-resque" spec.version = Sentry::Resque::VERSION spec.authors = ["Sentry Team"] spec.description = spec.summary = "A gem that provides Resque integration for the Sentry error logger" spec.email = "a...
$:.unshift(File.expand_path('../lib', __FILE__)) require 'active_support/all' require 'sinatra' require 'sinatra/base' require 'sinatra/reloader' require 'sinatra/config_file' require 'tile_service' require 'badge_service' require 'dot_service' require 'iodine' set :public_folder, File.dirname(__FILE__) + '/public' s...
class CreateEmailHistories < ActiveRecord::Migration def self.up create_table :email_histories do |t| t.integer :to_email_id t.integer :from_email_id t.string :message_id t.string :unique t.string :subject t.datetime :open_at t.datetime :visit_at t.datetime :bounce_...
require 'spec_helper' require 'rack/test' describe IndexController do def app() ApiController end context 'Api' do it 'should allow accessing the home page' do get '/all', {}, { 'rack.session' => { user: 'foo' } } expect(last_response.body).to include('Some new task') end it 'should add...
# encoding: utf-8 class TweetsController < ApplicationController # GET /tweets # GET /tweets.xml require 'RMagick' include ApplicationHelper caches_action :index, :expires_in => 30.minutes, :if => proc { (params.keys - ['format', 'action', 'controller']).empty? } caches_action :thumbnail befor...
require 'open-uri' require 'pry' class Scraper def self.scrape_index_page(index_url) html=open(index_url) doc=Nokogiri::HTML(html) students_array=[] doc.css(".student-card").each do |student| hash={} hash[:name]= student.css("h4.student-name").text hash[:location]=student.css("p.student-locatio...
json.array!(@needs) do |need| json.extract! need, :title, :description json.url need_url(need, format: :json) end
class Ride < ApplicationRecord belongs_to :route has_many :ride_attendances has_many :users, through: :ride_attendances end
class Post < ApplicationRecord has_one_attached :image belongs_to :user has_many :comments, dependent: :destroy acts_as_votable has_many :post_hash_tags has_many :hash_tags, through: :post_hash_tags def thumbnail return self.image.variant(resize: '500x500!').processed end def profile_...
# Lists things = ['a', 'b', 'c', 'd'] puts things[1] things[1] = 'z' puts things[1] # Dictionaries or hashmaps or hashes stuff = {'name' => 'Zed', 'age' => 39, 'height' => 6 * 12 + 2} # print puts stuff['name'] puts stuff['height'] # add stuff['city'] = "San Francisco" puts stuff['city'] # Adding non string keys ...
class CreateAttributeItems < ActiveRecord::Migration def change create_table :attribute_items do |t| t.string :target_type, null: false t.integer :target_id, null: false t.string :title, null: false t.text :body t.integer :position, null: false t.timestamps ...
require './canhelplib' module CanhelpPlugin include Canhelp def grade_submission(token, canvas_url, course_id, assignment_id, user_id, grade) canvas_put("#{canvas_url}/api/v1/courses/#{course_id}/assignments/#{assignment_id}/submissions/#{user_id}", token, { submission: { posted_grade: grade ...
class CreateContacts < ActiveRecord::Migration def change create_table :contacts do |t| t.string :name t.integer :business_phone t.integer :home_phone t.integer :extension t.integer :department_id t.string :em_contact_name t.integer :em_contact_num t.timestamps null...
require 'test_helper' class NoteTest < ActiveSupport::TestCase def setup @note = notes(:one) end test "project, title and text should be present" do assert @note.valid? @note.title = "" @note.text = "" @note.project = nil assert_not @note.valid? end end
require 'spec_fast_helper' require 'hydramata/works/attachment_presenter' require 'hydramata/works/work' require 'hydramata/works/predicate' module Hydramata module Works describe AttachmentPresenter do let(:work) { 'a work type' } let(:predicate) { 'a predicate' } let(:value) { double('Value',...
# STEAL SCRIPT # Questo script permette alle abilità di rubare. module StealSettings # icona che compare nel popup quando nulla viene rubato NO_STEAL_ICON = 0 # icona che compare quando si ruba del denaro ROBBERY_ICON = 0 # moltiplicatore probabilità di furto se il nemico è # addormentato SLEEP_MULTIPL...
class AddSearchActivatedToSwitchboard < ActiveRecord::Migration def change add_column :switchboards, :search_activated, :boolean end end
require "rails_helper" feature "As visitor I can't" do let(:article) { create :article } let(:panel_content) { "You should sign in for have ability to add comments" } scenario "create comment" do visit article_path(article) expect(page).not_to have_button "Create Comment" expect(page).to have_conten...
class XSD::ElementsList < Array def self.create(list_node, schema) case list_node.name when 'choice' XSD::Choice.new(list_node, schema) when 'sequence' XSD::Sequence.new(list_node, schema) when 'all' XSD::All.new(list_node, schema) else raise("not supported node on create_l...
require 'rails_helper' RSpec.describe Gif, type: :model do context "relationships" do it "belongs to category" do gif = Gif.new(image_url: "http://giphy.com/embed/11sBLVxNs7v6WA", category_id: 1 ) expect(gif).to respond_to(:category) end it "has many users" do gif = Gif.new(image_url:...
class MicroposiesController < ApplicationController # GET /microposies # GET /microposies.json def index @microposies = Microposy.all respond_to do |format| format.html # index.html.erb format.json { render json: @microposies } end end # GET /microposies/1 # GET /microposies/1.json...
require File.expand_path('../spec_helper', __FILE__) describe "WLang's version of BasicObject" do class A # Methods that we keep KEPT_METHODS = ["__send__", "__id__", "instance_eval", "initialize", "object_id", "nil?", "singleton_method_added", "__clean_scope__", "...
require 'rails_helper' RSpec.describe FeedController, type: :controller do describe '#index' do let(:time) { Time.utc(2019, 1, 20, 20, 3, 15) } let!(:article) do Timecop.freeze(time) do FactoryBot.create(:article) end end it 'returns a successful response' do get :index ...
module BancSabadell class Product < Base attr_accessor :owner, :description, :user, :iban, :balance, :product, :product_number, :product_id, :currency, :has_more_pages def self.generate_url_keyword(_ = nil) 'productos' end def self.attribute_translations ...
Rails.application.routes.draw do devise_for :admin_users, ActiveAdmin::Devise.config ActiveAdmin.routes(self) namespace :api, format: 'json' do resources :books, only: %i[index show], param: :title get :search, to: 'books#search' get :ranking, to: 'books#ranking' resources :authors, only: %i[index...
$:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__))) require 'set' require 'fileutils' require 'dataMetaDom/help' require 'dataMetaDom/field' require 'dataMetaDom/util' require 'erb' require 'ostruct' module DataMetaDom =begin rdoc Def...
class StudentsController < ApplicationController def index if params[:cohort_id] @cohort = Cohort.find(params[:cohort_id]) @students = @cohort.students else @students = Student.all end end def new @cohorts = Cohort.all @cohort = Cohort.find_by(id: params[:cohort_id]) @st...
class Note < ApplicationRecord belongs_to :user validates_presence_of :name, presence: true validates_presence_of :body, presence: true end
class WebHookParser attr_reader :params def initialize(params) @params = params end def parse link end def self.parse(params) new(params).parse end private def link @link ||= @params[:text].scan(/https:\/\/hooks.slack.com\/services\/\S+/).first end end
module Fog module Compute class ProfitBricks class Real # Update a group. # Normally a PUT request would require that you pass all the attributes and values. # In this implementation, you must supply the name, even if it isn't being changed. # As a convenience, the other four...
# Be sure to restart your server when you modify this file. Action Cable runs in a loop that does not support auto reloading. class OngoingMatchChannel < ApplicationCable::Channel def subscribed stream_from "ongoing_match_#{params[:table_id]}" end def unsubscribed # Any cleanup needed when channel is uns...
# If p is the perimeter of a right angle triangle with integral length sides, {a,b,c}, there are exactly three solutions for p = 120. # # {20,48,52}, {24,45,51}, {30,40,50} # # For which value of p <= 1000, is the number of solutions maximised? # beginning_time = Time.now class Integer def num_solutions solu...
require 'rails_helper' describe Users::CreditcardsController do describe "#index" do context 'not login' do before do @request.env["devise.mapping"] = Devise.mappings[:user] session[:received_form] = { user: { nickname: Faker::Name.last_name, email: Faker...
class RemoveRepeatFromOccurrences < ActiveRecord::Migration def self.up remove_column :occurrences, :repeat end def self.down add_column :occurrences, :repeat, :boolean end end
$LOAD_PATH.unshift File.join(__dir__, "..", "lib", "bogus_twitter_pictures_ingestor") $LOAD_PATH.unshift File.join(__dir__, "helpers") require "minitest/autorun" require "data_export_task" require "fake_data_exporter" # Test DataExportTask class TestDataExportTask < Minitest::Test def create_fake_data_exporter ...
class UsersController < ApiController helper ApplicationHelper def create @user = User.create_with(user_params).find_or_create_by(email: user_params[:email]) render json: @user.to_json(root:true, methods: [:gravatar_url]) end def interaction from_user = User.find_by_email(params[:from_email_id]) ...