text
stringlengths
10
2.61M
require "helper" describe Bridge::Points::Duplicate do it "maximum points with unique values" do maximum = Bridge::Points::Duplicate.new(-200, -100, 620, 630, 660, 690).maximum assert_equal 10, maximum[690] assert_equal 8, maximum[660] assert_equal 6, maximum[630] assert_equal 4, maximum[620] ...
def source <<eos protocol MyAwesomeProtocol { func foo(i:Bool)->String func bar(k:String)->Int func baz(w:Int)->Bool } eos end def expected_tokens [ T_PROTOCOL, T_WHITESPACES(' '), T_IDENTIFIER('MyAwesomeProtocol'), T_WHITESPACES(' '), T_OPEN_CURLY_BRACKET, T_WHITESPACES("\n "), ...
=begin doctest: hash_string_to_pairs(string) separates a string with a key/value pair into separate strings >> key = ':id' >> value = rand(10).to_i.to_s >> test_string = "#{key}=#{value}" >> arr = hash_string_to_pairs( test_string ) >> arr == [key, value] => true =end def hash_string_to_pairs( hash_string ) k...
class TasksController < ApplicationController def index @task = Task.new @tasks = Task.all end def create @task = Task.new(params[:task]) if @task.save redirect_to :back, :notice => "New task added successfully" else redirect_to :back, :notice => "Task cannot be empty!" end end def edit ...
class Api::V1::SusuInvitesController < Api::V1::BaseController before_action :set_susu_invite, only: [:show, :update, :destroy] def_param_group :susu_invite do param :susu_invite, Hash, required: true, action_aware: true do param :accepted, [true, false], required: true, allow_nil: false param :s...
module JrubyMahout java_package 'org.apache.mahout.cf.taste.recommender' class CustomRescorer include org.apache.mahout.cf.taste.recommender.IDRescorer def initialize(is_filtered_block, re_score_block) @is_filtered_block = is_filtered_block @re_score_block = re_score_block end def ...
class RootController < ActionController::Base def root render file: 'public/index.html' end end
Polycloud::Application.routes.draw do root 'welcome#index' scope module: 'api' do api_version(1) do scope module: 'users' do resources :users, controller: 'main', only: [:show, :create] resources :sessions, only: :create end scope module: 'snippets' do resources :sni...
Rails.application.routes.draw do get '/login', to: 'sessions#new' post '/login', to: 'sessions#create' delete '/logout', to: 'sessions#destroy' namespace :admin do resources :users end root 'home#new' resources :books, except: [:destroy] resources :cards do resources :books, only: [:index, :sh...
Gem::Specification.new do |s| s.name = 'cartodb-utils' s.version = '0.0.10' s.date = '2015-04-20' s.summary = "Ruby CartoDB utils" s.description = "Ruby CartoDB utils" s.authors = ["Luis Bosque"] s.email = 'luisico@gmail.com' s.files = [ "lib/car...
$LOAD_PATH.unshift(".") require 'env' require 'shopify' require 'sqlite3' require 'ostruct' def main find_series.each do |series| upload_series(series) end end def db @db ||= SQLite3::Database.new("wfth.db") end def shop @shop ||= ShopifyAPI::Shop.current end def upload_series(series) series_product ...
class SearchSubscriptionItem include Mongoid::Document include Mongoid::Timestamps field :raw_plane_id field :search_subscription_id field :content field :item_type field :sent_at end
class SessionsController < ApplicationController def authenticate_user auth_hash = request.env['omniauth.auth'] unless auth_hash.present? redirect_to request.env['omniauth.origin'] || root_path, status: 301, alert: "Sorry, we were not able to authenticate you using your ...
require 'sqlite3' require_relative 'questions' class Reply attr_accessor :id, :subject_question_id, :parent_reply_id, :user_id, :body def self.find_by_id(id) reply = QuestionsDatabase.instance.execute(<<-SQL, id) SELECT * FROM replies WHERE id = ? SQL return n...
require 'rubocop/git' require 'optparse' module RuboCop module Git class CLI def run(args = ARGV) @options = Options.new parse_arguments(args) Runner.new.run(@options) end private def parse_arguments(args) @options.commits = option_parser.parse(args) ...
class Section < ActiveRecord::Base belongs_to :state belongs_to :area belongs_to :subarea belongs_to :crag has_many :faces has_many :walls has_many :climbs end
# -*- encoding: utf-8 -*- $:.push File.expand_path('../lib', __FILE__) require 'shrink/version' Gem::Specification.new do |s| s.name = 'shrink' s.version = Shrink::VERSION s.authors = ['Jacob Gillespie'] s.email = 'me@jacobwg.com' s.homepage = 'https://github.com/jacobwg/shrink' s.s...
require "aethyr/core/actions/commands/command_action" module Aethyr module Core module Actions module Unwield class UnwieldCommand < Aethyr::Extend::CommandAction def initialize(actor, **data) super(actor, **data) end def action event = @data ...
class Doccex::Base attr_accessor :path_prefix def path_to_tmp path_prefix.nil? ? 'tmp' : "tmp/#{path_prefix}" end def tmp_file Rails.application.root.join("#{path_to_tmp}/tmp_file.docx") end def zip_package(dir) FileUtils.cd(dir) do system "zip -qr #{tmp_file} . -x \*.DS_Store \*.git/\...
module Engine module Map class Layer attr_reader :index, :layer def initialize(layer, options) @index = layer.properties["index"] @layer = layer @options = options end def draw(x, y, tilesets) draw_tiles(x, y, tilesets) end def screen_width_i...
require 'set' module OAuth2Provider class AccessValidator attr_accessor :driver, :request, :scope def initialize(request, driver) @request, @driver = request, driver end def halt klass, *args line = caller.first driver.logger.fatal(klass){ line } throw CATCH_SYMBOL, klass.ne...
require "rubygems" require "selenium-webdriver" require "rspec" require "library" describe "Prime Credit Card Transactions" do before(:all) do Configuration.config_path = File.dirname(__FILE__) + "/../../config/config.yml" @config = Configuration.new end before(:each) do Browser.type = @config.browser['bro...
Vagrant.configure("2") do |config| config.vm.define "w10" do |m| m.vm.provider "virtualbox" do |v| v.name = "swarm_w10" v.linked_clone = true end m.vm.box = "centos/7" m.vm.network "private_network", virtualbox__intnet: "swarm", nic_type: "virtio" m.vm.provision "shell", ...
require 'tempfile' require 'spec_helper' describe CsvImporter, :database_integration => true do describe "actually performing the import" do before do any_instance_of(CsvImporter) { |importer| stub(importer).destination_dataset { datasets(:table) } } end after do schema.with_gpdb_connection...
# frozen_string_literal: true class Ability include CanCan::Ability def initialize(user) can :manage, Recipe, user_id: user.id end end
# encoding: utf-8 module ApplicationHelper def controller?(*names) names.include?(params[:controller]) end def link_to_player_result(player, selected_player, stage = nil) if player == selected_player badge, text = ' badge-success', 'Getoond' else badge, text = '', 'Bekijk' end i...
class Lesson < ApplicationRecord has_many :reviews has_many :users, through: :reviews has_many :ratings, through: :reviews has_many :tags, through: :reviews validates :name, presence: { scope: true, message: "must be entered" } validates :description, presence: { scope: true, message: "must be entered" } ...
module Disbursements class Processor def initialize(merchant:, start_date:, end_date:) @merchant = merchant @start_date = start_date @end_date = end_date end def call merchant.orders.completed_in(start_date, end_date).find_in_batches(batch_size: 50) do |orders| orders.each...
module MessageCenter class MailDispatcher attr_reader :mailable, :recipients def initialize(mailable, recipients) @mailable, @recipients = mailable, Array.wrap(recipients) end def call return false unless MessageCenter.uses_emails if MessageCenter.mailer_wants_array send_e...
require "application_system_test_case" class ShoesTest < ApplicationSystemTestCase setup do @shoe = shoes(:one) end test "visiting the index" do visit shoes_url assert_selector "h1", text: "Shoes" end test "creating a Shoe" do visit shoes_url click_on "New Shoe" fill_in "Brand", wi...
cities = { "toronto" => '416', "waterloo" => '519', 'ottawa' => '613', 'ajax' => '905', 'huntsville' => '705', 'vancouver' => '604', 'montreal' => '514', "calgary" => '403', 'halifax' => '782', 'quebec city' => '418' } def get_city_names(cities) cities.keys end def get_area...
class TipCalc attr_accessor :amount, :tip, :num_people def initialize(amount, tip, num_people) @amount = amount.to_f @tip = tip.to_f @num_people = num_people.to_f end def tip_amount return amount * (tip/100) end def final_with_tip return amount + amount * (tip/100) end def per_person ...
class AddPickupTimeAndTravellerNumberToPurchases < ActiveRecord::Migration def change add_column Purchase, :pickup_time, :datetime add_column Purchase, :traveller_number, :integer end end
Dotenv.load module Twirloc class GoogleLocation attr_reader :api_key, :coords, :conn def initialize(opts) @api_key = opts[:api_key] || ENV["GOOGLE_GEO_KEY"] @coords = stringify(opts[:coords]) end def to_s results = response["results"] formatted_addresses = results.collect { ...
# Euler's Totient function, φ(n) [sometimes called the phi function], is used to determine the number of # numbers less than n which are relatively prime to n. # For example, as 1, 2, 4, 5, 7, and 8, are all less than nine and relatively prime to nine, φ(9)=6. # It can be seen that n=6 produces a maximum n/wφ(n) for...
require 'rails_helper' RSpec.describe 'Posts', type: :request do before do @user = FactoryBot.create(:user) sign_in @user @post = FactoryBot.create(:post, image: fixture_file_upload('public/images/test_image.png')) end describe "GET #top" do it "topアクションにリクエストすると正常にレスポンスが返ってくる" do get top...
# -*- coding: utf-8 -*- # frozen_string_literal: true require "rails_helper" describe CensusActionAuthorizer do subject { described_class.new(authorization, options, nil, nil).authorize } let(:user) { create(:user, nickname: 'authorizing_user') } let(:authorization) {} let(:options) { {} } context "when th...
class CreateGames < ActiveRecord::Migration def change create_table(:games) do |t| t.integer :user_id t.datetime :current_time t.integer :location_id t.string :home_name t.timestamps end end end
module Middleman module Smusher class << self def registered(app, options={}) require "smusher" # options[:service] ||= "SmushIt" options[:quiet] = true app.after_configuration do smush_dir = if options.has_key?(:path) options.delete(:p...
class AttendeeDatum < ActiveRecord::Base attr_accessible :attendee_id, :sub_item_id, :answer belongs_to :attendee validates :attendee_id, presence: true validates :sub_item_id, presence: true end
module Enginery class Generator include Helpers attr_reader :boot_file, :dst_root, :setups def initialize dst_root, setups @dst_root, @setups = dst_root, setups end def generate_project name name = name.to_s if name.empty? name = '.' else name =~ /\....
class Domain def initialize(request, domains_file = nil) @host = request.host @domains_file = domains_file end def key domain['key'] end def host @host end private def domain @domain ||= find_domain end def find_domain domain_key_value = domains.detect { |_key, domai...
class CreateEntityCostCenterDetails < ActiveRecord::Migration def change create_table :entity_cost_center_details do |t| t.integer :cost_center_detail_id t.integer :entity_id t.integer :participation t.timestamps end end end
require "rails_helper" RSpec.describe "GET /api/standards" do context "with valid type and name" do it "returns the standard document" do standard = create(:standard, :with_document, code: "ISO 19115") stub_relaton_document(standard.code, standard.year) get_api api_standard_path( code:...
module TwoFactorSettingsHelper def qr_code_as_svg(uri) RQRCode::QRCode.new(uri).as_svg( offset: 0, use_path: true, color: "000", shape_rendering: "crispEdges", module_size: 4, standalone: true ).html_safe end end
# frozen_string_literal: true # rubocop:todo all # Copyright (C) 2019-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...
module Sapphire # So far we aren't differentiating between a token and an ATOM. Some tokens become SEXPs class Token attr_accessor :type, :string, :pos, :line, :file, :parent_id def ini...
# creates Orders table class CreateOrders < ActiveRecord::Migration[5.0] def change create_join_table :products, :users, table_name: :orders do |t| t.integer :quantity, null: false t.boolean :is_completed t.text :delivery_address t.index :product_id t.index :user_id t.ti...
class Pdfjob < ActiveRecord::Base #include Reportable # class << self # def reporter_class # #DamperInspectionReporter # #PdfGenerationReporter # PdfjobReporter # end # end # def full_report_path # File.join(pdf_path, 'inspection_report.pdf') # end # private # def pdf_pat...
require 'rails_helper' RSpec.describe 'AccountActivationsController', type: :request do let(:user) { create :user } describe 'POST/sessions' do subject { post login_path, params: { session: { email: user.email, password: user.password }}} context 'when account is not activated' do it 'redirect ...
require_relative 'line_items' require_relative 'receipt' require_relative 'logging' class Register attr_reader :total attr_reader :line_items def initialize @line_items = LineItems.new end def total @line_items.total end def add(product_code) Logging.log.info("adding #{product_code} to lin...
class Glider def lift puts "Rising" end def bank puts "Turning" end end class Nomad def initialize(glider) @glider = glider end =begin def do(action) if action == 'lift' @glider.lift elsif action == 'bank' @glider.bank else raise NoMethodError.new(action) e...
module ApplicationHelper def edit_and_destroy_buttons(item) if signed_in? edit = link_to('edit', url_for([:edit, item]), class: "btn") del = link_to('Destroy', item, method: :delete, data: {confirm: 'Are you sure?'}, class: "btn btn-danger") raw("#{edit} #{del}") end en...
class Answer < ActiveRecord::Base # Remember to create a migration! belongs_to :answerer, class_name: "User", foreign_key: :user_id belongs_to :question has_many :comments, as: :commentable has_many :votes, as: :votable validates :description, :user_id, :question_id, presence: true def points vo...
class PhotoSerializer < ActiveModel::Serializer attributes :id, :description, :filename, :date_taken, :aws_filename, :original_url, :grid_url, :huge_url, :large_url, :thumbnail_url, :upload_user_id, :upload_user_email, :created_at has_one :upload_user end
#!/usr/bin/env ruby # require 'optparse' require 'fileutils' @options = { :cluster => nil, :az => nil, :ca => { :key => 'ca.key', :key_bits => 4096, :config => 'ca.conf', :validity_days => 999999, :cert => 'ca.crt', }, :certs => { :key_bits => 2048, :key => 'sidecar-injector.key',...
require 'rails_helper' RSpec.describe Ranking, type: :model do it "has valid factory" do expect(FactoryGirl.create(:ranking)).to be_valid end it "able to find current ladderboard" do expect(Ranking.ladder.length).to be > 0 end end
module TagMutations MUTATION_TARGET = 'tag'.freeze PARENTS = [ 'source', 'project_media', 'team', { tag_text_object: TagTextType }, ].freeze module SharedCreateAndUpdateFields extend ActiveSupport::Concern include Mutations::Inclusions::AnnotationBehaviors end class Create < Mutat...
class AddProductProvider < ActiveRecord::Migration[6.0] def change create_table :product_providers do |t| t.references :external_entity, index: true, null: false t.references :product, index: true, null: false t.string :brand t.decimal :price, precision: 10, scale: 3 t.decimal :disco...
require_relative "piece.rb" require_relative "rook.rb" require_relative "knight.rb" require_relative "bishop.rb" require_relative "queen.rb" require_relative "king.rb" require_relative "pawn.rb" require_relative "null.rb" require_relative "stepable.rb" require_relative "slideable.rb" class Board attr_reader :rows ...
class AddColumnsToEvents < ActiveRecord::Migration[5.1] def change add_column :events, :commentor, :boolean add_column :events, :phone, :boolean add_column :events, :email, :boolean add_column :events, :comment_type, :string end end
class Person < ActiveRecord::Base scope :search_with_like, ->(query) { where("name like '%#{query}%'") } scope :search_with_paragraph_like, ->(query) { joins(:paragraphs).merge(Paragraph.search_with_like(query)) } scope :search_with_index, ->(query) { where("to_tsvector('english', name) @@...
# -*- mode: ruby -*- # vi: set ft=ruby : # All Vagrant configuration is done below. The "2" in Vagrant.configure # configures the configuration version (we support older styles for # backwards compatibility). Please don't change it unless you know what # you're doing. Vagrant.configure("2") do |config| # The most co...
require 'minitest/spec' require 'minitest/autorun' require 'external_media' describe ExternalMedia do it "must add has_external_media method" do class Foo include ExternalMedia end Foo.methods.must_include :has_external_media end it "has_external_media adds external_media attribute" do c...
require_relative './post' require_relative './post_decorator' class BlogIndex def initialize(max_per_page = 10, current_page = 0) @posts = [] @max_per_page = max_per_page @current_page = current_page end def load(index_file) collection = YAML.load_file(index_file) collection.each do |post_d...
class CreateRinventors < ActiveRecord::Migration def change create_table :rinventors do |t| t.date :update_date t.integer :rproductid t.decimal :starting_amount t.decimal :added_amount t.decimal :threshold t.decimal :sold_amount t.decimal :actual_amount t.decimal :t...
abort('Please run this using `bundle exec rake`') unless ENV["BUNDLE_BIN_PATH"] require 'html-proofer' require 'rszr' task :default => ["test"] task :test => [:spellcheck, :htmlproofer] do puts "Tests complete." end task :resize240 do sh "mkdir -p assets/images/articles/240" files = FileList['assets/images/art...
class SocialMediaPostsController < ApplicationController before_action :set_social_media_post, only: [:show, :update, :destroy] # GET /social_media_posts def index if (params.has_key?(:topic_id)) @social_media_posts = SocialMediaPost.where(topic_id: params[:topic_id]) else @social_media_posts...
class CreatePapers < ActiveRecord::Migration def change create_table :papers do |t| t.float :paper_height t.float :paper_width t.string :chain_lines t.string :format t.string :name t.text :result t.timestamps null: false end end end
require 'rails_helper' describe "find many merchants with params" do context "search using valid params" do before :each do @merchant1, @merchant2, @merchant3 = create_list(:merchant, 3) end it "can find an merchant with id params" do get '/api/v1/merchants/find_all', params: {id: @merchant1....
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: :null_session, :if => Proc.new { |c| c.request.format == 'application/json' && c.request.fullpath.match(/^api/)} acts_as_token_au...
require File.dirname(__FILE__) + '/../../spec_helper.rb' include Rugalytics describe Profile do describe "being initialized" do it "should accept :name as key" do profile = Profile.new(:name => 'test', :profile_id => '12341234') profile.name.should == 'test' end it "should accept :account_id...
class LendersController < ApplicationController def show @lender = Lender.find(params[:id]) @borrowers = Borrower.all @transactions = History.includes(:borrower).where(lender_id: session[:user_id]) end def create @lender = Lender.new(lender_params) if @lender.save session[:user_id] = @lender.id ses...
def what_was_that_one_with(those_actors) # Find the movies starring all `those_actors` (an array of actor names). # Show each movie's title and id. #Movie.select(:title, :id).joins(:actors).group('movies.id').having('actors.name = (?)', those_actors) end def golden_age # Find the decade with the highest avera...
module ManageIQ module PostgresHaAdmin VERSION = '3.1.2'.freeze end end
class EntriesController < ApplicationController before_filter :find_collection def new @entry = @collection.entries.build end def create @entry = @collection.entries.build(params[:entry]) if @entry.save @entry.collection.update_number! flash[:notice] = "Total updated." redirect...
Rails.application.routes.draw do # Application root root 'main#index' # Path for leaving messages post '/leave_message' => 'main#leave_message' # Main dasboard index get 'main_webapp/index' get 'dashboard' => 'main_webapp#dashboard' get 'evangelio' => 'main_webapp#evangelio' get 'staff' => 'main...
require 'open-uri' require 'addressable/uri' class FeedsController < ApplicationController def index group = params[:group] || 'dev' recent_days = 10.days if group == 'all' feeds = Rails.configuration.feeds.inject([]) do |array, e| array + e.second end else feeds = Rails.c...
require 'spec_helper' describe Navigation do before do config.reset config.path ='spec/fixtures/nav' end describe '#initialize' do let(:nav) { Navigation.new docroot } it "sets an array of links" do expect(nav.links).to be_an Array end it "sets proper link properties for folder...
require 'artoo/robot' class KeyboardRobot < Artoo::Robot # artoo setup connection :keyboard, adaptor: :keyboard device :keyboard, driver: :keyboard, connection: :keyboard work do on keyboard, :key => :keypress end # class attr_accessor :handlers def initialize @handlers = {} super end def add_handl...
class AddResubmittedToApprovalState < ActiveRecord::Migration def change add_column :approval_states, :resubmitted, :integer, :default => 0 end end
class OppsNoCustomers < ActiveRecord::Migration def change add_column :employee_job_orders, :company_id, :integer remove_column :employee_job_orders, :customer_id end end
class RemoveUnnecessaryTagFields < ActiveRecord::Migration def change remove_column :tags, :abstract_id remove_column :tags, :abstract_tag_id end end
class StreamUser < ActiveRecord::Base belongs_to :stream_message belongs_to :user validates_presence_of :stream_message_id, :user_id validates_uniqueness_of :stream_message_id, :scope => [:user_id, :source] scope :followed, where(:source => 'followed') scope :owned, where(:source => 'owned') end
json.url store_product_url(p) json.name p.name json.description p.description json.qty p.qty json.price p.price json.created_at p.created_at json.updated_at p.updated_at
require_relative '../config' class ChangeActiveType < ActiveRecord::Migration def change change_column :politician_infos, :active?, :integer end end
module Mahjong class Board include ActiveModel::Model include ActiveModel::Serialization attr_accessor :seats, :wall, :wind, :round_number, :bonus_count delegate :east?, :south?, :west?, :north?, to: :wind end end
require 'spec_helper' feature "Gmail" do let!(:alice) { FactoryGirl.create(:user) } let!(:me) { FactoryGirl.create(:user, email: "no-reply@willinteractive.com") } let!(:project) { FactoryGirl.create(:project) } let!(:issue) { FactoryGirl.create(:issue, project: project, user: me) } before do ActionMa...
class Santa attr_reader :ethnicity, :age attr_accessor :gender, :reindeer_ranking def initialize(attrs)#I wanted to try instanciation with a hash since I've already done it with a string @gender = attrs[:gender] @name = attrs[:name] @ethnicity = attrs[:ethnicity] @age = 0 @reindeer_ranking = ["Rudolph",...
require 'test_helper' class RLanguagesControllerTest < ActionController::TestCase setup do @r_language = r_languages(:one) end test "should get index" do get :index assert_response :success assert_not_nil assigns(:r_languages) end test "should get new" do get :new assert_response :s...
module MeetupSync class Venue attr_accessor :name, :latitude, :longitude, :address, :city, :country def initialize(name, latitude, longitude, address, city, country) self.name = name self.latitude = latitude...
require 'singleton' module Ginatra # A singleton class that lets us make and use a constantly updating # list of repositories. class RepoList include Logger include Singleton attr_accessor :list # This creates the list, then does the first refresh to # populate it. # # It returns wha...
class Like < ActiveRecord::Base belongs_to :user belongs_to :idea validates_uniqueness_of :user_id, scope: :idea_id end
class ProductsController < ApplicationController before_action :authenticate_user!, except: :show before_action :only_admin, only: :index before_action :load_category, except: [:index, :show, :destroy] before_action :load_product, except: [:index, :new, :create] before_action :allow_destroy, only: :destroy ...
#!/usr/bin/env ruby # # ruby-aws-microservice # # ./main.rb -h (for usage) # # Author: Cody Tubbs (codytubbs@gmail.com) 2017-05-07 # https://github.com/codytubbs # ############################################################################ # Ruby Syntax attempts to follows strict Ruby Style Guidelines # ruboco...
class RemoveStateFromSipAccount < ActiveRecord::Migration def up remove_column :sip_accounts, :state end def down add_column :sip_accounts, :state, :string end end
class Certificate < ApplicationRecord belongs_to :user validates :name, presence: true, length: {maximum: Settings.certificate.maximum} validates :majors, presence: true, length: {maximum: Settings.certificate.maximum} validates :organization, presence: true, length: {maximum: Settings.certificate.maximum} va...
require 'spec_helper' describe BaseProtectedService do let(:endpoint_url) { 'http://endpoint.com' } let(:user) { 'foo_user' } let(:password) { 'bar_password' } let(:ca_cert) { 'cacertificate' } subject do Class.new(described_class) do def connection_tester with_ssl_connection do |connecti...
require 'test_helper' class ArticleTest < ActiveSupport::TestCase def setup @article = Article.new(title: "title", text: "text content") end test "title should be present" do @article.title = "" assert_not @article.valid? end test "text should be present" do @article.text = " " assert_...
require 'test_helper' class LabsControllerTest < ActionDispatch::IntegrationTest setup do @lab = labs(:one) end test "should get index" do get labs_url assert_response :success end test "should get new" do get new_lab_url assert_response :success end test "should create lab" do ...