text
stringlengths
10
2.61M
include DataMagic DataMagic.load 'disputes.yml' Given(/^I log in with single acct profile$/) do visit(LoginPage) on(LoginPage) do |page| login_data = page.data_for(:dispute_single_disputable_ods) username = login_data['username'] password = login_data['password'] ssoid = login_data['ssoid'] ...
require 'RMagick' include Magick module Paperclip class Colorizer < Processor def initialize file, options = {}, attachment = nil super @file = file @format = "jpg" current_format = File.extname(@file.path) @basename = File.basename(@file.path, current_format) @transform = op...
module Moped module BSON class Binary SUBTYPE_MAP = { generic: "\x00", function: "\x01", old: "\x02", uuid: "\x03", md5: "\x05", user: "\x80" } attr_reader :data, :type def initialize(type, data) @type = type ...
json.array!(@spaces) do |space| json.extract! space, :id, :name, :spacetype, :streetnum, :street, :city, :state, :areacode, :vacancies, :description, :price json.url space_url(space, format: :json) end
module TerraspacePluginScaleway module Logging def logger Terraspace.logger end end end
# Check for restricted tags # TODO: #360 - Fix when tag is normalized class RestrictedTagValidator < ActiveModel::Validator def validate(record) restricted = GalleryConfig.restricted_tags.include?(record.tag_text) admin = record.user&.admin? record.errors.add :tag, (options[:message] || "#{record.tag_text...
class Course < ActiveRecord::Base has_attached_file :cover_pic, default_url: "/images/missing.png" validates_attachment_content_type :cover_pic, content_type: /\Aimage\/.*\z/ def as_json(options) CourseSerializer.new(self).as_json(root: false) end end
require 'dataset' class GpdbTable < Dataset def analyze(account) table_name = '"' + schema.name + '"."' + name + '"'; query_string = "analyze #{table_name}" schema.with_gpdb_connection(account) do |conn| conn.exec_query(query_string) end [] end end
class MovieInterestsController < ApplicationController before_filter :set_movie_interest, only: [:show, :edit, :update, :destroy] load_and_authorize_resource def new @movie_interest = MovieInterest.new @user = User.find(params[:user_id]) @rating = @user.ratings.build @event = Event.new end ...
require_relative 'test_helper' class InvoiceTest < Minitest::Test attr_reader :invoice, :data def setup @data = { :id => 1, :customer_id => 1, :merchant_id => 26, :status => "shipped" } @invoice = Invoice.new(data, self) end def test_it_exists assert invoice end ...
class UserTransactionsController < ApplicationController # before_action :authenticate_user! def index if buyer_signed_in? @transactions = current_buyer.user_transactions.order(updated_at: :desc) elsif broker_signed_in? @broker_transactions = current_broker.broker_stocks.map(&:user_transactions)...
Grape::Batch.configure do |config| config.limit = 10 config.path = '/batch' config.formatter = Grape::Batch::Response config.logger = nil config.session_proc = Proc.new {} end
require "spec_helper" module LabelGen describe FrameIter do context "with blank parameters" do subject(:frames){FrameIter.new({})} it "is not nil" do expect(frames).to_not be_nil end it "has a single frame" do expect(frames.count).to eq 1 end ...
class ChaptersController < ApplicationController respond_to :html, :json def show end def update @chapter = Chapter.find(params[:id]) @story = Story.friendly.find(params[:story_id]) if @chapter.update(chapter_params) redirect_to edit_story_path(@story, page: params[:chapter][:page], last_c...
class CreateVendors < ActiveRecord::Migration def self.up create_table :vendors do |t| t.string :name, :null => false t.integer :status_id # vendor_status -> active, in_active # t.integer :tax_code_id # tax_code # t.integer :owner_user_id # users t.string :note t.integer :cont...
# frozen_string_literal: true # rubocop:todo all require 'spec_helper' describe Mongo::Collection::View::Iterable do let(:selector) do {} end let(:options) do {} end let(:view) do Mongo::Collection::View.new(authorized_collection, selector, options) end before do authorized_collection...
## Code your solution here. def fasten_seatbelt return "Alright foaks. Make sure to fasten your seatbelt!" end def free_to_move_about_the_cabin return "Now it's safe to move about the cabin, if you so desire." end def pennsylvania return "We're flying over pimptastic Pennsylvania!" end def ohio ...
class SimplifyUserTable < ActiveRecord::Migration[5.2] def change remove_column :users, :reset_password_sent_at, :string remove_column :users, :created_at, :datetime remove_column :users, :updated_at, :datetime remove_column :users, :fieldname, :string end end
require 'rubygems' require 'zip/zip' class PackageGenerator attr_reader :root_dir def initialize(root_dir) @root_dir = root_dir end def generate delete_previous copy_files process_code pack_js minify_js compress ensure clean_up end def delete_previous FileUtils....
# == Schema Information # # Table name: game_answers # # id :integer not null, primary key # game_id :integer not null # answer :string(255) not null # created_at :datetime # updated_at :datetime # regex :string(255) # class GameAnswer < ActiveRecord::Base validates_p...
class Organization < ActiveRecord::Base has_many :addresses attr_accessible :title validates_presence_of :title searchable do text :title end end
class Page < ActiveRecord::Base ##### ASSOCIATIONS ##### has_many :items ##### VALIDATIONS ##### scope :visible, where(:visible => true) scope :sort, order('pages.position ASC') end
class MissionariesController < ApplicationController # GET /missionaries # GET /missionaries.json def index @missionaries = Missionary.all respond_to do |format| format.html # index.html.erb format.json { render json: @missionaries } end end # GET /missionaries/1 # GET /missionarie...
class Sale < ActiveRecord::Base # inside the where clause we are actually writing SQL, since its Action Record, it needs two arguments since we use two ?'s #@@active_sale_query = "sales.starts_on <= ? AND sales.ends_on >= ?" # AR Scope - Class Methods (starting with self.), we can reference any methods we make ...
require 'test_helper' class HtmlFormatterTest < Test::Unit::TestCase context "basic operations" do setup do @formatter = Flannel::HtmlFormatter.new end should "return html fragment with format" do assert_equal "<p id='bar'>foo</p>", @formatter.do('foo', :paragraph, "bar") end ...
class Flail class Configuration # for the default handler HTTP_ERRORS = [Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::Protocol...
# Note: In this challenge the Fibonacci sequence is zero-indexed and the first term is 0 def iterative_nth_fibonacci_number(n) return 0 if n == 0 return 1 if n == 1 fibs = [0, 1] until fibs.length == n + 1 fibs << fibs[-1] + fibs[-2] end fibs[n] end def recursive_nth_fibonacci_number(n) return 0 ...
class Course < ApplicationRecord belongs_to :day belongs_to :dish end
#!/usr/bin/env ruby # frozen_string_literal: true def sort_config_file(filename) puts "Sort: #{filename}" org_file = File.read(filename) lines = org_file.lines while (indented_line_idx = lines.index { |l| l =~ /\A(#(?! frozen)|(\s*#)?\s*$)/ }) lines.delete_at(indented_line_idx) end while (indented_li...
require File.join( File.dirname(__FILE__), '..', "spec_helper" ) describe Lecture do before do load_fixtures! Lecture.auto_migrate! @lecture = Lecture.create(:date => DateTime.now, :name => "Programming", :user => @teamon, :faculty => @w4) end it "should be valid" do @lecture.should be_valid ...
Rails.application.routes.draw do resources :posts root 'posts#index' post 'like/:note_id' => 'likes#like', as: 'like' delete 'unlike/:note_id' => 'likes#unlink', as: 'unlink' # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html end
class ChangeColumnToAllowNull < ActiveRecord::Migration[5.2] def up change_column :items, :image_id, :string, null: true, default: nil end def down change_column :items, :image_id, :string, null: false, default: 'no_image' end end
require 'spec_helper' require 'ostruct' describe CSV2API::Server do include Rack::Test::Methods def app CSV2API::Server end describe '/tasks' do it 'returns tasks.csv in json' do get '/tasks' expect(last_response.body).not_to be_empty expect(last_response).to be_ok end end d...
require 'tic_tac_toe_rz/core/player' module TicTacToeRZ module Core module Players class Minimax < TicTacToeRZ::Core::Player def initialize @will_block = false @can_retry = true end def get_move(board) marks = {1 => @my_mark, -1 => @other_mark} ...
module GapIntelligence module Requestable # Makes a request to a specified endpoint # # @param [Symbol] method one of :get, :post, :put, :delete # @param [String] path URL path of request # @param [Hash] options the options to make the request with # @yield [req] The Faraday request # @rai...
require 'spec_helper' module Alf class Predicate describe Predicate, ".coerce" do subject{ Predicate.coerce(arg) } describe "from Predicate" do let(:arg){ Predicate.new(Factory.tautology) } it{ should be(arg) } end describe "from true" do let(:arg){ true } ...
# frozen_string_literal: true module System module ErrorReporting module_function def report_error(exception, logger: Rails.logger, **parameters) logger.error('Exception') { {exception: {class: exception.class, message: (exception.try(:message) || exception.to_s), backtrace: (exception.try(:backtrace)...
class ParallelWithThreads def initialize(enum) @enum = enum end def each(&block) @enum.each(&block) end def map(&block) size = @enum.size results = Array.new(size) each do |item| results << Thread.new { yield(item) } end results end class ThreadPool def initialize(...
class EventInsController < ApplicationController before_action :set_event_in, only: [:show, :edit, :update, :destroy] # GET /event_ins # GET /event_ins.json def index @event_ins = EventIn.all end # GET /event_ins/1 # GET /event_ins/1.json def show end # GET /event_ins/new def new @event...
# frozen_string_literal: true require 'stannum/contracts/array_contract' require 'support/examples/constraint_examples' require 'support/examples/contract_builder_examples' require 'support/examples/contract_examples' RSpec.describe Stannum::Contracts::ArrayContract do include Spec::Support::Examples::ConstraintEx...
configure do CONFIG = YAML::load(File.read('config.yml')).to_hash.each do |k, v| set k, v end end # Class declarations class Unfuddle class Ticket < ActiveResource::Base self.site = "http://#{CONFIG['unfuddle']['subdomain']}.unfuddle.com/api/v1/projects/#{CONFIG['unfuddle']['project_id'].to_s}" se...
require 'nokogiri' require 'open-uri' module Parsers class LiveScoresExtractor class << self def extract(webpage_url) content = [] puts '' puts "Extracting from #{webpage_url}" browser = Watir::Browser.new :chrome, headless: true browser.goto webpage_url sle...
# encoding: UTF-8 # # Méthodes d'extraction des données propres au format # TEXT # class Collecte class Extractor def extract_meta_data collecte.metadata.data.each do |prop, valu| valu != nil || next # Modification de certaines valeurs valu = case prop when :auteurs va...
class AddModulToPermission < ActiveRecord::Migration def change add_column :permissions, :modul, :string end end
require File.join(File.dirname(File.expand_path(__FILE__)), "spec_helper") describe "Sequel Mock Adapter" do specify "should have an adapter method" do db = Sequel.mock db.should be_a_kind_of(Sequel::Mock::Database) db.adapter_scheme.should == :mock end specify "should have constructor accept no arg...
#!/usr/local/bin/macruby # -*- coding: utf-8 -*- require "rubygems" require "mopencl" require "benchmark" opencl = OpenCL.new # When true is set in use_cpu, the program is executed on CPU. opencl.use_cpu = true opencl.program <<EOF __kernel sum(__global float *in, __global float *out, int total) { int i = get_g...
class ApiController < ApplicationController ALLOWED_ORIGN = 'http://www.ahmedfelicettawedding.com' respond_to :json prepend_before_action :return_json skip_before_action :authenticate_user! skip_before_action :verify_authenticity_token before_action :underscore_params! after_action :set_cors_headers ...
require 'rails_helper' RSpec.describe Bill, type: :model do # Validations Tests it { should validate_presence_of(:ext_id) } it { should validate_presence_of(:description) } # Associations Tests it { should belong_to(:user) } end
Node = Struct.new(:word, :definition, :next_node) class LinkedList attr_accessor :head, :last def initialize(first_node = nil) @head = first_node @last = first_node end # Big O time = O(n) def read(index = 99999999999) counter = 0 current_node = @head while index >= counter puts ...
class ProductsController < ApplicationController def index @products = Product.where("active = true") respond_to do |format| format.html format.csv { render text: @products/index.to_csv } end end def create price = product_params[:price] @product = Product.new(product_params) @product.active =...
class RemoveAuthorTableAddAuthorToBook < ActiveRecord::Migration def up drop_table :authors add_column :books, :author, :string remove_column :books, :author_id end def down create_table :authors t.string :first_name t.string :last_name t.timestamps remove_column :books, :...
class RemoveRedundantFromOrders < ActiveRecord::Migration def change remove_column :orders, :payment_type_id_id, :string end end
class CustomersController < ApplicationController def index @customers = Customer.all end def alphabetized @ordered_customers = Customer.order("name") end def missing_email @missing_emails = Customer.where("email IS ''") end end
class CurrencyConverter attr_accessor :dollar, :euro, :number @number = 15 @conversions = {} def initialize(number,from_currency,to_currency) @number = number @from_currency = from_currency @to_currency = to_currency @conversions = {:euro => 0.79,:yen => 108.14,:pound => 0.62,:gold => 0.00082...
class AddPointsToGrades < ActiveRecord::Migration def change add_column :grades, :points, :decimal, precision: 3, scale: 1 # precision: number of digits in the total number (biggest is 10.0); scale: number of digits after dot (from .0 to .9) end end
require "rails_helper" RSpec.describe Api::V4::CallResultTransformer do describe "#from_request" do context "when patient_id is missing in payload" do it "adds a fallback patient_id using the appointment_id if missing" do appointment = create(:appointment) expect(Api::V4::CallResultTransfor...
# encoding: utf-8 require 'spec_helper' describe TTY::Table::Operation::Wrapped, '#wrap' do let(:padding) { TTY::Table::Padder.parse } let(:instance) { described_class.new([], padding) } let(:text) { 'ラドクリフ、マラソン五輪代表に1万m出場にも含み' } subject { instance.wrap(text, width) } context 'without wrapping' do ...
class Demographic < ActiveRecord::Base belongs_to :participant belongs_to :race validates_presence_of :race, :sex, :participant delegate :name, :to => :race, :prefix => true acts_as_reportable :except => ['created_at', 'updated_at'] end
json.metadata do json.total_pages @pagy.pages json.current_page @pagy.page json.per_page @pagy.items json.count @pagy.count end json.book_activity do json.borrower_id @conversation.borrower_id json.borrower_type @conversation.borrower_type json.borrower_name @conversation.borrower.full_name json.lender...
require 'rails_helper' describe QuestionsController, type: :controller do let(:user) { create(:user) } let(:question) { create(:question, user: user) } describe 'GET #index' do let(:questions) { create_list(:question, 12) } before { get :index } it('should populate questions') { expect(assigns(:qu...
class Ingredient < ActiveRecord::Base has_many :foods has_many :recipes, :through => :foods validates :name, :presence => true attr_accessor :value def as_json(options={}) {:value => name} end class << self def names_to_ids(ingredients, to_s = false) where(:name => ingredients).select('i...
class Grid def initialize width, height @width = width @height = height @grid = {} @grid.default = false end def alive_neighbours x, y n = 0 neighbour_coordinates(x, y) { | cx, cy | n = n+1 if alive?(cx, cy) } n end def alive? x, y @grid[{x: x, y: y}] end def a...
require File.join(File.dirname(__FILE__), 'spec_helper') require 'barby/outputter/rmagick_outputter' include Barby class TestBarcode < Barcode def initialize(data) @data = data end def encoding @data end end describe RmagickOutputter do before :each do @barcode = TestBarcode.new('10110011100011...
#This class allows us to create products passed through the admin interface and get information and udpate. CRUD. class ProductsController < ApplicationController respond_to :json acts_as_token_authentication_handler_for User, except: [:index, :show] #This method allows us to create all products from given array...
# frozen_string_literal: true # Contains the version of NdrError. Sourced by the gemspec. module NdrError VERSION = '2.2.1'.freeze end
Rails.application.routes.draw do # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html get "/aboutUs", to: "pages#aboutUs" get "/contact_us", to: "pages#contact_us" get "/main", to: "pages#main" end
class QuestionResource < JSONAPI::Resource attributes :html, :position, :out_of, :objectives, :test_paper has_one :main_question end
# filename: test_initialize.rb require "minitest/autorun" require_relative "../../Word.rb" ## # tests the initialize method class TestInitialize < Minitest::Test # instantiating a new tile group # like an @Before in JUnit4 def setup @newTileGroup = Word.new end # unit tests for the TileG...
class Piece attr_accessor :position attr_reader :color def initialize(color, position, board) @color = color @position = position @board = board end def inspect { color: @color, pos: @position } end def moves raise NotImplementedError.new end def empty? fals...
class Article < ActiveRecord::Base has_many :collections has_many :users, through: :collections end
require_relative "../lib/scraper.rb" require_relative "../lib/student.rb" require 'nokogiri' require 'colorize' class CommandLineInterface INDEX_URL = "http://learn-co-curriculum.github.io/student-scrape-site/" BASE_PROFILE_URL = "http://learn-co-curriculum.github.io/student-scrape-site/profile.html" BASE_URL = ...
class Export::ActivityImplementingOrganisationColumn def initialize(activities_relation:) @activities = valid_activities(activities_relation) end def headers ["Implementing organisations"] end def rows return [] if @activities.empty? @activities.includes(:extending_organisation, :implementi...
class NewStructureChangeContext < BaseContext attr_accessor :audit_report, :measure_selection delegate :measure, :measure_name, to: :measure_selection def available_structure_types measure.structure_types.select do |structure_type| structure_type_definition = ...
class Space class << self attr_accessor :width, :height, :background_color, :things def size [@width, @height] end def size=(value) @width, @height = value end end attr_accessor :width, :height, :background_color, :things def initialize @width, @height = self.class.size ...
# frozen_string_literal: true require 'rails_helper' RSpec.describe 'Visitor signs up', type: :feature do scenario 'with valid email and password' do sign_up_with 'valid@example.com', 'password' expect(page).to have_content('Mon Espace Client') end scenario 'with invalid email' do sign_up_with 'inva...
# -*- mode: ruby -*- # vi: set ft=ruby : Vagrant.configure(2) do |config| config.vm.box = "ubuntu/trusty64" config.vm.network "private_network", ip: "192.168.77.7" config.vm.provision "shell", path: ".bin/bootstrap.sh" config.vm.provision "shell", privileged: false, inline: "curl -s -o- https://raw.githubuse...
namespace :db do desc "Fill database with sample data" task populate: :environment do make_users make_relationships make_posts make_comments end end def make_users User.create!(username: "FinalDevil", email: "anhhung1303@gmail.com", password: "naruto", ...
# frozen_string_literal: true # == Schema Information # # Table name: interviewees # # id :bigint(8) not null, primary key # auth_code :string # created_at :datetime not null # updated_at :datetime not null # user_id :bigint(8) # # Indexes # # index_interviewees_on_user_id (us...
class ApplicationController < ActionController::Base include Pundit protect_from_forgery before_action :configure_sanitized_parameters, if: :devise_controller? before_action :set_locale after_action :verify_authorized, unless: :devise_controller? after_action :track_action # Used to set meta data in h...
numbers = (1..10).to_a def my_select(array) results =[] array.each do |element| results << element if yield(element) end results end puts my_select(numbers) { |n| n.even? }
describe TodoBot::List, type: :model do describe 'relations' do it { is_expected.to belong_to(:chat) } it { is_expected.to belong_to(:user) } it { is_expected.to have_many(:tasks) } end end
# frozen_string_literal: true # This file was generated by the `rspec --init` command. Conventionally, all # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. # The generated `.rspec` file contains `--require spec_helper` which will cause # this file to always be loaded, without a need to expl...
ServieSales::Admin.controllers :servers do get :index do @title = "Servers" @servers = Server.all render 'servers/index' end get :new do @title = pat(:new_title, :model => 'server') @server = Server.new render 'servers/new' end post :create do @server = Server.new(params[:server]...
Rails.application.routes.draw do # The priority is based upon order of creation: first created -> highest priority. # See how all your routes lay out with "rake routes". get "secrets/new" root "application#hello" get "/login" => "sessions#new" post "/login" => "sessions#create" post "/logout" => "session...
def prompt(message) puts "=> #{message}" end def valid_number?(string) string == (string.to_i).to_s end def number?(string) string == (string.to_f).to_s end def english(count) result = case count when 1 "#{count}st" when 2 "#{count}nd" when 3 "#{count}rd" when 4 "#{cou...
class QuotePdfExportMailer < ApplicationMailer def quote_pdf_export(representative_id, user_id, account_ids) @representative = Representative.find(representative_id) @user = User.find(user_id) @account_ids = account_ids @num_accounts = @account_ids.length @zip_file_url = @represen...
describe StateMachines::Machine do before(:each) do klass = Class.new do def self.name @name ||= "Vehicle_#{rand(1_000_000)}" end end @machine = StateMachines::Machine.new(klass, initial: :parked) @machine.event :ignite do transition parked: :idling end end it...
class User < ApplicationRecord # GEM PARANOIA acts_as_paranoid # END GEM PARANOIA #cloudiary photo has_attachment :photo # VALIDATIONS AND ASSOCIATIONS FROM DEVISE GEM # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable and :omniauthable devise :database...
require "rails_helper" describe API::V1::CardsAPI do let(:user) { build :user } let(:card) { build :card, user: user } let(:card_interactor) { instance_spy CardInteractor } let(:card_repository) { instance_spy CardRepository } before do Grape::Endpoint::before_each do |endpoint| allow(endpoint).to...
# Write a program called name.rb that asks the user to type # in their name and then prints out a greeting message with their name included. puts "Please write your name!" name = gets.chomp puts "Hello #{name}, nice to meet you!" # Write a program called age.rb that asks a user # how old they are and then tells them ...
module Components module ProductCard class ProductCardComponent < Middleman::Extension helpers do def product_card(opts) product = opts[:product] concat( link_to("/webshop/#{product.slug}/", class: 'bg-white p-6') do content_tag(:figure, class: 'relativ...
# frozen_string_literal: true if File.exist?("#{File.basename(__dir__)}.gemspec") require 'bundler/gem_tasks' require 'rspec/core/rake_task' RSpec::Core::RakeTask.new(:spec) end require 'rake/version_task' Rake::VersionTask.new require 'rubocop/rake_task' RuboCop::RakeTask.new # -- require 'erb' require 'yam...
class HabitDescription < ActiveRecord::Base default_scope { where(ended_at: nil) } belongs_to :user has_many :habits, dependent: :destroy has_many :habit_logs, dependent: :destroy has_many :users, through: :habit_logs has_many :taggings, as: :taggable has_many :tags, through: :taggings before_validati...
class AddHideButtonsToEvents < ActiveRecord::Migration def change add_column :events, :hide_buttons, :boolean end end
class AiBooksController < ApplicationController before_action :set_ai_book, only: %i[show edit update destroy] # GET /ai_books # GET /ai_books.json def index @ai_books = AiBook.all end # GET /ai_books/1 # GET /ai_books/1.json def show; end # GET /ai_books/new def new @ai_book = AiBook.new...
class Game < ActiveRecord::Base belongs_to :player has_many :pieces, dependent: :destroy after_create :populate_board! belongs_to :white, class_name: 'Player', foreign_key: 'white_player' belongs_to :black, class_name: 'Player', foreign_key: 'black_player' def populate_board! 0.upto(7) do |x| ...
require 'pry' class Ingredient @@all = [] attr_reader :name def initialize(name) @name =name @@all << self end def self.all @@all end def self.most_common_allergen Allergy.all.each_with_object({}) do |allergy, hash| if hash[a...
# frozen_string_literal: true class CargoWagon < Wagon TYPE = :cargo UNIT = 'м3' def initialize(place) super(TYPE, place) end def take_place(amount) @taken_place += amount if free_place >= amount end end
module Alf module Operator::Relational class Wrap < Alf::Operator() include Operator::Relational, Operator::Transform signature do |s| s.argument :attributes, AttrList, [] s.argument :as, AttrName, :wrapped end protected # (see Operator::Transform#_tuple...
require 'rails_helper' describe "merchant discount show page" do before :each do @merchant1 = Merchant.create!(name: 'Knows Hair') @discount_1 = Discount.create!(name: "TENoffTEN", percentage_discount: 10, quantity_threshold: 10, merchant_id: @merchant1.id) @discount_2 = Discount.create!(name: "TWENTYof...