text
stringlengths
10
2.61M
require 'pry' class Translator def initialize(word_or_phrase) if word_or_phrase.split.length > 1 @phrase = word_or_phrase elsif word_or_phrase.split.length == 1 @word = word_or_phrase else raise "You must input some words to be translated." end end def words if @phrase != nil @phrase.split ...
class Show < ActiveRecord::Base belongs_to :network has_many :characters has_many :actors, through: :characters end
require 'test_helper' class ProfilesControllerTest < ActionController::TestCase test "should get show" do get :show, id: users(:moe).profile_name assert_response :success assert_template 'profiles/show' end test "should render a 404 on profile not found" do get :show, id: "doesn't exisst" assert_res...
$:.push "." require 'rt' require 'yaml' require 'stringio' module RTHelper FIXTURE_DIR=File.join(File.dirname(__FILE__),'fixtures') def fixture_path(str) File.join(FIXTURE_DIR,str) end def setup_bin_test %x{cp rt.rb #{mock_ruby_path}} %x{rm #{fixture_path('fixture.rb.bak')}} end def mock_file...
class RemoveNotNullConstraintFromReferences < ActiveRecord::Migration def up change_column :references, :title, :text, :null => true change_column :references, :citation, :text, :null => false end def down change_column :references, :title, :text, :null => false change_column :references, :citati...
class CreateImages < ActiveRecord::Migration def up create_table :images do |t| t.references :area, :null => false t.string :name, :null => false t.string :image t.integer :image_size, :default => 0 t.string :image_content_type t.timestamps end end def down drop_tab...
class AddTodolistIdToListitem < ActiveRecord::Migration def change add_column :listitems, :todolist_id, :integer end end
# Fact: infiniband_hca_board_id # # Purpose: Determine the board ID of HCA # # Resolution: # Returns Hash of HCAs and their board ID. # require 'facter/util/infiniband' Facter.add(:infiniband_hca_board_id) do confine has_infiniband: true setcode do hcas = Facter.fact(:infiniband_hcas).value || [] hca_bo...
class Api::RatingsController < ApplicationController def index @ratings = Rating.order(:id) respond_to do |format| format.json { render json: @ratings.to_json, status: 200 } end end end
class AddMostRecentGdpPppToCountries < ActiveRecord::Migration def change add_column :countries, :most_recent_gdp_ppp, :integer end end
class Slide < ActiveRecord::Base include Positioned alias_attribute :parent_id, :position mount_uploader :src, SlideUploader after_destroy :clear_files private # delete attached file and its versions if present def clear_files return if src.current_path.nil? FileUtils.rm_rf(File.dirname(self....
class FakeDuck def method_missing(m, *args) FakeDuck.new end end class UpdateTrashAndCategories < ActiveRecord::Migration[5.2] def cat(name) Category.find_by_name(name) || FakeDuck.new end def trash(name) Trash.find_by_name(name) || FakeDuck.new end def mat(name) Material.where('lower(n...
module Domain class Match def matches?(request) if request.subdomain.present? && request.subdomain != 'www' && request.subdomain != 'myplaces' request.path_parameters[:city_id] = request.subdomain end dom = request.host.gsub Regexp.new('^'+request.subdomain+'\.'), '' I18n.locale ...
# -*- mode: ruby -*- # vi: set ft=ruby : # For reloading the VM required_plugins = %w( vagrant-reload ) required_plugins.each do |plugin| system "vagrant plugin install vagrant-reload" unless Vagrant.has_plugin? plugin end Vagrant.configure(2) do |config| config.vm.box = "boxcutter/ubuntu1404-desktop" config.vm....
# frozen_string_literal: true class TeacherSetSerializer < ActiveModel::Serializer cached attributes :id, :availability, :availability_string, :description, :details_url, :primary_language, :subject_key, :title, :suitabilities_string, :call_number, :physical_description, :set_type, :contents, :tota...
##### Buscar cidade por id Quando('solicito o id de uma cidade para o serviço de metereologia') do @id = Servico.buscar_cidade_por_id end Então('devo obter o código de status referente ao id {string}') do |status| expect(@id.response.code).to eql status end Então('recebo uma lista com o id da cidade desejad...
class CreateProductCandidates < ActiveRecord::Migration def change create_table :product_candidates do |t| t.string :name t.integer :price t.string :source t.integer :score t.text :description t.integer :desired_object_id t.string :type t.timestamps end end e...
class CommentsController < ApplicationController before_action :set_comment!, except: [:create, :new, :index] def index if params[:whiskey_id] @comments = Whiskey.find(params[:whiskey_id]).comments respond_to do |f| f.json {render json: @comments} f.html {render :index} end ...
require 'spec_helper' describe 'Peep' do context "DataMapper Test" do it "should be created and then deleted from the database" do expect(Peep.count).to eq(0) Peep.create(:name => "Karin Nielsen", :user_handle => "@karinmnielsen", :post => "this is my first peep") expect(Peep.count).to eq(1) ...
class ContactSerializer < ActiveModel::Serializer attributes :id, :name, :email, :birthdate#, :author belongs_to :kind do link(:related) { contact_kind_url(object.kind.id) } end has_many :phones do link(:related) { contact_phones_url(object.kind.id) } end has_one :adddress do link(:related) {...
class WomenApplicant < Applicant enum status: [:applied, :accepted, :enrolled, :not_enrolled, :rejected, :gave_up, :graduated] enum program: [:full, :partial] before_create :generate_uid hstore_accessor :info, uid: :string, valid_code: :boolean, accepted_terms: :boolean, birthday: :string, ...
# frozen_string_literal: true class ChessPiece attr :position attr_reader :colour, :can_jump def initialize(position, colour) @position = position @colour = colour @unmoved = true @can_jump = false end def move(position) @position = position @unmove...
class OpinionsController < ApplicationController before_action :signed_in_user def new @opinion = Opinion.new end def create @opinion = Opinion.new(opinion_params) if @opinion.save flash[:success] = "Комментарий добавлен!" redirect_to :back else redirect_to :back end end def destroy end ...
=begin MEASURE default argument of 1 (because sometimes it is passed a int for repeating the block) API Time.parse is used, startTime to declare time at start of method [time - other_time → float] OR [time - numeric → time] count.times {yield} (performs block n times) =end def measure (count =...
module EmailContentsHelper def year_plain_image(year) et_image_tag YEAR_PLAIN_IMAGES[year], year, 78, 48 end def year_starred_image(year) et_image_tag YEAR_STARRED_IMAGES[year], year, 116, 65 end def year_helpful_image(year) et_image_tag YEAR_HELPFUL_IMAGES[year], year, 116, 65 ...
require 'events/base' module Events class FileImportCreated < Base has_targets :workspace, :dataset has_activities :actor, :workspace, :dataset has_additional_data :file_name, :import_type, :destination_table end end
# frozen_string_literal: true module Users class List < Actor output :list, type: Enumerable def call self.list = User.all end end end
module IuguBase extend ActiveSupport::Concern included do attr_reader :charge end def perform if orders && charge! && success? finish_purchase else invoice.cancel end success? end def redirect_path if success? [Rails.application.routes.url_helpers.checkout_succes...
class RemoveViewingTimeFromShow < ActiveRecord::Migration def change remove_column :shows, :viewing_time end end
# Rakefile to build a project using HUDSON require 'rake/rdoctask' require 'rake/packagetask' require 'rake/clean' require 'find' PROJ_DOC_TITLE = "The Marionette Collective" PROJ_VERSION = "0.4.7" PROJ_RELEASE = "1" PROJ_NAME = "mcollective" PROJ_RPM_NAMES = [PROJ_NAME] PROJ_FILES = ["#{PROJ_NAME}.spec", "#{PROJ_NAM...
#!/usr/bin/env ruby main_file = IO.read("main.lua") app_name = Dir.pwd[ /([^\/]+)\/?$/ ] build_dir = "build" app_dir = File.join( build_dir, "#{ app_name }Build" ) app_main_file = File.join( app_dir, "main.lua" ) already_required = [] puts "Merging files" while editing = main_file[ /require\s?"/ ] main_file.gsub!(...
class ApplicationController < ActionController::Base protect_from_forgery with: :exception # Expose current_user method to the views helper_method :current_user helper_method :text helper_method :logged_in? private require 'csv' def read_csv csv_data = CSV.read 'test_words.csv' csv_data.to_a...
require_relative './database.rb' require 'yaml/store' require 'pry' class IdeaStore extend Database def self.all ideas = [] raw_ideas.each_with_index do |data, i| ideas << Idea.new(data.merge("id" => i)) end ideas end def self.raw_ideas database.transaction do |db| db['ideas'...
# == Schema Information # # Table name: project_user_links # # id :bigint(8) not null, primary key # project_id :integer # user_id :integer # created_at :datetime not null # updated_at :datetime not null # type :string # status :string # class ProjectUserLink < Applic...
require 'rails_helper' RSpec.describe User, type: :model do it "is not valid without GitHub link if user type is coach" do user = User.new(username: "johnsmith72", first_name: "John", last_name: "Smith", user_type: "coach", email: "johnsmith@codecoach.com", location: "New York, NY", password: "password") ex...
class User < ApplicationRecord mount_uploader :photo, PhotoUploader devise :database_authenticatable devise :omniauthable, :omniauth_providers => [:github,:twitter] has_many :papers has_many :reviews has_many :user_activity_relationships has_many :activities, through: :user_activity_relationships has_m...
#Copied it from http://code.google.com/p/gstreamer-java/wiki/VideoTestTutorial load '../lib/jruby_gst.rb' import javax.swing.JFrame import java.awt.BorderLayout import java.awt.Dimension class VideoTest def initialize(args = []) args = Gst.init("VideoTest", args) pipe = Gst::Pipeline.new("VideoTest") vid...
module SerializeAndSymbolize extend ActiveSupport::Concern module ClassMethods def serialize_and_symbolize(*column_names) column_names.flatten.uniq.compact.map(&:to_sym).each do |column_name| setup_name = "setup_#{column_name}".to_sym symbolize_name = "symbolize_#{column_name}".to_sym ...
class Driver < ActiveRecord::Base belongs_to :constructor has_many :finishing_positions has_many :races, through: :finishing_positions def name "#{first_name} #{second_name}" end def increase_skill(skill_points) self.skill_factor += skill_points end def self.reset_drivers_to_teams Driver...
class AddConsultantsAndProjectTypeToProjects < ActiveRecord::Migration[5.1] def change add_column :projects, :consultants, :text add_column :projects, :project_type, :text end end
class AddPublishDateToDistributions < ActiveRecord::Migration def change add_column :distributions, :publish_date, :datetime end end
# Read about factories at https://github.com/thoughtbot/factory_girl FactoryGirl.define do factory :payment do amount "9.99" customer nil notes "MyText" payment_method "MyString" reference "MyString" end end
class TeamMailer < ApplicationMailer def team_mail(user) mail to: user.email, subject: "あなたにチームの権限が渡されました。" end end
class BuysController < ApplicationController before_action :set_buy, only: [:index, :create] before_action :sort def index @item_buy = ItemBuy.new end def create @item_buy = ItemBuy.new(buy_params) if @item_buy.valid? pay_item @item_buy.save redirect_to items_path else ...
class GamesController < ApplicationController before_action :set_api before_action :set_game, only: [:edit, :show, :update] def index @games = @game_api.get_all_games end def new @game = {} end def show # tried to show a game that doesn't exist if @game[:error] == GameApi::ERRORS[:NOT_F...
class AddDateTimeSetToAppointments < ActiveRecord::Migration def change add_column :appointments, :proposed_date, :date add_column :appointments, :proposed_time, :time add_column :appointments, :picked, :boolean add_column :appointments, :property_id, :integer add_column :appointments, :pushed_out...
class Admin::UsersController < ApplicationController before_action :authenticate_user! #layout "administration" def index @users = User.all end def show @user = User.find(params[:id]) end def edit @user = User.find(params[:id]) # TODO rechercher les roles pour l'utilisateur ...
source "https://rubygems.org" # Hello! This is where you manage which Jekyll version is used to run. # When you want to use a different version, change it below, save the # file and run `bundle install`. Run Jekyll with `bundle exec`, like so: # # bundle exec jekyll serve # gem "github-pages", group: :jekyll_plugi...
class WhitelistsController < ApplicationController load_and_authorize_resource :callthrough load_and_authorize_resource :whitelist, :through => [:callthrough] before_filter :set_parent_and_path_methods before_filter :spread_breadcrumbs def index end def show end def new @whitelist.phone_number...
# frozen_string_literal: true require 'net/ldap' module LdapQuery # For establishing an LDAP connection (binding LDAP connection) class Connection attr_accessor :link REQUIRED_KEYS = %i[host port base auth].freeze # Used for creating the initial Ldap connection for querying with supplied parameters ...
print "Enter Grade Point: " grade = gets.chomp.to_i result = case grade when 90..100 then "Letter Grade A" when 80...90 then "Letter Grade B" when 70...80 then "Letter Grade C" when 60...70 then "Letter Grade D" when 50...60 then "Letter Grade E" when 0...50 then "...
require 'minarai/actions/base' module Minarai module Actions class Rbenv < Base attribute :version, required: true, type: String attribute :global, type: [TrueClass, FalseClass], default: true def run install_specific_ruby_version unless has_specific_ruby_version? set_global_ru...
class Statement4 def initialize(date) @cheryl = Cheryl.new @bernard = Person.new @date = date.is_a?(DateObject) ? date : DateObject.new(date) end def valid? not bernard.know(at_first) and bernard.know(dates_for_statement3_is_true) end private attr_reader :cheryl, :bernard, :date def at...
require 'rails_helper' RSpec.describe User, type: :model do describe 'users validates' do let(:user) { create(:user) } let(:other_user) { create(:user) } let(:user_search) { User.search(other_user.name, 1) } it 'validationが全て通れば、有効' do expect(user).to be_valid end it '名前がなければ、...
module PodStatic TARGET_SUPPORT_FILE_PATH = 'Pods/Target Support Files/' XCCONFIG_FILE_EXTENSION = 'xcconfig' LIBRARY_SEARCH_PATH_KEY = 'LIBRARY_SEARCH_PATHS' FRAMEWORK_SEARCH_PATH_KEY = 'FRAMEWORK_SEARCH_PATHS' OTHER_CFLAGS_KEY = 'OTHER_CFLAGS' STATIC_LIBRARY_DIR = 'Static' PODS_ROOT = '${PODS_ROOT}' D...
# 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...
module FigRake class Command attr_accessor :container_name, :rake_args, :command def initialize(command, container_name, rake_args) @command, @container_name, @rake_args = command, container_name, rake_args end def exec p "fig run --rm --entrypoint=#{command} #{container_name} #{rake...
class Technique < ActiveRecord::Base validates_presence_of :name has_many :qualifications has_many :users, :through => :qualifications # Class methods class << self def dropdown [['All', 'all'] ] + all.map { |u| [u.name, u.id] } end end end
#!/usr/bin/env ruby Dir[File.join('lib', '**', '*.rb')].each do |file| require_relative file end def play_new blackjack = Game.new blackjack.begin_blackjack! blackjack.display_player_hand blackjack.prompt_hit_or_stand blackjack.compare_scores play_again? end def play_again? print "Play again? (Y/N): "...
module GoogleSpreadsheets class Worksheet < Base class Format < GDataFormat def encode(hash, options = {}) super({'title'=>hash['title'],'gs:rowCount'=>hash['rowCount'],'gs:colCount'=>hash['colCount']}, { :namespaces => { 'gs' => 'http://schemas.google.com/spreadsheets/2006' } }) ...
json.array!(@attended_events) do |attended_event| json.extract! attended_event, :id, :user_id, :event_id json.url attended_event_url(attended_event, format: :json) end
class Api::V1::PlacesController < Api::V1::BaseController before_action :set_place, only: [:show] respond_to :json def index @places = Place.includes(:place_types_places).includes(:place_type).order('places.name') @cache_id = places_cache_id end def show @cache_id = place_cache_id end priva...
require 'rake' require 'rake/file_utils_ext' class SnapDeploy::Provider::Update < Clamp::Command SnapDeploy::CLI.subcommand 'update', 'Update snap deploy', self include SnapDeploy::CLI::DefaultOptions include SnapDeploy::Helpers include Rake::FileUtilsExt option '--revision', 'REVIS...
class TweetsController < ApplicationController # solo si usuario está logeado puede acceder before_action :authenticate_user!, only: [ :retweets, :show ] def index if params[:q] # búsqueda parcial por el content del tweet @tweets = Tweet.where('content LIKE ?', "%#{params[:q]}%").order(created_...
require 'formula' class Corkscrew < Formula homepage 'http://www.agroman.net/corkscrew/' url 'http://www.agroman.net/corkscrew/corkscrew-2.0.tar.gz' sha1 '8bdb4c0dc71048136c721c33229b9bf795230b32' depends_on "libtool" => :build def install cp Dir["#{Formula["libtool"].opt_share}/libtool/*/config.{guess...
FactoryGirl.define do factory :notification do title "test" description "test description" entry_message "test entry message" exit_message "test exit message" association :beacon end end
class ToolPhoto < ApplicationRecord belongs_to :tool validates :url, presence: true validates :tool_id, presence: true end
require 'nokogiri' require 'yaml' require 'fileutils' require 'digest/md5' $: << File.dirname(__FILE__) + '/lib' require 'util' begin $config = YAML::load_file('/etc/aggregator-singpolyma/config.yml') rescue Errno::ENOENT $config = YAML::load_file(File.dirname(__FILE__) + '/config.yml') end entries = Hash.new {|h,...
class CreateAvgratings < ActiveRecord::Migration def change create_table :avgratings do |t| t.integer :ratingsum t.integer :rateduser t.references :gallary, index: true, foreign_key: true t.timestamps null: false end end end
module Plasma module Interpreter module PlasmaGrammar include Treetop::Runtime def root @root || :template end module Template0 def macro elements[0] end def tail elements[1] end end module Template1 def he...
# frozen_string_literal: true module RubyPushNotifications module FCM # Encapsulates a FCM Notification. # By default only Required fields are set. # (https://developer.android.com/google/fcm/server-ref.html#send-downstream) # # @author Carlos Alonso class FCMNotification attr_reader :r...
class Game attr_accessor :board, :player_1, :player_2 WIN_COMBINATIONS = [ [0,1,2], [3,4,5], [6,7,8], [0,3,6], [1,4,7], [2,5,8], [0,4,8], [6,4,2] ] def initialize(player_1 = Players::Human.new("X"), player_2 = Players::Human.new("O"), board = Board.new) @board = board @player_1 = playe...
# Virus Predictor # I worked on this challenge [by myself, with: ]. # We spent [#] hours on this challenge. # EXPLANATION OF require_relative # # require_relative 'state_data' class VirusPredictor # method initializes a class instance setting it with state, pop density , population def initialize(state_of_origi...
require './lib/enrollment.rb' require './lib/district_repository' require './lib/district' require './lib/custom_errors' include Errors class EnrollmentTest < Minitest::Test def data_dir File.expand_path '../data', __dir__ end def test_it_can_find_participation_by_year dr = DistrictRepository.from_json...
class User < ActiveRecord::Base has_many :rounds validates :email, uniqueness: true, :presence => true validates :password, uniqueness: true, :presence => true def self.authenticate(email, password) if User.exists?(email: email, password: password) User.where(email: email, password: password) els...
class Organization < ActiveRecord::Base MEMBER = 'member' ADMIN = 'admin' OWNER = 'owner' ROLES = [MEMBER, ADMIN, OWNER] has_many :organization_buildings has_many :buildings, through: :organization_buildings has_many :audit_reports has_many :report_templates has_many :users validates :owner, pres...
require 'rails_helper' RSpec.describe "Comments", type: :request do describe "GET /movies/:id", :vcr do let!(:comment) { create(:comment) } it "displays comments on movie page" do visit movie_path(comment.movie) expect(page).to have_selector(".panel-body", text: comment.content) expect(pa...
# input: array of integers # output: sum of sums of each leading subsequence (integer) # sequence of sums starts with sum of first integer(which is just integer) then sum of first integer and second integer, and then sum of first three integers, then sum of first four integers etc # index goes up by one and then you wo...
# -*- mode: ruby -*- # vi: set ft=ruby : Vagrant.configure("2") do |config| config.vm.box = "centos/6" config.vm.network "forwarded_port", guest: 80, host: 8080 config.vm.network "forwarded_port", guest: 443, host: 8443 config.vm.network "private_network", ip: "192.168.33.11" config.vm.hostname = "vagrant" ...
require_dependency "administration/application_controller" module Administration class MembersController < ApplicationController def index @members = Member::User.all.order("created_at DESC").page(params[:page]).per(10) end def show @member = Member::User.find(params[:id]) @publication...
class CreateReviews < ActiveRecord::Migration def change create_table :reviews do |t| t.string :url t.decimal :rating, :precision => 4, :scale => 2 t.integer :bnm t.integer :year t.string :author t.text :body t.integer :album_id end end end
Integer.class_eval do def is_prime? return false if self < 2 (2..Math.sqrt(self).to_i).none?{ |i| self % i == 0 } end end
require_relative 'swagger_definition.rb' # The Swagger1DefinitionExtractor class is responsible for # extracting information out of Swagger 1.x documents. class Swagger1DefinitionExtractor def extract(json) operations = available_operations(json) models = available_models(json) SwaggerDefinition.new(oper...
=begin Gives "boardable" pieces the basics for being placed and moving. =end module Game module Thud module Piece attr_reader :x, :y, :board # has a board and coordinates # board:: Board instance, required # x, y:: coordinates, only if the piece is not out def initialize board, x = nil,...
class Event < ApplicationRecord before_save :system_name_trim, :update_purge_date, :update_url, :update_purge_status validates :event_system_name, :uniqueness => {:scope => [:company_id,:event_type_id]} validates :event_name, :event_system_name, :start_date, :end_date, :card_no, :company_id, :event_type_id, pres...
# @author Carlos Arvelo Garcia (alu0100943849) require 'nutrientes/version' require 'Antropometrico' #Clase Individuo almacena los datos de un individuo class Individuo attr_reader :nombre def initialize(nombre) @nombre = nombre @datos = nil end # Comprueba si el Tipo ...
class CreateCheckOutEarlyViews < ActiveRecord::Migration def change create_view :check_out_early_views, materialized: true end end
class PurchaseMailer < ApplicationMailer def mail_purchase_notification(customer_email, message) @customer_email = customer_email @message = message shop_email = 'filip.maslovaric@gmail.com' mail(to: shop_email, subject: "Customer @ #{@customer_email} just made a purchase!") end def mail_purchase...
class CustomersController < ApplicationController def index customers = Customer.all render json: customers.as_json(except: [:created_at, :updated_at]), status: :ok end end
require "redis" require "sinatra" require "uri" class App < Sinatra::Base configure do set :redis, Redis.new(:url => ENV["REDIS_URI"]) end get "/" do <<-HTML <html> <p>Hello, Redis!</p> <form method="post" action="/set"> Set <input name="key" placeholder="key" required> = <input name="...
# you can write to stdout for debugging purposes, e.g. # puts "this is a debug message" def solution(a) # write your code in Ruby 2.2 a.sort! #use two pointers and do slidding window technique pointer_a = 0 pointer_b = 1 while(pointer_b < a.size) if a[pointer_a] == a[pointer_b] a.delete(a[pointer...
module Api::V1 class OnlyCardMemberSerializer < ActiveModel::Serializer attributes :id, :individuals_point end end
FactoryGirl.define do factory :studio_brand_studio do association :studio_brand association :studio end end
# frozen_string_literal: true module Dynflow module Debug module Telemetry module Persistence methods = [ :load_action, :load_actions, :load_action_for_presentation, :load_action, :load_actions, :load_action_for_presentation, :loa...
require 'spec_helper' describe Comment do describe "valid comment" do subject { create(:comment) } it "is valid with a link and a comment and a username" do should be_valid end end describe "invalid comment" do it "is invalid without a link" do expect(build(:comment, link: nil)).t...
load 'Modelo/Conectividad.rb' load 'Modelo/Disco.rb' load 'Modelo/Grafica.rb' load 'Modelo/Procesador.rb' load 'Modelo/Puertos.rb' load 'Modelo/Ram.rb' load 'Modelo/Componente.rb' class ModeloPC::Ordenador def initialize disco, procesador, puertos, ram, conectividad, grafica @disco=disco @procesador=...
# -*- mode: ruby -*- # vi: set ft=ruby : Vagrant.configure(2) do |config| # Use a preconfigured Vagrant box config.vm.box = "charlesportwoodii/php7_xenial64" config.vm.box_check_update = true # Mount the directory with sufficient privileges config.vm.synced_folder ".", "/var/www", id: "vagrant-root", ...
describe "DELETE /spot/:id" do before(:all) do result = SpotApi.new.session({ email: "delete@gmail.com" }) @user_id = result.parsed_response["_id"] end describe "when delete unique spot" do before(:all) do spot = ({ thumbnail: "delete.jpg", company: "Deletão", techs: ["java", "react"], price: 1...
module SessionsHelper def current_user @current_user ||= User.find_by_id(session[:user_id]) if session[:user_id] end def admin? logged_in? && session[:user_id] == current_user.id && current_user.admin end def logged_in? !current_user.nil? end end
module Rednode class Process < EventEmitter include Constants include Namespace attr_reader :global, :env, :scheduler def initialize(node) @node = node @engine = node.engine @global = @engine.scope @bindings = {} @env = Env.new @scheduler = Rednode::Scheduler.new ...