text
stringlengths
10
2.61M
class CreateProjects < ActiveRecord::Migration def change create_table :projects do |t| t.string :name t.string :client_name t.string :client_email t.string :bdm_name t.timestamp :start_date t.timestamp :end_date t.decimal :project_cost, precision: 12, scale: 2 t.st...
class FontAlumniSansPinstripe < Formula head "https://github.com/google/fonts.git", verified: "github.com/google/fonts", branch: "main", only_path: "ofl/alumnisanspinstripe" desc "Alumni Sans Pinstripe" homepage "https://fonts.google.com/specimen/Alumni+Sans+Pinstripe" def install (share/"fonts").install "A...
require 'test_helper' class TransactionsControllerTest < ActionController::TestCase setup do Stripe.api_key = 'sk_fake_test_key' end test 'should post create' do token = 'tok_123456' email = 'foo@example.com' product = Product.create( permalink: 'test_product', price: 100 ) Stripe:...
class LikesController < ApplicationController before_action :set_like, only: [:show, :update, :destroy] # GET /likes def index @likes = Like.all render json: @likes end # GET /likes/1 def show render json: @like end # POST /likes def create @like = Like.new(user_discount_id: params...
require 'spec_helper' # upon new() of a User, do the following validations describe User do # do this before execution of this parent do block # if no values are passed for name or email, then it will throw an # exception before do @user = User.new(name: "Example User", email: "user@example.com",...
class UserNotifierMailer < ApplicationMailer default :from => 'noreply@rentmycar.com' def signup_email(user) @user = user mail(to: @user.email, subject: 'Rent my car - Signup confirmation') end end
class Image attr_accessor :image def initialize(array) @image = array end def output_image @image.each do |row| row.each do |column| print column, ' ' end puts "\n" end end #|x1 - x2| + |y1 - y2| def manhattan_distance(x1, y1, x2, y2) (x1 - x2).abs + (y1 - y2).abs end ...
include Rails.application.routes.url_helpers class Documentations::IndexSerializer < ApplicationSerializer object_as :documentation identifier :slug attributes( :id, :slug, :title, :body, :documentable_type, :documentable_id, :created_at, :updated_at, ) type :string def r...
Given /^I have no cheese$/ do puts "I am so sad. I have no cheese :(" end When /^I press the make cheese button$/ do puts "There is hope. I hope this machine works" end Then /^I should have (\d+) piece of cheese$/ do |num_pieces| puts "Rejoice! We have #{'num_pieces'} pieces of cheese." end Given(/^I am on...
require "spec_helper" describe UserMailer do let(:user2) {FactoryGirl.create(:user, password_reset_token: "anything")} let(:user) {FactoryGirl.create(:user, email_token: "fakdg48934")} let(:mail) {UserMailer.password_reset(user2)} let(:mail2) {UserMailer.registration_confirmation(user)} it "should send an e...
module Api class ApiController < ApplicationController skip_before_action :verify_authenticity_token before_action :set_locale # before_action :restrict_access_token protect_from_forgery with: :null_session before_action :extract_authentication_from_header, if: -> {request.headers['Authorization'...
# encoding: utf-8 require 'spec_helper' describe IdUnico do describe "#novo" do it 'cria id randomico até não ter repetido na pasta de imagens temporarias' do id_randomico = mock(:id_randomico) id_randomico.stub(:novo).and_return( "imagem", "imagem2", "outro_id" ) FileUtils.touch(...
class Expense < ActiveRecord::Base belongs_to :user belongs_to :category belongs_to :periodic_expense has_one :receipt validates :description, :user, :amount, :paid_on, :category, presence: true validates :paid_on, date: { before_or_equal_to: proc { Date.today } } validates_associated :receipt def for...
class Show attr_reader :title @@all = [] def initialize(title) @title = title @@all << self end def self.all @@all end def on_the_big_screen match = Movie.all.find { |movie| movie.title == self.title } if match != nil true else false end end end
require "rails_helper" feature "Add new Word" do given!(:user) { create :user_example_com } scenario "user can add his own words" do sign_in_as "user@example.com" visit words_path click_link "+ Add" within "#new_word" do select "Neuter", from: "word_gender" fill_in "word_content", wit...
class QuestionsController < ApplicationController def new @property = Property.find(params[:property]) @question = Question.new end def create @property = Property.find(params[:property_id]) @question = @property.questions.create(question_params) @question.user_id = current_user.id @ques...
class Province < ActiveRecord::Base belongs_to :area has_many :locations validates_presence_of :name validates_uniqueness_of :name # searchable do # text :name # end end
#!/usr/bin/env jruby =begin rdoc DRb-based server to provide access to a JRuby process. (c) Copyright 2016 Thoughtgang <http://www.thoughtgang.org> This file defines the API of the DRb service exposed by the JRuby process. Modules loaded at runtime add operations to this base class. Each operation defines a single ...
class String # return translation value of locale # if locale is nil, it will use I18n.locale # Usage # The default value if translation is not provided is all text # # $ WpPost.post_title # $ => "<!--:en-->And this is how the Universe ended.<!--:--><!--:fr-->Et c'est ainsi que l'univers connu cessa d'...
module Oshpark class Import def self.attrs %w| id state original_url original_filename error_message queued_at started_at completed_at errored_at failed_at project_id | end STATES = %w| WAITING RUNNING SUCCESS ERROR FAILED | include Model include RemoteModel include Stateful def s...
class Row attr_accessor :player, :houses def initialize(houses, player) self.houses = houses self.player = player end # initial call to start moving pieces def apply(position) remaining = houses[position] # get the number of pieces self.houses[position] = 0 # empty out the house (positio...
class User < ActiveRecord::Base # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable has_many :tasks def tasks Task.where(:user_id => self.id, :...
class CasesController < InheritedResources::Base respond_to :html, :json, :xml def index @cases = Case.paginate(page: params[:page]) end private def signed_in_user unless signed_in? store_location #redirect_to signin_url, notice: "Please sign in." flash[:notic...
require 'rails_helper' describe Background do it 'has an image', :vcr do background = Background.new('nowheresville,or') expect(background).to be_a Background expect(background.search_term).to eq 'nowheresville,or' expect(background.image_url).to eq 'https://unsplash.com/photos/6BVinN0Y7Xk' end ...
# frozen_string_literal: true require "spec_helper" describe LiteCable::Server::SubscribersMap do let(:socket) { spy("socket") } let(:socket2) { spy("socket2") } let(:coder) { LiteCable::Coders::JSON } subject { described_class.new } describe "#add_subscriber" do it "adds one socket" do subject....
require 'test_helper' require 'hyperclient' describe Hyperclient do describe 'new' do it 'creates a new EntryPoint with the url' do Hyperclient::EntryPoint.expects(:new).with('http://api.example.org') Hyperclient.new('http://api.example.org') end end end
require 'facilities_management/services_and_questions' FactoryBot.define do factory :facilities_management_procurement_building_service, class: FacilitiesManagement::ProcurementBuildingService do name { Faker::Name.unique.name } code { 'C.1' } service_standard { 'A' } end factory :facilities_manageme...
class AddDefaultprojectToUsers < ActiveRecord::Migration def change add_column :users, :default_project_id, :integer end end
class Resource < ActiveRecord::Base attr_accessible :description, :meta_dump, :name, :type, :url has_and_belongs_to_many :ingredients def ingredient_csv ingredients.map{|i| i.name}.join(", ") end def set_ingredients_from_csv!(csv) names = csv.split(",").map{|i| i.strip} ingredients = names.map{...
# From the loaded word list this class can generate new phrases to guess and also turn # these into patterns for players to see the format of the phrase without giving away the phrase class PhraseGenerator # Generates a phrase containing specified number of words in the form "this/is/a/phrase" (words separated by fo...
class CheesesController < ApplicationController before_action :authenticate_user!, only: [:new, :edit, :destroy] def index cheeses = Cheese.all.page params[:page] render locals: { cheeses: cheeses } end def show if Cheese.exists?(params[:id]) cheese = Cheese.find(params[:id]) render lo...
require 'spec_helper' describe 'users/registrations/edit' do include_context 'devise view' before do render end it "has title" do rendered.should have_selector('h1', :text => 'Account Settings') end it "has change password form" do rendered.should have_xpath("//form[@method='post' and @actio...
class BusinessController < ApplicationController before_action :authenticate_user! before_action :pro_user, except: [:show] before_action :prepare_params, only: [:activate, :update_settings] def business @scopes = %w(my all recent problem) unless @scopes.include? params[:type] params[:type] = 'al...
require( 'minitest/autorun' ) require('minitest/reporters') Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new require_relative( '../guest' ) class TestGuest < MiniTest::Test # A guest should have a name, value of cash in their wallet # And a favourite song def setup @guest1 = Guest...
require 'rails_helper' describe CheckoutController, type: :controller do let(:user) { create :user } before do sign_in user end describe 'GET #show' do context 'not able to perform' do let(:order) { create :order, :with_items, user: user } before do allow(controller).to receive...
module ApplicationHelper def paginate_info(paginated) "显示 #{start = (paginated.current_page - 1) * paginated.limit_value + 1} - #{start + paginated.count - 1} 条,共 #{paginated.total_count} 条" end # 是否当前路径 def current_nav_controller(controllers = [], options = {}) # byebug controllers.include?(contr...
# -*- mode: ruby -*- # vi: set ft=ruby : HOST_IP="10.10.3.10" HOST_NAME="dohko-lab" def install_plugins (plugins=[], restart=false) installed = false plugins.each do |plugin| unless Vagrant.has_plugin? plugin system ("vagrant plugin install #{plugin}") puts "Plugin #{plugin} installed!" in...
module ShopRequestsHelper def can_assign_shop_to_shop_request?(shop_request) shop_request.assigned? && current_user == shop_request.salesperson end end
class TwilioController < ApplicationController skip_before_action :verify_authenticity_token def voice response = Twilio::TwiML::Response.new do |r| r.Say "Yay! You're on Rails!", voice: "alice" r.Sms "Well done building your first Twilio on Rails 5 app!" r.Play "http://linode.rabasa.com/cant...
def verify_mail_settings_screen_is_showing check_element_exists( "navigationItemView marked:'Settings'" ) check_element_exists "view view:'UILabel' marked:'Mail Settings'" end def verify_mail_composer_screen_is_showing # Note: Since IOS 6 it is no longer possible to inspect the # sub-views within the MFM...
require 'test_helper' class IncomesControllerTest < ActionController::TestCase # test "the truth" do # assert true # end def setup @income = incomes(:first) end test "should redirect create when not logged in" do assert_no_difference 'Income.count' do post :create, income: { title: "First Ti...
### # Compass ### # Change Compass configuration # compass_config do |config| # config.output_style = :compact # end ### # Page options, layouts, aliases and proxies ### # Per-page layout changes: # # With no layout # page "/path/to/file.html", :layout => false # # With alternative layout # page "/path/to/file.htm...
require_relative '../cfhighlander.model.component' require_relative '../cfhighlander.error' require_relative './debug.util' require 'duplicate' module Cfhighlander module Util class CloudFormation def self.flattenCloudformation(args = {}) component = args.fetch(:component) template = co...
module Thomas class Thomas QUIT_CHAR = 'q' PAUSE_CHAR = 'p' attr_accessor :canvas, :output_buffer, :log_file def initialize(width, height, options={}) @canvas = Canvas.new(width, height) @input_stream = ThomasStream.new @output_buffer = options.key?(:output_buffer) ? options[:outpu...
module Authorization #The current user can't access the current page. def unauthorized! redirect "/login", 303 end #Is the current user logged in? def logged_in? session['logged_in'] #false end #Method called from the login controller to authenticate the user def authorize(username, p...
# encoding: utf-8 module AmazonJobs class Home include PageObject div(:search_area, class: 'row nopadding location-search-bar') text_field(:search_type) { search_area_element.text_field_element(id: 'search_typeahead') } text_field(:search_location) { search_area_element.text_field_element(id: 'locat...
module Komixin::Models module Comic TITLE_MIN_LENGTH = 4 TITLE_MAX_LENGTH = 100 DESC_MAX_LENGTH = 10000 def self.included(base) base.instance_eval do paginates_per 10 has_attached_file :image, :url => "/images/komiksy/:author_id/:id.jpg" acts_as_taggable acts_as...
# Public: Suppresses Rails logs and exception reporting from automated scan # requests. # # Use it by replacing the default Rails::Rack::Logger in config/application.rb: # # config.middleware.swap Rails::Rack::Logger, ScanSuppressingLogger::Middleware, { # networks: ['123.0.2.2/24', '86.54.222.1/16'], # } module Scan...
# frozen_string_literal: true module Api::V1::User::Tokens CreateSchema = Dry::Validation.Params(BaseSchema) do optional(:email).filled.when(:filled?) do value(:password).filled? end optional(:password).filled optional(:token).filled rule(email_or_token: %i[email token]) do |email, token| ...
desc "Execute a sub-task in a rackstash log scope" task :with_rackstash, [:task] do |t, args| Rake::Task[:environment].invoke if Rake::Task[:environment] Rackstash.tags |= ["rake", "rake::#{args[:task]}"] Rackstash.with_log_buffer do Rake::Task[args[:task]].invoke end end
# frozen_string_literal: true require 'saml/auth_fail_handler' require 'sentry_logging' class SSOService include SentryLogging include ActiveModel::Validations attr_reader :auth_error_code DEFAULT_ERROR_MESSAGE = 'Default generic identity provider error' AUTH_ERRORS = { 'Subject did not consent to attribute...
class FontKaiseiOpti < Formula head "https://github.com/google/fonts.git", verified: "github.com/google/fonts", branch: "main", only_path: "ofl/kaiseiopti" desc "Kaisei Opti" desc "Modern style japanese typeface" homepage "https://fonts.google.com/specimen/Kaisei+Opti" def install (share/"fonts").install ...
class AddCodeIdToLineItems < ActiveRecord::Migration[5.0] def change add_reference :line_items, :code, foreign_key: true, index: true add_reference :line_items, :font, foreign_key: true, index: true add_reference :line_items, :course, foreign_key: true, index: true add_reference :line_items, :t3d, for...
require 'pg' require 'dotenv/load' class Database def initialize @db = PG.connect( host: ENV['DB_HOST'], port: ENV['DB_PORT'], user: ENV['DB_USERNAME'], password: ENV['DB_PASSWORD'], dbname: ENV['DB_NAME'] ) end def write(shoping_list) value = shoping_...
#!/usr/bin/env ruby require 'yaml' require File.join(File.dirname(__FILE__), '../lib/librato/metrics/taps') include Librato::Metrics def err(msg) $stderr.puts msg exit 1 end def get_beans(bean_name) beans = Taps::JMX::match_beans(bean_name) unless beans && beans.length > 0 err "No beans match: #{bean_na...
class DropServices < ActiveRecord::Migration[6.0] def change drop_table :services end end
require 'rails_helper' describe Review do it { should belong_to :place } it { should belong_to :user } it { should validate_presence_of :place } it { should validate_presence_of :user } it { should validate_presence_of :rating } it { should validate_numericality_of :rating } it { should validate_inclusi...
SwipeSense::Application.routes.draw do root :to => 'root#index' get '/share' => 'root#share' namespace :admin do get '/email_test/:action', :controller => 'email_test' end # Engines mount RailsAdmin::Engine => '/admin', :as => :rails_admin devise_for :users devise_for :hubs, :skip => [:sessions...
ActiveAdmin.register QuotationComment do menu parent: "Quotations" permit_params :quotation_id, :sender_id, :body, :attachment filter :quotation filter :sender filter :created_at index do selectable_column id_column column :quotation column :sender column :body do |quotation_com...
class ItemsController < ApplicationController include RiotApi before_action :load_item def description costs = @item.costs args = { name: @item.name, description: @item.sanitizedDescription, total_cost: costs['total'], sell_cost: costs['sell'] } render json: { speec...
# app/controllers/results_controller.rb class ResultsController < ApplicationController before_action :set_attempt, :verify_results, only: :show # GET /scenarios/:scenario_id/results/:attempt_id def show respond_to do |format| format.html format.json { json_response(@attempt, :ok) } end end...
require "spec_helper" require "appointment" describe Operation do describe "#anatomy" do it "delegates to case's anatomy" do p_case = build(:patient_case, :anatomy => "knee") operation = Operation.new(:patient_case => p_case) operation.anatomy.should == "knee" end end describe "#buil...
Vagrant.require_version ">= 2.0.0" Vagrant.configure(2) do |config| config.ssh.insert_key = false config.vm.define "node1" do |node1| node1.vm.box = "centos/7" node1.vm.hostname = "node1" end config.vm.provision "setup", type:"ansible" do |ansible| ansible.verbose = "v" ansible.playbook = ...
require 'puppet' Puppet::Type.type(:glusterfs_vol).provide(:glusterfs) do commands :glusterfs => 'gluster' defaultfor :feature => :posix def create opts = ['volume', 'create', resource[:name]] if resource[:stripe] then opts << "stripe" opts << resource[:stripe] end if resource[...
#mac_battery_charging.rb Facter.add(:mac_battery_charging) do confine :kernel => "Darwin" setcode do Facter::Util::Resolution.exec("/usr/sbin/ioreg -r -c 'AppleSmartBattery' | /usr/bin/grep -w 'IsCharging' | /usr/bin/awk '{print $3}'") end end
cask :v1 => 'weka' do version '3.6.11' sha256 '51643edc349f46d76b96460ab16b97cf8e2d63ae6a4f6e5ba4c89dd404b56cea' url "http://downloads.sourceforge.net/sourceforge/weka/weka-#{version.gsub('.','-')}-oracle-jvm.dmg" homepage 'http://www.cs.waikato.ac.nz/ml/weka/' license :oss app 'weka-3-6-11-oracle-jvm.app...
# frozen_string_literal: true require 'spec_helper' class Bugsnag # mock Bugsnag end RSpec.describe UniformNotifier::BugsnagNotifier do let(:notification_data) { {} } let(:report) { double('Bugsnag::Report') } before do allow(report).to receive(:severity=) allow(report).to receive(:add_tab) allow...
class Pearl < ApplicationRecord belongs_to :user belongs_to :game validates :quote, presence: true end
class Task < ActiveRecord::Base STATES = [:new, :in_progress, :solved] belongs_to :exercise belongs_to :sentence, counter_cache: true belongs_to :user before_create :initialize_solution validates :exercise, presence: true scope :started, lambda { where.not(state: 0) } def initialize_solution te...
# Non-Leetcode Additional Practice # A string with the characters [,],{,},(,) is said to be well-formed if # the different types of brackets match in the correct order. # For example, ([]){()} is well-formed, but [(]{)} is not. # Write a function to test whether a string is well-formed. def check_brackets(string) s...
require 'byebug' class Array def my_uniq unique = [] self.each do |el| unique << el unless unique.include?(el) end p unique unique end def two_sums pairs = [] self.each_with_index do |num1, i| self[i+1..-1].each_with_index do |num2, j| pairs << [i, j + i + 1] if ...
name 'allegrograph' maintainer 'Dmitriy Krantsberg' maintainer_email 'dkrantsber@gannett.com' license 'All rights reserved' description 'Installs/Configures AllegroGraph' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) version '0.1.1'
Rails.application.routes.draw do resources :sessions, only: [:create] resources :users resources :messages, only: [:destroy] resources :channels, only: [:show, :index] do resources :messages, only: [:create] end get "/autologin", to: "sessions#autologin" # For details on the DSL available within this ...
class FontNotoSansVai < Formula head "https://noto-website-2.storage.googleapis.com/pkgs/NotoSansVai-unhinted.zip", verified: "noto-website-2.storage.googleapis.com/" desc "Noto Sans Vai" homepage "https://www.google.com/get/noto/#sans-vaii" def install (share/"fonts").install "NotoSansVai-Regular.ttf" en...
class ApplicationController < ActionController::Base before_action :configure_permitted_parameters, if: :devise_controller? #private # override the devise helper to store the current location so we can # redirect to it after loggin in or out. This override makes signing in # and signing up work automa...
interface = node[:cybera_consul][:dnsmasq][:interface] template "/etc/network/interfaces.d/#{interface}.cfg" do source 'interface.cfg.erb' notifies :run, 'execute[restart_interface]', :delayed end execute 'restart_interface' do command "ifdown #{interface}; ifup #{interface}" action :nothing end package 'dns...
require_relative "../db/config" require_relative "seeds" require "benchmark" require "benchmark/memory" require "benchmark/ips" class Post < ActiveRecord::Base has_many :comments has_many :sorted_comments, -> { order(:id) }, class_name: "Comment" has_one :latest_comment, -> { Comment.latest_comments_for_posts },...
class Message include Mongoid::Document extend Mongoid::Geo::Near # Relation belongs_to :user, class_name: 'User', inverse_of: :messages has_and_belongs_to_many :received_users, class_name: 'User', invese_of: :messages # Field field :user_id, :type => Integer field :from_user_id, :type => Integer f...
# frozen_string_literal: true require 'pry' def word_counter(sentence, dictionnary) occurence_hash = {} dictionnary.each_with_index do |dic_word, index| num_of_occurence = 0 sentence.split.each do |word| if word.downcase.include? dic_word num_of_occurence += 1 end occurence_hash....
require_relative '../helpers/subset_logic' class OEIS def self.a116416(n) inverse_sum = Subset.one_indexed(n).inject(0) do |accum, i| accum + Rational(1)/Rational(i) end inverse_sum.numerator end end
Rails.application.routes.draw do devise_for :users root to: 'pages#home' resources :plans do resources :orders, only: [:new, :create] end end
# From https://itshouldbeuseful.wordpress.com/2010/11/10/find-your-slowest-running-cucumber-features/ scenario_times = {} Around do |scenario, block| name = if scenario.respond_to?(:feature) # Cucumber < 4 "#{scenario.feature.file}::#{scenario.name}" else "#{scenario.location.file}:#{...
class PhonesController < ApplicationController include CurrentCart before_action :set_cart def new @phone = Phone.new end def create @phone = Phone.new(phone_params) respond_to do |format| if @phone.save UserMailer.phone_admin_confirmation(@phone).deliver AdminMailer.phone...
class InscriptionsController < ApplicationController before_action :find_tournament, only: [:create] before_action :set_inscription, only: [:show] def create @inscription = Inscription.new @inscription.team = Team.find(params["team-id"]) @inscription.tournament = @tournament @inscription.tourname...
class GroupCategoriesController < ApplicationController # GET /group_categories # GET /group_categories.xml helper_method :sort_column, :sort_direction def index @group_categories = GroupCategory.find(:all, :order=>"order_by") respond_to do |format| format.html # index.html.erb format.xm...
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup). # # Examples: # # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) # Ch...
class Message < ActiveRecord::Base attr_accessible :body, :title, :user_id belongs_to :user validates :title, presence: true, length: { minimum: 3 } validates :body, presence: true validates :user, presence: true end
# SQL COMMANDS # Create tables as outlined in articles-schema.png. def sql_create_tables <<-SQL PRAGMA foreign_keys=on; -- Create table only if named table does NOT exist. CREATE TABLE IF NOT EXISTS Authors ( author_id INTEGER PRIMARY KEY, first_name VARCHAR(255), last_name VARCHA...
require 'data_mapper' unless defined?DataMapper require 'ysd_md_comparison' unless defined?Conditions::Comparison require 'ysd-md-business_events' unless defined?BusinessEvents::BusinessEvent require 'ysd-plugins' unless defined?Plugins::ApplicableModelAspect require 'ysd_md_variable' require 'ysd_dm_finder' require 'y...
require 'argon2' class User < ActiveRecord::Base has_many :snaps has_many :posts has_many :photos, :through => :posts, :source => :content, :source_type => 'Photo' has_many :blogs, :through => :posts, :source => :content, :source_type => 'Blog' has_many :reviews, :through => :posts, :source => :content, :sou...
# # Copyright (c) 2018 joshua stein <jcs@jcs.org> # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DIS...
class PropertyImage < ApplicationRecord include Swagger::Blocks swagger_schema :property_image do property :id do key :type, :integer key :format, :int64 end property :image_url do key :type, :string end property :property_id do key :type, :integer end end belon...
require 'spec_helper' describe ProjectsController, :type => :routing do describe 'routing' do describe 'routes to #index,' do context 'when using url,' do subject{ { get:'/projects' } } it{ is_expected.to be_routable } it{ is_expected.to route_to(controller: 'projects', action: 'in...
class AddIsRemovedFromMentorNotes < ActiveRecord::Migration def change add_column :mentor_notes, :is_removed, :boolean, :default=>false end end
class RecipesController < ApplicationController def index @search = params[:search] @from = (params[:from]) ? params[:from].to_i : 0 @previous_from = @from - 10 @from += 10 if params[:search] @recipes = RecipeApiWrapper.search(params[:search], @from) if @recipes.nil? flash[:...
# # Cookbook :: ambari # Attribute :: default # Copyright 2018, Bloomberg Finance L.P. # # 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 # # Unles...
# frozen_string_literal: true require 'spec_helper_acceptance' describe 'Registry Management' do before(:all) do # use this unique keyname and keypath for all tests @keyname = "PuppetLabsTest_#{random_string(8)}" end let(:arch_prefix) { (host_inventory['facter']['architecture'] == 'x64') ? '32:' : '' }...
# WORKING! namespace :scraper do desc "Scrape a Top 25 List of technical q's from GeeksforGeeks at http://www.geeksforgeeks.org/top-25-interview-questions/" task geeksforgeeks: :environment do require 'nokogiri' require 'open-uri' # 1. Go to URL # NOTE THAT SOME OF THESE PROBLEMS WILL REQUIRE DA...
class AddSupplierCodeToTuan < ActiveRecord::Migration def self.up add_column :tuans, :supplier_code,:string,:limit=>12 end def self.down remove_column :tuans,:supplier_code end end
Vagrant.configure(2) do |config| config.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'" config.vm.box = "ubuntu/trusty64" config.vm.synced_folder ".", "/vagrant" config.vm.provision :shell, path: "provision/install.sh" config.vm.provider "virtualbox" do |v| v.memory = 1024 v.cpus = 2 end ...