text
stringlengths
10
2.61M
require_relative '../lib/publisher' require_relative '../lib/import_service_client' describe Publisher do let(:client) { instance_double('ImportServiceClient') } let(:publisher) { described_class.new(client) } let(:data1) do { mpan: '1012427125178', date: DateTime.new(2017, 1, 20), data: ...
# Define a method called word_counter that accepts one string argument and returns a number representing how many separate words are in that string. For example: # # word_counter("Hello world") # returns 2 # # word_counter("This is a sentence") # returns 4 # # word_counter("") # returns 0 def word_counter(string) nu...
require_relative '../sliding_piece' require_relative '../stepping_piece' require_relative '../board' require_relative '../errors' class Piece attr_reader :symbol, :color, :opponent_color, :position attr_accessor :board, :moved def self.find_piece(board, piece_class, options) board.each_with_index do |tile...
require 'pry' class String def sentence? self.end_with?(".") end def question? self.end_with?("?") end def exclamation? self.end_with?("!") end def count_sentences #split string into array elements based on whitespaces #check each element to see if it ends with "." "?" "!" #co...
require 'yaml' require 'pry' class TravisYaml def initialize(filepath:) @filepath = filepath @yaml = YAML.load(File.open(filepath)) @build_matrix = generate_matrix(@yaml['env']['matrix']) @ignored_specs = get_ignored_specs(@yaml['env']['global']) end def build_matrix @build_matrix end ...
# # @author Kristian Mandrup # # Single role storage that stores role as an embedded Role instance # module Trole::Storage class EmbedOne < BaseOne # constructor # @param [Symbol] the role subject def initialize api super end # display the role as a list of one symbol # @retur...
class FontLexendDeca < Formula head "https://github.com/ThomasJockin/lexend/raw/master/fonts/ttf/LexendDeca-Regular.ttf" desc "Lexend Deca" homepage "https://github.com/ThomasJockin/lexend" def install (share/"fonts").install "LexendDeca-Regular.ttf" end test do end end
# == Schema Information # # Table name: letters # # id :integer not null, primary key # checked_out_at :datetime # description :text # email :string(255) # name :string(255) # phone :string(255) # created_at :datetime # updated_at :datetime # class Le...
require 'rake' require 'rake/tasklib' require 'saikuro' module Rake # Create a task that will generate the Saikuro complexity report for a project. # See http://saikuro.rubyforge.org/ # # The SaikuroTask will create the following targets: # # [<b>:<em>complexity</em></b>] # Main task for t...
module Shoperb module Theme module Editor module Mounter module Model class Discount < Sequel::Model extend Base::SequelClass include Base::Sequel fields :id, :name, :code, :type, :status, :minimum_order_amount, :target_type, :start_date, :end_date, :amount, :region_specif...
movies = {} choice = " " while (choice != "exit") puts "===================================================" puts "Add - to add a movie" puts "Delete - to delete a movie" puts "Update - to update a movie" puts "Display - to dysplay all movies" puts "Exit - to end the program" puts "=====================...
require 'pry' class Song attr_accessor :name, :artist_name @@all = [] def self.all @@all end def save self.class.all << self end def self.create song = self.new #instantiates a new instance of the Song class song.save #saves the song instance to the @@all class variable by way of the s...
require 'test_helper' describe Work do describe "validations" do it "must have a category to be valid" do foundation = works(:foundation) foundation.category = nil foundation.valid?.must_equal false foundation.category = "book" foundation.valid?.must_equal true end it "mu...
class SoundFileBookmarksController < ApplicationController # GET /sound_file_bookmarks # GET /sound_file_bookmarks.json def index @sound_file_bookmarks = SoundFileBookmark.all respond_to do |format| format.html # index.html.erb format.json { render json: @sound_file_bookmarks } end end ...
class AddRoleToFollows < ActiveRecord::Migration def change add_column :follows, :role, :string end end
=begin #=============================================================================== Title: State Charges Author: Hime Date: Jun 14, 2015 -------------------------------------------------------------------------------- ** Change log Jun 14, 2015 - only reset state counts if state is still applied Mar 22, 20...
require "rails_helper" FactoryBot.factories.map(&:name).each do |factory_name| describe "build('#{factory_name}')" do it "should be valid" do obj = build(factory_name) expect(obj.valid?).to be true end end end
# frozen_string_literal: true module Kafka module Protocol class RequestMessage API_VERSION = 0 def initialize(api_key:, api_version: API_VERSION, correlation_id:, client_id:, request:) @api_key = api_key @api_version = api_version @correlation_id = correlation_id @cl...
class Round < ApplicationRecord belongs_to :course validates_presence_of :date, :course end
# frozen_string_literal: true module ResponseStatus extend ActiveSupport::Concern SUCCESS = 'SUCCESS' FAILED = 'FAILED' end
name 'loganov-collectd' maintainer 'Loganov Industries, LLC' maintainer_email 'devops@loganov.com' license 'All rights reserved' description 'Installs/Configures loganov-collectd' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) version '0.1.2' recipe ...
require "celluloid/io" module Zulu class SubscriptionRequestProcessor include Celluloid::IO include Celluloid::Logger finalizer :shutdown def initialize debug "Request Processor starting up" end def process debug "Looking for a subscription request" request = ...
class RenameColumnsForTimelogs < ActiveRecord::Migration[5.1] def change rename_column :timelogs, :lunchin, :returned rename_column :timelogs, :lunchout, :break end end
module Buzzsaw class Document include Buzzsaw::DSL attr_reader :doc def initialize(source, format: nil) @doc = if format == :html Nokogiri::HTML(source) elsif format == :xml Nokogiri::XML(source) else Nokogiri.parse(source) end end end end
name 'utils' maintainer 'The Authors' maintainer_email 'you@example.com' license 'All Rights Reserved' description 'Installs/Configures php_web_app_server' long_description 'Installs/Configures php_web_app_server' version '0.1.0' chef_version '>= 12.14' if respond_to?(:chef_version)
require 'e2mmap' require 'irb/slex' ## # Lexical analyzer for Ruby source class RDoc::RubyLex ## # Read an input stream character by character. We allow for unlimited # ungetting of characters just read. # # We simplify the implementation greatly by reading the entire input # into a buffer initially, and...
# loads dependencies and provides helpers like expected_json_profile, status_should, etc require 'spec_helper' describe 'ProfileApp' do before :each do flush_tables end it 'should respond to a GET request' do get '/' last_response.should be_ok last_response.body.should match(/Hello/) end it...
puts "BaseMany" # @author Kristian Mandrup # # Base module for Many roles strategies # module Troles module Strategy module BaseMany # # a Many role strategy is included by a role subject (fx a UserAccount class) # a Many role strategy should always include BaseMany # when BaseMany i...
source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } ruby '2.6.5' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 6.0.3', '>= 6.0.3.7' # Use postgresql as the database for Active Record gem 'pg', '>= 0.18', '< 2.0' # Use Puma as the app server ...
class Tutorial def initialize(name, type, difficulty) @name = name @type = type @difficulty = difficulty end def name @name end def type @type end def difficulty @difficulty end def is_harder_than?(tutorial) @tutorial = tutorial difficulties = {:easy => 1, :medium =...
require 'spec_helper' describe "projetos/edit" do before(:each) do @projeto = assign(:projeto, stub_model(Projeto, :nome => "MyString", :descricao => "MyString", :versao => "MyString", :requerimento => nil, :area => nil, :situacao => nil, :reuniao => nil, :desenvol...
class LoansController < ApplicationController before_filter :set_loan, :only => [ :show ] def index render json: Loan.all end def show render json: @loan end private # Removed deprecated Loan.find call def set_loan @loan = Loan.where(id: params[:id]).first render json: 'not_found', s...
class User < ApplicationRecord has_many :friends, dependent: :destroy accepts_nested_attributes_for :friends end
# frozen_string_literal: true require 'spec_helper' RSpec.describe NZWhois::InvalidDomainError do it { is_expected.to be_a StandardError } it { expect(subject.message).to eq 'Only `.nz` domain names supported' } end
class BreadcrumbsController < ApplicationController # GET /breadcrumbs # GET /breadcrumbs.json def index @breadcrumbs = Breadcrumb.all respond_to do |format| format.html # index.html.erb format.json { render json: @breadcrumbs } end end # GET /breadcrumbs/1 # GET /breadcrumbs/1.jso...
json.type @journal.class.name json.description 'A Journal is a blog post for a Profile.' json.journal { json.title { json.description 'Journal title. Required for publishing.' json.type 'String' json.required false json.max_length 80 } json.body { json.description 'Primary Journal co...
class Like < ApplicationRecord include PublicActivity::Common # tracked # tracked owner: ->(controller, model) { controller.current_user } belongs_to :profile belongs_to :user validates :user_id, uniqueness: { scope: :profile_id } end
# frozen_string_literal: true require 'sequel/core' module Task module Migrate Sequel.extension :migration class << self def all Sequel.connect(config) do |db| Sequel::Migrator.run(db, migrations_dir) end end def to(migration_number) Sequel.connect(confi...
require 'test_helper.rb' # For testing ip lookup require 'resolv' Delayed::Worker.delay_jobs = false class UpdatingDomainsTest < ActionDispatch::IntegrationTest setup do @account = Account.create! name: 'Zucks' @domain = @account.domains.create hostname: 'thefacebook.com', ip_address: '0.0.3.3' end t...
class ApiKey include Mongoid::Document include Mongoid::Timestamps before_create :generate_access_token field :access_token, type: String #field :expiration, type: Datetime validates :access_token, presence: true, length: { maximum: 255 }, uniqueness: { case_sensitive: true } belongs_to :u...
require 'spec_helper' describe Susanoo::Admin::DivisionsController do describe "フィルタ" do describe "admin_required" do shared_examples_for "未ログイン時のアクセス制限" do |met, act| it "#{met.upcase} #{act}にアクセスしたとき、ログイン画面が表示されること" do expect(response).to redirect_to(login_susanoo_users_path) en...
class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception before_action :current_user, :get_users def current_user # the user_id is crucial because regular :id won'...
module ZanoxPublisher # Base class to hold the incentive attributes # # @attr [Integer] id The incentiveItem's identifer from Zanox # @attr [String] name The name for the incentive # @attr [Program] program The program to which the inc...
require File.expand_path( '../../spec_helper', __FILE__ ) describe KnifeOrgUtils::SwitchAdd do let :config_name do 'HOST/ORG' end let :mock_dot_chef do '/path/to/chef/files' end let :mock_dest_path do ::File.join( mock_dot_chef, config_name ) end let :mock_dot_chef_files do %w( ...
# frozen_string_literal: true # Generated via # `rails generate hyrax:work Etd` require 'rails_helper' RSpec.describe Hyrax::EtdForm do subject(:form) { described_class.new(pdf, nil, nil) } let(:pdf) { FactoryGirl.build(:etd) } describe '#required_fields' do it 'requires title' do expect(form.re...
class AddColumnsToEmployeePayslips < ActiveRecord::Migration def self.up add_column :employee_payslips, :total_earnings, :string add_column :employee_payslips, :total_deductions, :string end def self.down remove_column :employee_payslips, :total_earnings remove_column :employee_payslips, :total_d...
require 'elasticsearch/model' class User < ActiveRecord::Base include Elasticsearch::Model include Elasticsearch::Model::Callbacks include IndexUpdater extend FriendlyId friendly_id :url # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable and :omniauthable ...
# Filters added to this controller apply to all controllers in the application. # Likewise, all the methods added will be available for all controllers. class ApplicationController < ActionController::Base helper :all # include all helpers, all the time protect_from_forgery # See ActionController::RequestForgeryPr...
require "stsplatform/version" require 'net/http' require 'json' module STSPlatform # Main handler of the library. Defines successors in the chain of responsibility # and in our case handles the REST requests to the STS Platform. class RequestHandler attr_accessor :url, :_successor, :resource, :auth def...
Rails.application.routes.draw do devise_for :users, controllers: { registrations: "registrations" } root to: 'home#index' get '/nearby', to: 'home#nearby' get '/edit_store', to: 'shops#edit_store' get '/manage_store', to: 'shops#manage_store' put '/update_current', to: 'shops#update_current' resources :u...
# This code is written after 'Wrapping an existing method' section of # http://www.redmine.org/wiki/redmine/Plugin_Internals require_dependency 'custom_fields_helper' module BlogNewsCustomFieldsPatch def self.included(base) base.send(:include, InstanceMethods) base.class_eval do alias_metho...
module Jsonapi class UsersController < Jsonapi::ResourceController before_action :authenticate_request def index if params['me'] render json: serialize(@current_user), status: :ok if @current_user == context[:current_user] else super end end private def seriali...
class CreateModels < ActiveRecord::Migration def change create_table :models do |t| t.string :name, null: false t.string :phone, null: false t.string :email, null: false t.string :cargo_type, null: false t.string :container_type, null: false t.integer :cargo_weight, null: false...
module Backbone module Generators module ResourceHelpers def backbone_path "app/assets/javascripts/backbone" end def model_namespace [application_name.capitalize, "Models", class_name].join(".") end def collection_namespace [application_na...
class LaborRequestsController < ApplicationController include PersonnelRequestController private def model_klass LaborRequest end alias allowed_defaults allowed def allowed allowed_defaults + %i[ contractor_name number_of_positions hourly_rate hours_per_we...
require "spec_helper" describe Concern::Callbacks::SetPublishedAtCallback do subject { build :test_class_story } #----------------- describe "#should_set_published_at_to_now?" do it "is true if the object is published but doesn't have a published_at date" do subject.status = ContentBase::STATUS_LIVE ...
module Concerns module AuthenticateAuthorize extend ActiveSupport::Concern included do before_action :authenticate_user!, :if => :restricted_methods? authorize_resource :only => [:show, :create, :new, :store, :update, :destroy], :if => :restricted_resource? # Allow other actions done by anyone, or call au...
require 'rails_helper' feature 'member manages groups' do let!(:member) { FactoryGirl.create(:member) } let!(:member2) do FactoryGirl.create( :member, first_name: 'Todd', last_name: 'Wahnish', email: 'todd@rubythursday.com' ) end scenario 'by creating a new group' do login_...
# frozen_string_literal: true require 'spec_helper' describe "when loading bolt for CLI invocation" do context 'and calling help' do def cli_loaded_features cli_loader = File.join(__dir__, '..', 'fixtures', 'scripts', 'bolt_cli_loader.rb') `bundle exec ruby #{cli_loader}`.split("\n") end le...
require 'test_helper' class QueriesControllerTest < ActionDispatch::IntegrationTest setup do @query = queries(:one) end test "should get index" do get queries_url assert_response :success end test "should get new" do get new_query_url assert_response :success end test "should creat...
class OrderItem < ApplicationRecord belongs_to :order belongs_to :item enum make_status: {着手不可:0, 製作待ち:1, 製作中:2, 製作完了:3} def order_status_auto_update if self.make_status == "製作中" self.order.update(buy_status: "製作中") end end def make_complete_auto_update order_items = self.order.order...
class Api::V1::<%= controller_name %> < Api::V1::ApiController before_action :set_<%= underscore_name %>, only: %i[show update destroy] def index @<%= plural_underscore_name %> = current_context.<%= plural_underscore_name %> end def show end def update if @<%= underscore_name %>.update(<%= unders...
module Map::ApplicationHelper SHARING_URLS = { mail: 'mailto:?subject={title}&body={url}', facebook: 'https://www.facebook.com/sharer.php?u={url}', twitter: 'https://twitter.com/intent/tweet?url={url}&text={title}', linkedin: 'https://www.linkedin.com/shareArticle?url={url}&title={title}&summary={tex...
require 'rails_helper' describe Permalink do before do @permalink = Permalink.new(:url => "123") end subject { @permalink } it { should respond_to :url } it { should respond_to :linkable } context "validations" do describe "URL must be present" do before { @permalink.url = "" } it {...
class Payment < ActiveRecord::Base belongs_to :account has_many :invoice_payments has_many :invoices, :through => :invoice_payments end
require "sqlite3" require "hemp/orm/database_error" require "hemp/orm/property" require "hemp/orm/sql_helper" require "hemp/orm/record_interface" require "hemp/orm/class_instance_vars" module Hemp class BaseRecord < Hemp::Orm::RecordInterface include Hemp::Orm::ClassInstanceVars def initialize(hash_arg = {}...
class UserToIssueConnection < ActiveRecord::Base belongs_to :user belongs_to :issue end
require 'spec_helper' describe Checkout do describe '#initialize' do let(:checkout) { Checkout.new } it { checkout.items.count.should eq(0) } it { checkout.total.should eq(0) } it { checkout.promotional_rules.count.should eq(0) } end describe '#scan' do let(:checkout) { Checkout.new } ...
# 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 rake db:seed (or created alongside the db with db:setup). # # Examples: # # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # Mayor.create(name: 'Emanuel...
class Item < ActiveRecord::Base has_many :images, :dependent => :destroy belongs_to :user scope :owner, ->(user) { where(user_id: user.id) } def main_image if self.images.empty? Item::Image.new.file else self.images.first.file end end end
# 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...
require 'spec_helper' describe PdfTempura::Render::Debug::Grid do let(:pdf) { Prawn::Document.new } describe "render" do it "takes a pdf document as a param" do subject.render(pdf) end end end
require 'rails_helper' RSpec.describe "corrections/edit", type: :view do before(:each) do @correction = assign(:correction, Correction.create!()) end it "renders the edit correction form" do render assert_select "form[action=?][method=?]", correction_path(@correction), "post" do end end end
class Section < ApplicationRecord acts_as_paranoid validates_as_paranoid has_paper_trail has_many :products validates :description, presence: true validates :name, length: { maximum: 140 }, presence: true scope :by_id, ->(id) { where(id: id) } end # == Schema Information # # Table name: sections # # ...
class User < ActiveRecord::Base has_many :bookmarks has_many :likes, dependent: :destroy has_many :topics # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :tra...
require 'rake' require 'yard' require 'rubocop/rake_task' task :default => [:rubocop] desc 'Generate documentation for the daylite_models plugin.' YARD::Rake::YardocTask.new do |t| t.files = ['README.markdown', 'lib/**/*.rb'] t.options = ['--any', '--extra', '--opts'] t.stats_options = ['--list-undoc'] end R...
# Find a way to remove all words from an array that have more than 5 letters. input = ['tiger', 'eagle', 'hippopotamus', 'zebra', 'alligator'] print input.select{|word| word.length <= 5}
require 'rails_helper' RSpec.describe "author", type: :model do it "should have first name, last name and homepage" do author = Author.new(first_name:'Alan', last_name:'Turing', homepage:'http://wikipedia.org/Alan_Turing') expect(author.first_name).to eq('Alan') expect(author.last_name).to eq('Turing') ...
class BitmapEditor # attr_accessible :title, :body attr_reader :commands, :bitmap, :file_path DEFAULT_BLOCK_COLOR = 'O'.freeze COMMAND_DELIMITER = ' '.freeze SUPPORTED_COMMANDS = %w(I C L V H S).freeze MAX_PIXEL =250 MIN_PIXEL=1 error_log = File.open("error_log.txt", "w") def initialize(file_path) ...
## # RHQ specific helper methods class RHQ_util require 'JSON' require 'rest_client' ## # Fetches raw metric data from the RHQ server +base_url+ is the base url of the # rest api of the RHQ server. +schedule_id+ denotes the numeric id of the metric # to fetch. +name+ is only used for diagnostic printing ...
class Apartment < ActiveRecord::Base validates :name, presence: true has_many :blocks def no_of_flats self.blocks.includes(:floors).map{|b| b.floors.includes(:flats).map{|f| f.flats.count}}.flatten.sum end end
class AdminsController < ApplicationController layout 'application' before_filter :check_administrator_role def index @html_title = "Admin - " end end
class FootballsController < ApplicationController before_action :set_football, only: [:show, :edit] def index @footballs = Football.page params[:page] respond_with(@footballs) end def show respond_with(@football) end private def set_football @football = Football.find(params[:id]) ...
class Address < ActiveRecord::Base belongs_to :country belongs_to :user accepts_nested_attributes_for :country, :allow_destroy => true TYPES = %w( BillingAddress ShippingAddress ) before_save :set_address_type validates :type, presence: true, :inclusion => { :in => TYPES } #validates :address, :zip_cod...
require 'native' module WebAssembly class CantLoadSyncError < StandardError; end class Module < `WebAssembly.Module` def self.new(buffer) buffer = buffer.to_n unless native? buffer %x{ try { return new WebAssembly.Module(#{buffer}); } catch(e) { if (e.name == "R...
# A subscription is only inactive when you want to soft-delete the subscription class Subscription < ActiveRecord::Base include TransactionAccountable belongs_to :user belongs_to :order_item belongs_to :subscription_plan belongs_to :shipping_address, :class_name => 'Address' belongs_to :billing_addre...
arr = [[1, 6, 7], [1, 4, 9], [1, 8, 3]] # return a new array containing the same sub-arrays as original # BUT ordered logically by only taking into consideration the odd numbers # Solution: # # [[1, 8, 3], [1, 6, 7], [1, 4, 9]] b = arr.sort_by do |sub| sub.select do |value| value.odd? end end p b
class AddPredictedToPrediction < ActiveRecord::Migration def change add_column :predictions, :predicted, :boolean end end
require 'spec_helper' describe Stormpath::Resource::AccountStoreMapping, :vcr do def create_account_store_mapping(application, account_store, options={}) test_api_client.account_store_mappings.create({ application: application, account_store: account_store, list_index: options[:list_index] || ...
# encoding: UTF-8 # frozen_string_literal: true require 'spec_helper' describe 'tags' do before(:each) do @site1 = Factory(:site) end describe 'Viewing the list of posts with tags' do before(:each) do @post_in_bestoff = Factory(:post_in_bestoff, title: 'post X', site: @site1) @post_not_in_be...
And /^I try to sign up$/ do click_link "SIGN UP" end Then /^I am on the sign up page$/ do page.current_path.should eql new_contestant_registration_path end When /^I enter my details and submit$/ do %w{first_name last_name public_name email phone password}.each do |field| fill_in "contestant[#{field...
class Message < ActiveRecord::Base belongs_to :user belongs_to :actor, class_name: "User", foreign_key: "actor_id" scope :unread, -> { where(read: false) } validates_presence_of :body after_create do if user.blank? or user.push_opened_for?(self.message_type.to_i) PushService.publish(self...
# -*- encoding : utf-8 -*- class Applicant < ActiveRecord::Base has_many :job_applications, order: 'priority', dependent: :destroy, conditions: { withdrawn: false } has_many :jobs, through: :job_applications has_many :password_recoveries has_many :log_entries attr_accessor :password, :password_confirmation,...
class Gram < ActiveRecord::Base validates :message, presence: true belongs_to :user end
class PlayerProfile < ActiveRecord::Base belongs_to :user validates :user_id, presence: true validates :ranking, presence: true validates :wins, presence: true validates :losses, presence: true end
require 'rails_helper' require_relative '../../support/devise' RSpec.describe "Api::Smtps", type: :request do describe "POST /test" do login_admin it "doesn't authenticate with invalid credentials" do smtp = build(:smtp) post api_smtp_test_path, params: { smtp: smtp.as_json } response_bo...
class FontDoulosSil < Formula version "6.101" sha256 "daea5cc79767c43029b025603402ccb51c7812a22772db3c18ae8526ef670c58" url "https://software.sil.org/downloads/r/doulos/DoulosSIL-#{version}.zip" desc "Doulos SIL" desc "Unicode-based font family supporting languages using Latin and Cyrillic scripts" homepage...
module Candidate class Convocation < ActiveRecord::Base enum :convocation_type => ['regularização', 'habitação'] validates_presence_of :description, :criterion, :start, :end, :quantity, :convocation_type validates_date :start, before: :end end end
describe Submission do it "can save a valid submission" do FactoryGirl.create :submission expect(Submission.count).to eq 1 end it "cannot save a submission with too many points" do FactoryGirl.create :week submission = FactoryGirl.build(:submission, points: Week.first.max_points + 1) submiss...
# You and K−1K−1 friends want to buy NN flowers. Each flower fifi has some cost cici. The florist is greedy and wants to maximize his number of new customers, so he increases the sale price of flowers for repeat customers; more precisely, if a customer has already purchased xx flowers, price PP for fifi is Pfi=(x+1)×ci...