text
stringlengths
10
2.61M
Pod::Spec.new do |s| s.name = "libwebp" s.version = "1.0.2" s.summary = "Library to encode and decode images in WebP format." s.homepage = "https://github.com/zylcold/libwebp" s.license = { :type => "BSD", :file => "COPYING" } s.author = "Google Inc." s....
require 'rails_helper' include Warden::Test::Helpers Warden.test_mode! RSpec.describe ViewsController, type: :controller do let(:user) {create(:user)} let(:episode) {create(:episode)} describe "POST change" do it "creates a view when appropriate" do login_as(user, scope: :user) post :change, par...
require "application_system_test_case" class CashManagementsTest < ApplicationSystemTestCase setup do @cash_management = cash_managements(:one) end test "visiting the index" do visit cash_managements_url assert_selector "h1", text: "Cash Managements" end test "creating a Cash management" do ...
require 'withindex.rb' def default(inp, d) (yield inp) ? inp : d end def nilv(inp, d) default(inp, d) {|i| !i.nil?} end def emptyv(inp, d) default(inp, d) {|i| !i.empty?} end def zerov(inp, d) default(inp, d) {|i| i == 0} end class String def integer? self =~ /^[+-]?\d+/ end def em...
ND = [[0,0],[0,1],[0,2],[0,3]] NE = [[0,0],[1,1],[2,2],[3,3]] ET = [[0,0],[1,0],[2,0],[3,0]] SE = [[0,0],[1,-1],[2,-2],[3,-3]] EH = [[0,0],[0,-1],[0,-2],[0,-3]] EW = [[0,0],[-1,-1],[-2,-2],[-3,-3]] WT = [[0,0],[-1,0],[-2,0],[-3,0]] NW = [[0,0],[-1,1],[-1,2],[-3,3]] DERECTIONS = [ ND, NE, ET, SE, EH, EW, WT, NW ] clas...
ActiveAdmin.register SpecialRequest do menu parent: 'Users' permit_params :user_id, :request_type index do column(:user, sortable: 'users.first_name') { |ss| link_to ss.user.name, admin_user_path(ss.user) } column :request_type actions end filter :user, as: :select, collection: User.companies ...
class GuiFunctionsController < ApplicationController load_resource :gui_function before_filter :load_user_groups before_filter :spread_breadcrumbs def index @gui_functions = GuiFunction.order(:category, :name) end def show @gui_function = GuiFunction.find(params[:id]) end def new @gui_fu...
#Utility::EncryptUrl.new(hash_method: "sha3",url: "http://google.com", secret: "123").ex #Utility::EncryptUrl.new(hash_method: "enc_sha3",url: "http://lvh.me:3000/respondent_entry?api_key=907794f0-3443-4341-8533-03784213d11d&suid=4227f4b0-3920-41a4-bf32-b13e7b4294e5&quid=c5641ed3-5a2c-40cd-abe2-ab96211d4e20&user_id=ada...
require "rails_helper" RSpec.describe DogWalking, type: :model do let!(:product) do Product.create({ name: 'Caminhada de 30 min', duration: 30, first_price: 25, aditional_price: 15 }) end context '.create' do it 'creates with a correct price for more than one pets' do ...
Given(/^user navigates to meet list$/) do visit games_path page.should have_css('table#meets_list') end When(/^a meet is( not)? at maximum capacity$/) do |negate| @maxed_meets = Hash.new #trs = page.assert_selector('table#meets tr', :minimum => 2) page.all('table#meets_list tr.meet').each do |tr| ...
$:.push File.expand_path("../lib", __FILE__) # Maintain your gem's version: require "super_role/version" # Describe your gem and declare its dependencies: Gem::Specification.new do |s| s.name = "super_role" s.version = SuperRole::VERSION s.authors = ["Roy Y. Bao"] s.email = ["roybao2010@g...
#!/usr/bin/ruby # Ruby Time.now (or Time.new). To display the epoch: Time.now.to_i # from http://www.epochconverter.com/ print Time.now print "\n" print Time.now.to_i print "\n"
class Temperature # Temperature is stored in fahrenheit internally # options hash is either { :f => ? } or { :c => ? } def initialize(options) @temperature = 0 if options.key?(:f) @temperature = options[:f].to_f elsif options.key?(:c) @temperature = options[:c].to_f * 9.0/5.0 + 32.0 # Co...
require 'test_helper' class TicketsganadorestsControllerTest < ActionDispatch::IntegrationTest setup do @ticketsganadorest = ticketsganadorests(:one) end test "should get index" do get ticketsganadorests_url assert_response :success end test "should get new" do get new_ticketsganadorest_url...
# frozen_string_literal: true # == Schema Information # # Table name: student_tags # # created_at :datetime not null # updated_at :datetime not null # student_id :integer not null # tag_id :uuid not null # # Indexes # # index_student_tags_on_student_id (student_id) # ind...
require 'mysql-helper.rb' require 'lj_network.rb' =begin CREATE DATABASE lj; DROP TABLE IF EXISTS user; CREATE TABLE user ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, name varchar(16) NOT NULL, visited bit default 0, CONSTRAINT UNIQUE KEY i_user_name (name), KEY i_user_visited (visited) ) ENGI...
class Picture < ActiveRecord::Base belongs_to :user mount_uploader :image, ImageUploader def self.front_page_set Picture.limit(8).order("RAND()") end def initialize(attributes = {}) attributes[:year] ||= Time.now.year.to_s super(attributes) end end
module D7P1 class D7P1 def run(input) all_bags = build_tree(input) bag = all_bags["shiny gold"] ancestors = traverse_parents(bag) puts "Different Parent bags: #{ancestors.count}" end def build_tree(input) all_bags = {} input.each do |rule| rule.chomp! p...
require "uri" require "codeunion/github_api" require "addressable/uri" module CodeUnion # Sends feedback requests to CodeUnion for review class FeedbackRequest WEB_URL_REGEX = /\A#{URI.regexp(['http', 'https'])}\z/ GIT_URL_REGEX = %r{\A(git://)?git@github.com:(.*)(.git)?\z} REPO_CAPTURE_INDEX = 1 ...
hash = {:nombre => "Coding", :apellido => "Dojo"} hash.delete(:apellido) print hash # => {:nombre => "Coding"} # # .empty? => devuelve true si el hash no contiene pares de clave-valor p hash.empty? # # .has_key?(clave) => true ó false p hash.has_key?(:nombre) # # .has_value?(valor) => true ó false p hash.has_valu...
require "rails_helper" describe Review do it "is invalid without content" do FactoryGirl.build(:review, content: nil).should be_valid end it "is invalid without too long content (more than 5000 characters)" do FactoryGirl.build(:review, content: Faker::Lorem.characters(5001)).should_not be_valid ...
class CreateVisitedTopics < ActiveRecord::Migration def self.up create_table :visited_topics do |t| t.belongs_to :user t.belongs_to :topic t.integer :visits, :default => 1 t.timestamps end add_index :visited_topics, :user_id add_index :visited_topics, :topic_id end def s...
module DOM class TestCase < Test::Unit::TestCase KNOWN_ISSUES = { :nokogiri_entity_resolve_bug => false, # 10 failures, 19 errors :missing_default_values => false, # 10 failures, 0 errors :node_normalize_not_implemented => false, # 0 failur...
require File.dirname(__FILE__) + '/../../../../spec_helper' require File.dirname(__FILE__) + '/../../shared/constants' require 'openssl' describe "OpenSSL::X509::Certificate#signature_algorithm" do it 'is string "NULL" by default' do x509_cert = OpenSSL::X509::Certificate.new x509_cert.signature_algorithm.sh...
require './generators/str_parser' class Subtitle attr_accessor :lines attr_accessor :typos def initialize(file_path) parser = Str_Parser.new file_path @lines = parser.get_lines end def write_file(output_file) content = format_content IO.write(output_file, content) end def format_content content ...
class SessionsController < ApplicationController before_filter :store_return_to def new end def create @user = User.find_by_username(params[:username]) if @user && @user.authenticate(params[:username], params[:password]) session[:user_id] = @user.id success = true end respond_to do...
require 'ripper' require 'sourcify' module Printrun module Core def lines(source) Enumerator.new do |out| source.split("\n")[1..-2].reduce("") do |buffer, line| buffer << "\n#{line}" Ripper.sexp_raw(buffer) ? (out << buffer) && "" : buffer end end end # @...
class CreateShops < ActiveRecord::Migration def change create_table :shops do |t| t.string :shopname t.string :phone t.string :address_city t.string :address_state t.string :address_country t.string :address_street t.string :legal_number t.string :legal_number_type ...
class VitaesController < ApplicationController before_action :get_vitae, except: [ :index, :create ] before_action :set_csrf_token_header, only: [ :index, :show ] respond_to :json def index @vitaes = current_user.vitaes end def show @vitaes = [ @vitae ] end def create @vitae = cu...
module Bosh::Director::Jobs module Helpers class ReleasesToDeletePicker def initialize(release_manager) @release_manager = release_manager end def pick(releases_to_keep) unused_releases = @release_manager .get_all_releases ...
class HeapNode attr_reader :key, :value def initialize(key, value) @key = key @value = value end end class MinHeap def initialize @store = [] end # This method adds a HeapNode instance to the heap # Time Complexity: O(log(n)) # Space Complexity: 0(1) def add(key, value = key) @stor...
class Canvas < ApplicationRecord validates :singleton_guard, inclusion: {in: [0]} validate :in_json_format validate :has_correct_dimensions def self.instance # There will only be one row, so its ID must be '1' begin find(1) rescue ActiveRecord::RecordNotFound canvas = Canvas.new c...
class Task < ApplicationRecord scope :most_recent, -> { order(order: :asc) } end
module Telegram module Bot module RSpec # Proxy that uses RSpec::Mocks::ArgListMatcher when it's available. # Otherwise just performs `#==` match. # # Also allows to check argumets with custom block. class ArgListMatcher attr_reader :expected, :expected_proc def init...
class SlicesController < ApplicationController before_action :set_slice, only: [:show, :edit, :update, :destroy] before_action :set_use_case, only: [:option, :new] # GET /slices # GET /slices.json def index @slices = Slice.all end # GET /slices/1 # GET /slices/1.json def show # redirect HTML...
require 'rails_helper' RSpec.describe Sponsor, type: :model do it { should respond_to :name } it { should respond_to :description } it { should respond_to :slug } it { should respond_to :website } it { should respond_to :logo } it { should respond_to :hiring } it { should respond_to :email } it { shoul...
class AddSpecialRequirementNoteToPeople < ActiveRecord::Migration[5.2] def change add_column :people, :special_requirement_note, :text end end
# frozen_string_literal: true module V1 class EntriesController < V1::ResourcesController def index @entries = Entry .page(page_params[:number]) .per(page_params[:size]) options = { meta: meta(@entries) } render json: V1::EntriesSerializer.new(@entries, options).serialized_json ...
require_relative 'planet' class SolarSystem attr_reader :star_name, :planets attr_accessor :planets def initialize(star_name) @star_name = star_name @planets = [] end #takes instance of Planet as parameter? def add_planet(planet_instance) @planets << planet_instance end # return string ...
require 'rails_helper' # create_table :users do |t| # t.string :first_name # t.string :last_name # t.string :email # t.string :phone # t.string :password_digest # t.string :user_type RSpec.describe User, :type => :model do pending "add some examples to (or delete) #{__FILE__}" it { should validate_pre...
require './printer' class Game attr_reader :guess, :turns, :secret_code, :printer, :command def initialize(printer = Printer.new) @guess = 'rrgb' @turns = 0 @secret_code = generate_secret_code @printer = printer @command = "" end def generate_secret_code colors = ['r', 'b', 'g', 'y'] ...
# Write your code here. def line(deli) if deli == [] puts "The line is currently empty." else start = 0 place = (start + 1).to_s length = deli.length phrase = "The line is currently:" length.times do place = (start + 1).to_s name = deli.fetch(start) phrase = phrase +...
require "txi_rails_hologram/rendering_context" require "haml" # We overwrite the default "haml" handler from hologram to use our Rails-aware # version. Hologram::CodeExampleRenderer::Factory.define "haml" do example_template "markup_example_template" table_template "markup_table_template" lexer { Rouge::Lexer.fi...
require "./test/test_helper" class LeagueStatsTest < Minitest::Test def setup @game_path = './data/game_fixture.csv' @team_path = './data/team_info.csv' @game_teams_path = './data/game_team_stats_fixture.csv' @locations = {games: @game_path, teams: @team_path, game...
require 'accessible_for' class AccessibleForTest < MiniTest::Unit::TestCase include AccessibleFor accessible_for :default => :topping accessible_for :manager => accessible_by(:default) + [:price] def test_nil_params assert_nil sanitize_for(:default, nil) end def test_block_form result = {} sa...
require "./lib/computer_player" describe 'ComputerPlayer' do let(:computer) {ComputerPlayer.new('computer')} it "should set the computer player's mark to 'X'" do computer.mark.should == 'X' end it "should set the computer player's mark to 'O'" do computer = ComputerPlayer.new('human') computer.ma...
require 'generator_spec' require 'generators/dashing/widget_generator' RSpec.describe Dashing::Generators::WidgetGenerator do arguments %w(test_widget) before do run_generator end after do `find #{Rails.root.join('app')} -name "test_widget.*" -delete` end it 'creates widget files' do assert...
InvalidPickException = Class.new(StandardError) error InvalidPickException do halt 422, { error: 'invalid pick' }.to_json end
class Comment < ApplicationRecord belongs_to :user belongs_to :entry belongs_to :parent, class_name: "Comment", optional: true has_many :replies, class_name: "Comment", foreign_key: :parent_id, dependent: :destroy validates :content, length: {minimum: 1, maximum: 130} scope :root_comment, ->{where(parent_...
require 'rails_helper' RSpec.describe SampleDataMacros do describe '#create_account' do it 'basic' do expect do account = create_account expect(account).to be_a(Account) expect(account.onboarding_state).to eq 'home_airports' expect(account.owner).not_to be_eligible end...
# -*- encoding : utf-8 -*- require 'helper' class DynamicAliasTest < Test::Unit::TestCase context "Dynamic alias" do setup do RedisModelExtension::Database.redis.flushdb @args = { :name => "Foo", :items => { :bar => "test", :foobar => "test2", }, :...
require 'net/http' require 'net/https' require 'json' module MMonit class Connection attr_reader :http, :address, :port, :ssl, :username, :useragent, :proxy_address, :proxy_port, :headers attr_writer :password def initialize(options = {}) @ssl = options[:ssl] || false @address = options[:address] opti...
# frozen_string_literal: true # rubocop:todo all # Copyright (C) 2016-2020 MongoDB Inc. # # 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 # # U...
class AddElapsedSecondsToHauls < ActiveRecord::Migration[5.2] def change add_column :hauls, :elapsed_seconds, :bigint, default: 0, null: false end end
require 'rails_helper' describe 'teams page' do before(:each) do create_user_and_sign_in @team = FactoryGirl.create(:team) @team.users << @user @project = FactoryGirl.create(:project, team_id: @team.id) end it 'displays the team name' do visit team_path(@team) expect(page).to have_conten...
class ApplicationController < ActionController::API include ActionView::Layouts acts_as_token_authentication_handler_for User#, unless: lambda { |controller| controller.request.format.html? } def log(args) Rails.logger.info '*' * 20 Rails.logger.info args Rails.logger.info '*' * 20 end private ...
Gem::Specification.new do |s| s.name = 'secret-keeper' s.version = File.read("./VERSION.md") s.platform = Gem::Platform::RUBY s.summary = 'Keep all your secret files within openssl' s.description = 'A Secret keeper' s.authors = ['Ray Lee'] s.email = 'ray-lee@kdanmobile.com' s...
require 'ruby2d' require_relative 'vector3' set width: 1200 set height: 800 set background: 'white' class AnyShape def initialize(x = nil, y = nil) @x = x || rand(Window.width) @y = y || rand(Window.height) @x_velocity = (1..15).to_a.sample @y_velocity = (1..15).to_a.sample @color = Color.new('r...
class OauthAuthorization < ActiveRecord::Base TimeToLive = 15.minutes belongs_to :user, :foreign_key => :user_uuid belongs_to :oauth_client before_create :generate_code, :generate_expires_at after_create :destroy_all_conflicting_authorizations private def generate_code self.code = ActiveSupport::SecureRan...
class InvitationsController < ApplicationController before_action :set_invitation, only: [:show, :edit, :update, :destroy] # GET /invitations # GET /invitations.json def index @guests = (Invitation.for_user_and_event(User.find_by(auth_token:request.headers['AuthorizationToken'].to_s).id, Event.find_by(id:r...
class Image < ApplicationRecord has_many :genre_images has_many :genres, through: :genre_images has_many :artist_images has_many :artists, through: :artist_images has_many :topic_images has_many :topics, through: :topic_images end
require 'sinatra' get /^\/(.+)\.(adoc|md)$/ do |path, ext| if path !~ /^raw\/.*$/ redirect to("/#{ext}.html?path=/raw/#{path}.#{ext}") elsif not File.exists?("public/raw/#{path}.#{ext}") "File #{path}.#{ext} does not exist!" end end
class TaskListPolicy attr_reader :user, :task_list def initialize(user, task_list) @user = user @task_list = task_list end def owner? user.owner?(task_list) end end
require 'rubygems' require 'rake' def run_sh cmd begin ; sh cmd; rescue; end end def bash cmd sh cmd do |successful, result| if !successful && result.exitstatus === 7 Rake::Task['install'].execute run_sh cmd end end end def wait_for_valid_device while `adb shell echo "ping"`.str...
require File.expand_path("../../../../spec_helper", __FILE__) # Adapted from: # See http://pivotallabs.com/adding-routes-for-tests-specs-with-rails-3/ class Api::V1::InheritsFromBaseController < Api::V1::BaseController def index render :text => "Test" end end describe Api::V1::InheritsFromBaseController, :ty...
# typed: strong module LedgerGen VERSION = "1.0.1" end
require 'date' require 'builder' require 'privatbank/signature' require 'httparty' module Privatbank module P24 class Info include HTTParty base_uri 'https://api.privatbank.ua' def initialize card_number, country, options @card_number = card_number @country = ...
require 'spec_helper' describe "have_sent_email" do include Mail::Matchers let(:test_mail) do mail = Mail.new( :from => 'phil@example.com', :to => ['bob@example.com', 'fred@example.com'], :cc => ['dad@example.com', 'mom@example.com'], :bcc => ['alice@example.com', ...
# Read about factories at https://github.com/thoughtbot/factory_girl FactoryGirl.define do factory :problem do question "Concatenate the strings: 'cow' and 'boy'" answer 'cowboy' solution "'cow' + 'boy'" difficulty_level 1 end end
# encoding: utf-8 require 'sippy_cup/media/rtp_payload' module SippyCup class Media class DTMFPayload < RTPPayload RTP_PAYLOAD_ID = 101 PTIME = 20 # in milliseconds TIMESTAMP_INTERVAL = 160 END_OF_EVENT = 1 << 7 DTMF = %w{0 1 2 3 4 5 6 7 8 9 * # A B C D}.freeze attr_accessor :...
class User < ApplicationRecord # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :validatable, :omniauthable, omniauth_providers: [:google_oauth2] s...
Dir.chdir File.join File.dirname(__FILE__), '../' require 'open3' #Some things need to be re-exported into the JS Interface, e.g. console.error RSpec.describe "JS Functions" do it "console.error writes to stderr" do @err = StringIO.new @out = StringIO.new pipe = Open3.popen3("ruby -Ilib ./bin/boojs") do...
class RedPacket < ApplicationRecord has_many :red_packet_fragments class << self def create_red_packet(user, amount, size) password = 8.times.map { [*'A'..'Z', *'a'..'z', *0..9].sample }.join RedPacket.create( user_id: user.id, amount: amount, size: size, ...
module Metawrapper def self.included(base) base.send(:include, InstanceMethods) base.extend(ClassMethods) end module InstanceMethods def method_missing(method_name, *args, &blk) variable_found = false wrapped_variables.each do |var| if variable_responds_to_method?(var, method_name) variable_f...
module GapIntelligence # @see https://api.gapintelligence.com/api/doc/v1/pricing_images.html module PricingImages # Requests and returns an pricing image # # @param id [String] pricing image public id # @param options [Hash] the options to make the request with # @yield [req] The Faraday request...
require 'fileutils' require 'find' def process(file) puts "Post-processing #{file}" File.open(file) do |input| File.open("#{file}.pp", "w") do |output| input.each_line do |line| yield output, line end end end FileUtils.mv("#{file}.pp", "#{file}") end process("configure") do |out, l...
require "rails_helper" RSpec.describe UserAuthentication, type: :model do describe "Associations" do it { should belong_to(:user) } it { should belong_to(:authenticatable) } end describe "Validations" do describe "#authenticatable uniqueness" do let!(:existing_auth) { create(:user_authenticati...
class RenameLonToLng < ActiveRecord::Migration def up rename_column :tweeted_words, :lon, :lng end def down rename_column :tweeted_words, :lng, :lon end end
# Implement octal to decimal conversion. # Given an octal input string, your program should produce a decimal output. class Octal OCTAL = 8 def initialize(octal_str) @octal_str_arg = octal_str @octal_int_array = octal_str.chars.map(&:to_i) end def invalid_input? return true if @octal_int_array.le...
module SecureArchive module Encryptor class Plain def encrypt_file(source, destination) destination.open('w') do |w| source.open do |r| buf = r.read(1024 * 16) while (buf) do w.write(buf) buf = r.read(1024 * 16) end ...
class AddResponseToTail < ActiveRecord::Migration[5.1] def change add_column :tails, :response, :text end end
class SlaItemsController < ApplicationController before_action :set_sla_item, only: [:show, :edit, :update, :destroy] load_and_authorize_resource # GET /sla_items # GET /sla_items.json def index @sla_items = SlaItem.all end # GET /sla_items/1 # GET /sla_items/1.json def show end # GET /sla...
require_relative '../lib/soter.rb' Mongo::Logger.logger.level = ::Logger::FATAL class FakeLogger def <<(s); (@log ||= '') << s; end def log; @log; end def close; end def reset; @log = ''; end end FakeHandler = Class.new do def initialize(*) end def perform sleep(Random.rand) if Soter.config.fork ...
# Learn more: http://github.com/javan/whenever # Use this file to easily define all of your cron jobs. # # It's helpful, but not entirely necessary to understand cron before proceeding. # http://en.wikipedia.org/wiki/Cron set :output, File.join(Whenever.path, 'log', 'cron.log') require File.expand_path("#{File.dirnam...
FactoryBot.define do factory :medical_appointment do specialty { "MyString" } address { "MyText" } date { "2018-11-18 13:29:15" } professional { "MyString" } type_appointment { "MyString" } note { "MyText" } profile { nil } end end
# Copyright (c) 2006 Stuart Eccles # Released under the MIT License. See the LICENSE file for more details. class CGI #:nodoc: # Add @request.env['RAW_POST_DATA'] for the vegans. module QueryExtension private def read_params(method, content_length) case method when :get re...
# frozen_string_literal: true require 'rails_helper' RSpec.describe TenantsController, type: :controller do let(:current_user) { create(:user) } let(:session) { { user_id: current_user.id } } let(:params) { {} } describe 'POST #create' do subject { post :create, params: params, session: session } co...
require_relative "./spec_helper.rb" describe Logger do subject(:logger) { Logger } let(:klass) { String } let(:action) { :puts } let(:options) { { some: "parameter", any: "thing" } } it "prints to STDERR" do expect { logger.error(klass, action, options) }.to output.to_stderr_from_any_process end ...
require 'spec_helper' feature "Filter books by category", %q{ In order to borrow a book As a good nerd I want to see only the books of a given category} do background do [Category, Book].each(&:delete_all) @categories = %w(Fiction Computers Scary Suspense Comic).map { |c| Category.make!(:name => c) ...
class FormScreen < PM::FormotionScreen title "My Form" def table_data { sections: [{ title: "Register", rows: [{ title: "Email", key: :email, placeholder: "me@mail.com", type: :email, auto_correction: :no, auto_capitalization: ...
require 'docking_station' describe DockingStation do describe '#release_bike' do it 'raises an error if there are no bikes available' do expect { subject.release_bike }.to raise_error('No bikes available') end it 'responds to release bike' do expect(subject).to respond_to(:release_bike) ...
class Admin::OccasionsController < Admin::AdminController before_action :get_occasion, only: [:show, :edit, :update, :destroy] def new @occasion = Occasion.new end def index @occasions = Occasion.all end def show end def edit end def create @occasion = Occasion.new(occasion_params) ...
require "bundler/setup" require "slack-notifier" require "k8s-client" require "concurrent" require 'logger' require 'yaml' require 'mail' require_relative "k8s_client" Mail.defaults do delivery_method :smtp, address: ENV["EMAIL_SMTP_HOST"], port: ENV["EMAIL_SMTP_PORT"], user_name: ENV["EMAIL_SMTP_USERNAME"], passwo...
class Product < ActiveRecord::Base attr_accessible :brief_description, :category_name, :description, :discounts, :list_price, :offer_date, :product_name, :product_price, :quantity, :image, :barcode validates :category_name, presence: true va...
class RotaController < ApplicationController before_action :set_rotum, only: [:show, :edit, :update, :destroy] # GET /rota # GET /rota.json def index @rota = Rotum.all end # GET /rota/1 # GET /rota/1.json def show end # GET /rota/new def new @rotum = Rotum.new end # GET /rota/1/edi...
require 'spec_helper' describe Vertices do let(:vertices) { Vertices.new(origin: [2, 1, 3], dimensions: [3, 4, 5]) } describe '#collection' do it 'shows the collection of vertices' do expect(vertices.collection.length).to eq(8) expect(vertices.collection).to match_array([[2, 1, 3], [2, 1, 8], [2, ...
class Member::ProductsController < ApplicationController def top @products = Product.all.limit(4).order('created_at DESC') end def about end def index @products = Product.where(sale_status: true).page(params[:page]).per(8).order('created_at DESC') end def show @product = Product.find(para...
include DataMagic Given(/^the user is logged in with a single secured card account$/) do DataMagic.load("account_summary.yml") visit LoginPage on(LoginPage) do |page| @logindata = page.data_for(:secured_card_single_account) username = @logindata['username'] password = @logindata['password'] ssoid...
=begin #BombBomb #We make it easy to build relationships using simple videos. OpenAPI spec version: 2.0.831 Generated by: https://github.com/swagger-api/swagger-codegen.git Swagger Codegen version: 2.3.1 =end require "uri" module BombBomb class VideosApi attr_accessor :api_client def initialize(api_cli...
# frozen_string_literal: true # 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:...