text
stringlengths
10
2.61M
require 'chefspec/matchers/shared' module ChefSpec module Matchers %w(bash csh perl python ruby).each do |interpreter| RSpec::Matchers.define "execute_#{interpreter}_script".to_sym do |name| match do |chef_run| if @attributes chef_run.resources.any? do |resource| ...
# encoding: utf-8 module Chartup class Chord attr_accessor :name, :length, :root_letter, :root_accidental, :type # Create Chord object of a particular length # @param chord_name [String] the full name of the Chord - e.g. "BbM7#11" # @param length [Fixnum] the number of beats the Chord will last for....
#! /usr/bin/env ruby require "chunky_png" require_relative "../patch.rb" WIDTH = 40 HEIGHT = 70 def draw() png = ChunkyPNG::Image.new(1920, 1080, ChunkyPNG::Color('purple')) green = ChunkyPNG::Color('green') blue = ChunkyPNG::Color('blue') idx = 0 patch = Patch.new patch.set('6', green, Patch...
class Student attr_accessor :name, :id, :program def initialize (name, id, program) @name = name @id = id @program = program @classes = [] end def add_class (program_class) @classes << program_class end def remove_class (program_class) @classes.remove(program_class) end...
class RenameTableGuests < ActiveRecord::Migration def change rename_table :guests, :roles end end
=begin DFAに基づく字句解析プログラム float_parse.rb 7061-0503 Ryosuke Takata =end state = 0 str = ARGV[0] if str == nil puts "argument error" exit end # DFAで1文字ずつ状態遷移 str.each_char do |ch| case state when 0 if ch == '.' state = 1 elsif ch.match(/[0-9]/) state = 2 else state = -1 en...
require 'rails_helper' RSpec.describe Klass, type: :model do # Relations it { should have_many :specializations } it { should have_many :spells } it { should have_one :character } # Validations it { should validate_presence_of :name } end
class TransferWorker include Sidekiq::Worker def perform(transfer_id) transfer = Transfer.find(transfer_id) account = transfer.account if transfer.status == 'pending' prepare(transfer, account) elsif transfer.status == 'accepted' finalize(transfer, account) end end private ...
module TaxCalculator class FileReader QUANTITY_REGEX = /^\d+/.freeze PRICE_REGEX = /[0-9]{1,}.[0-9]{1,}$/.freeze private_constant :QUANTITY_REGEX, :PRICE_REGEX def initialize(file_path) @file_path = file_path end def list_products read_file_lines end private attr_r...
class Elaios::Requester attr_reader :logger def initialize(options={}) @name = options[:name] || 'elaios_client' @logger = options[:logger] || Logger.new(STDOUT).tap { |l| l.progname = @name l.level = ENV['LOG_LEVEL'] || 'info' } @blocks = {} @in = Simple::Queue.new @out = Simpl...
require 'test_helper' class ScalesControllerTest < ActionController::TestCase include AuthenticatedTestHelper def setup login_as(Factory(:user)) @scale1 = Factory(:scale) @scale2 = Factory(:scale) @scale3 = Factory(:scale) m=Factory(:model,:policy=>Factory(:public_policy)) m.scales=[@scal...
class CreateEvents < ActiveRecord::Migration def change create_table :events do |t| t.references :user t.string :eventtype t.date :eventdate t.string :eventdateformat t.string :title t.text :content t.integer :width t.integer :height t.string :image t.st...
require_relative 'config' require_relative 'value_history' require_relative 'util' # BallTracker tracks and reports ball position, speed etc. # TODO Lots of the AI logic like get_best_paddle_y is still here and # would need to be cleaned out. module Pingpong class BallTracker attr_reader :dx attr_reader :...
require 'rails_helper' describe Email, type: :model do let(:email) { create(:email) } it 'creates record' do expect(email).to be_persisted end describe 'validation' do it 'validates data presence' do expect(build(:email, data: nil)).to_not be_valid end it 'validates external_id presenc...
class EventsController < ApplicationController def new if logged_in? @event = Event.new else redirect_to root_path, flash: { not_logged_in: 'please log in first' } end end def create @event = current_user.created_events.build(event_params) if @event.save redirect_to event_pa...
class Jobs @@all_jobs = [] define_method(:initialize) do |past_job, description| @past_job = past_job @description = description end define_method(:past_job) do @past_job end define_method(:description) do @description end define_singleton_method(:all) do @@all_jobs end def...
module TranslationCenter class InstallGenerator < Rails::Generators::Base include Rails::Generators::Migration source_root File.expand_path('../templates', __FILE__) argument :langs, type: :array, :default => ['en'] def self.next_migration_number(path) @migration_number = Time.now.utc.strftime...
class AddPerimeterIntegerToFavours < ActiveRecord::Migration[5.2] def change add_column :favours, :perimeter, :integer end end
json.array!(@airports) do |json, airport| json.label("#{airport.city.name}, #{airport.name}") json.value("#{airport.city.name}, #{airport.name}") json.data(airport.code) end
require_relative "../submission" require_relative "../question" describe Submission do before do question = Question.new("ratingquestion") @submission = Submission.new(question, "1") end it "should have question" do expect(@submission.question).to be_kind_of(Question) end describe "answere...
require 'rails_helper' RSpec.describe LinkTag, type: :model do it {should belong_to :link} it {should belong_to :tag} end
module API class TasksController < ApplicationController before_action :find_task, only: [:show, :update, :destroy] def index tasks = Task.where(house_id: params[:house_id]) render json: tasks, status: 200 end def show render json: @task, status: 200 end def create t...
class Eastl < Formula desc "Electronic Arts Standard Template Library" homepage "https://github.com/electronicarts/EASTL" url "https://github.com/electronicarts/EASTL.git", using: :git, tag: "3.16.07", revision: "1cf6182218bec79ece0b91e762f507e8c027807c" sha256 "" depends_on "cmake"...
describe Repositories::Workers::CheckPullRequests do describe '#perform' do subject(:worker_result) { described_class.new.perform } before do create :pull_request end it 'queues a pull request process ' do worker_result expect(Sidekiq::Queues['pull_requests'].size).to eq(1) end...
class ApplicationRecord < ActiveRecord::Base self.abstract_class = true # Sort records by date of creation instead of primary key self.implicit_order_column = :created_at before_create -> { self.id = SecureRandom.uuid } end
class ContactsController<ApplicationController before_action :signed_in_user, only: [:index, :edit, :update, :destroy] before_action :admin_user, only: [:edit, :update, :destroy ] def index @contacts = Contact.paginate(page: params[:page]) end def new @contact = Contact.new end de...
class CaseTestsController < ApplicationController before_action :set_case_test, only: [:show, :edit, :update, :destroy] def search if params[:q].present? @case_tests = CaseTest.where("upper(title) LIKE '%#{params[:q].upcase}%'") end render :index end # GET /case_tests # GET /case_tests.jso...
Given(/^a bomb$/) do visit '/' click_button 'ON' end Then(/^Bomb status should be "(.*?)"$/) do |status| expect(page).to have_field("status", with: status) end Then(/^bomb timer should be "(.*?)"$/) do |timer| expect(page).to have_field("display", with: timer) end
require 'rails_helper' RSpec.describe Cultivation::SaveTrayPlans, type: :command do before do Time.zone = "UTC" end let!(:facility) do facility = create(:facility, :is_complete) facility.rooms.each do |room| room.rows.each do |row| row.shelves.each do |shelf| shelf.trays.each(...
# frozen_string_literal: true class User::Say < BaseOperation required do string :body end optional do integer :addressee_id end def authorized? actor.present? end def execute record = actor.messages.create(body: body, addressee_id: addressee_id) { id: record.id, user_id: record.u...
require('minitest/autorun') require('minitest/rg') require_relative("../board.rb") require_relative("../dice.rb") require_relative("../player.rb") require_relative("../modifier.rb") require_relative("../game.rb") class TestGame < MiniTest::Test def setup() @dice = Dice.new() @player1 = Player.new("Jeff Bri...
# rack is a ruby gem + an architecture # rack defines a very simple interface # rake compliant code must have the following 3 characteristics # 1 - must respond to call # 2 - method must accept a single argument - usually env (which bundles the request object) # 3 - the call method must return an array of 3 elements - ...
ENV["RAILS_ENV"] = "test" require File.expand_path("../../config/environment", __FILE__) require "rspec/rails" require "shoulda/matchers" require "cancan/matchers" require "paperclip/matchers" require "draftsman/frameworks/rspec" ::Shoulda::Matchers.configure do |config| config.integrate do |with| with.test_fr...
class ContentsController < ApplicationController def index @contents = Content.all json_response(@contents) end def create @content = Content.create!(content_params) json_response(@content, :created) end private def content_params params.permit(:title, :published_date, :author, :summary,...
require_relative 'models/phonology_reader' require_relative 'models/word_generator' include PhonologyReader def open_prompt puts "\nWelcome to Lexicon Generator" puts 'Show (p)honology' puts 'Define a (s)yllable structure' puts '(G)enerate words' puts '(Q)uit' gets.chomp.downcase.strip end #the opening ...
require 'spec_helper' describe LoggingSupport do subject do class TestLoggingClass include LoggingSupport end end it 'responds to both instance and class methods' do expect(subject.new).to respond_to(:logger) expect(subject).to respond_to(:logger) end it 'shares a logger object betwee...
class BudgetController < ApplicationController before_action :require_login def index @budgets = Budget.where(user_id: current_user.id) end end
# encoding: UTF-8 # Copyright 2012 Twitter, Inc # http://www.apache.org/licenses/LICENSE-2.0 module TwitterCldr module Formatters class ListFormatter < Formatter attr_accessor :locale def initialize(locale = TwitterCldr.locale) @locale = TwitterCldr.convert_locale(locale) end ...
require 'faraday_middleware' class SidereelClient < Struct.new(:username, :password) def connection MyShows.logger.info "Create connection for #{username}" @connection ||= Faraday.new url: 'http://www.sidereel.com' do |conn| conn.request :url_encoded # form-encode POST params conn.request :basic...
module Antlr4::Runtime class CommonToken < WritableToken class << self @@EMPTY_SOURCE = OpenStruct.new end attr_accessor :type attr_accessor :line attr_accessor :char_position_in_line attr_accessor :channel attr_accessor :source attr_accessor :token_index attr_accessor :st...
require "active_record" # Taken from factory_bot # https://github.com/thoughtbot/factory_bot/blob/main/spec/support/macros/define_constant.rb module DefineConstantMacros def define_class(path, base = Object, &block) stub_const(path, Class.new(base)).tap do |const| const.class_eval(&block) if block end...
class Api::UserIngredientsController < ApplicationController def create @user_ingredient = current_user.user_ingredients.build(name: params[:name].singularize) if @user_ingredient.save head 201 ## successful response else render json: @user_ingredient.errors, status: :unprocessable_entity ...
class CreateEmployeeSessions < ActiveRecord::Migration def self.up create_table :employee_sessions do |t| t.timestamps end end def self.down drop_table :employee_sessions end end
class Test def sort(collection, from=0, to=nil) if to == nil # Sort the whole collection, by default to = collection.count - 1 end if from >= to # Done sorting return end # Take a pivot value, at the far left pivot = collection[from] # Min and Max pointers ...
require 'test_helper' class MongrationsTest < ActiveSupport::TestCase context "A valid MongoMapper connection" do setup do MongoMapper.connection = Mongo::Connection.new MongoMapper.database = "mongrations_test" @path = File.join("test", "mongrations") @version = "20101125020919" end ...
require 'spec_helper' describe Place do before(:each) do @attr = { :name => "Joe's Bar", :description => "A description.", :website => "http://www.joesbar.com", :group => "Bar" } end describe "validations" do it "should require a name" do no_name_p...
require 'rails_helper' RSpec.describe User, type: :model do after(:each) do User.destroy_all end context 'validation' do it 'should validate nickname presence' do user = User.new(status: 'Available') user.validate expect(user.errors.messages).to include(:nickname) expect(user.err...
class Users::OmniauthCallbacksController < DeviseTokenAuth::OmniauthCallbacksController def omniauth_success if auth_hash[:info][:email].blank? render json: { errors: "Your account email is empty. Email can't be blank" }, status: :unprocessable_entity else get_resource_from_auth_hash...
require 'rails_helper' RSpec.describe ArticlesController, type: :controller do let!(:article) { create(:article) } it 'shows decorated article' do get :show, { id: 1 } expect(assigns(:article)).to be_decorated expect(assigns(:article)).to be_decorated_with ArticleDecorator end end
require "test_helper" require "pricing_calculator/html_nodes_counter" class PricingCalculator::HtmlNodesCounterTest < ActiveSupport::TestCase test "it counts all html nodes in html document" do html = File.read(File.join(fixture_path, "ror_welcome.html")) calculator = PricingCalculator::HtmlNodesCounter.new...
# frozen_string_literal: true class User < ApplicationRecord belongs_to :team, optional: false scope :born_today, lambda { where( 'EXTRACT(day FROM birthday) = ? AND EXTRACT(month FROM birthday) = ?', Time.now.day, Time.now.month ) } end
class FontEversonMono < Formula version "7.0.0" url "https://www.evertype.com/emono/evermono.zip" desc "Everson Mono" homepage "https://www.evertype.com/emono/" def install parent = File.dirname(Dir.pwd) != (ENV['HOMEBREW_TEMP'] || '/tmp') ? '../' : '' (share/"fonts").install "#{parent}evermono-#{ver...
# frozen_string_literal: true $LOAD_PATH.unshift File.expand_path("../../lib", __FILE__) require "active_support" # A missing require for try has been added to rails master here: # https://github.com/rails/rails/commit/530f7805ed5790af1d472a041bc74089dc183f47 # The explicit require below can be removed with a future...
module OneDoc class PhpDocument < Document def initialize(target) @target = target parse end def parse output_dir = @target + "_ouput" output = `phpdoc run -d #{@target} -t /tmp/#{output_dir} --template=xml` @xml_doc = Nokogiri::XML(File.open("/tmp/#{output_dir}/structure...
#!/usr/bin/env ruby require 'optparse' require 'atos_wrapper' options = {} options_parser = OptionParser.new do |opts| opts.banner = "Usage: atosrb [options] <application.app> <crashlog file/s or directory/ies>" opts.on("--arch architecture", "Specify architecture. Default: x86_64") do |arch| options[:arch] =...
require_relative '../words.rb' class Word < ApplicationRecord has_many :favorites has_many :users, through: :favorites def self.seed puts "ww" allwords.each do |key, value| Word.find_or_create_by(word: key, def: value); end end def self.addLength Word.all.each do |element| eleme...
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe Asset do # Relies on the descriptor registered by config/initializers/salt_descriptors.rb before(:each) do @mock_repo = double("Stanford::AssetRepository") expect(Stanford::AssetRepository).to receive(:new).and_return(@mock_...
require 'test_helper' class OrdersControllerTest < ActionController::TestCase include Devise::TestHelpers # orders#index test "render orders index for users" do user = FactoryGirl.create(:user) order = FactoryGirl.create(:graphic_order, owner: user) sign_in user get :index assert_response :...
class String define_method(:find_and_replace) do |string_to_find, replacement| original_string = self result_array = [] words = original_string.split() words.each() do |word| if word.downcase() == string_to_find.downcase() #exact match result_array.push(replacement) elsif word.dow...
class AnswersController < ApplicationController before_action :set_answer, only: [:edit, :update, :destroy] before_action :authorize, only: [:create, :edit, :destroy, :new, :update] def index @answers = Answer.all end def new @answer = Answer.new end def create @answer = Answer.new(answer_p...
class CreateClassrooms < ActiveRecord::Migration[5.0] def change create_table :classrooms do |t| t.integer :students_id, index: true t.integer :courses_id, index: true t.datetime :entry_at end add_index :classrooms, [:students_id, :courses_id] end end
class AddBookCloudUrlToBooks < ActiveRecord::Migration[5.0] def change add_column :books, :book_cloud_url, :string end end
require 'byebug/history' require 'byebug/helpers/file' # # Namespace for all of byebug's code # module Byebug # # Main Interface class # # Contains common functionality to all implemented interfaces. # class Interface include Helpers::FileHelper attr_accessor :command_queue, :history attr_read...
Rails.application.routes.draw do # EXAMPLE HTML ROUTE # get "/photos" => "photos#index" # EXAMPLE JSON ROUTE WITH API NAMESPACE namespace :api do get "/games" => "games#index" get "/games/:id" => "games#show" get "/characters" => "characters#index" get "/characters/:id" => "characters#show" ...
require 'rails_helper' describe Batch do it "expects to not create record and report error if emails are invalid" do batch = build(:batch, emails: "foo@bar.com\nomgwtfbbq\n\r\n") expect(batch).to_not be_valid expect(batch.errors.size).to eq 1 expect(batch.errors.full_messages.first).to match /omgwt...
xml.person do |e| e.name @person.name e.item @person.item e.quantity @person.quantity e.price @person.price e.remark @person.remark e.created_at @person.created_at end
# Read about factories at https://github.com/thoughtbot/factory_girl FactoryGirl.define do factory :market do name "Easton Market" address "Lakewood Ave" city "Easton" state "MA" postal_code "02375" latitude "1.5" longitude "1.5" datetime "monday" end end
# frozen_string_literal: true require 'jiji/test/test_configuration' require 'jiji/model/securities/oanda_securities' if ENV['OANDA_API_ACCESS_TOKEN'] describe Jiji::Model::Securities::Internal::Oanda::RateRetriever do before(:example) do @client = Jiji::Model::Securities::OandaDemoSecurities.new( ...
require 'rails_helper' RSpec.describe RoadbikesController, type: :controller do describe "index" do let(:user_info){create :mangement} subject{get :index,session: {id: user_info.id}} it "@bikeがあること" do subject expect(assigns(:bikes).count).to eq Roadbike.all.count end it "indexへ遷移すること...
class WalkRequestsController < ApplicationController before_action :set_walk_request, only: [:show, :edit, :update, :destroy] before_action :check_auth # GET /walk_requests # GET /walk_requests.json def index @walk_requests = WalkRequest.all end # GET /walk_requests/1 # GET /walk_requests/1.json ...
module OffRoad def four_wheel_drive "Tunrn on 4X4!" end end class Vehicle attr_accessor :color attr_reader :year, :model @@number_of_vehicles = 0 def self.calculate_mpg(miles, fuel) mpg = miles / fuel puts "You are gettin #{mpg} miles per gallon" end def self.show_num_vehicles pu...
=begin For an interior designer to get its clients information it will require a number of puts strings with a gets.chomp for the answers and then direction on what to do with that information once its gathered. return the info in a hash and ask at the end if there were any mistakes, use puts and gets.chomp to discover...
# 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 Backer attr_reader :name, :backed_projects def initialize(name) @name = name @backed_projects = [] end def back_project(prjct) @backed_projects << prjct prjct.backers << self end end
module WalletConcern extend ActiveSupport::Concern included do rails_admin do navigation_label I18n.t(:money) list do field :user field :deposits field :deposit_requests field :withdrawals field :withdrawal_requests field :created_at field :up...
class Mission < ActiveRecord::Base has_many :roles, :dependent => :destroy has_many :funnels, :dependent => :destroy has_many :searches, :dependent => :destroy has_many :candidates, :through => :funnels has_many :users, :through => :roles, :conditions => "users.rec_access_level > 0" has_one :owne...
module RedminePerProjectFormatting module SettingPatch def text_formatting current_text_formatting || super end def current_text_formatting Thread.current[:current_text_formatting] end def current_text_formatting=(format) Thread.current[:current_text_formatting] = format.presen...
#============================================================================== # Compatibility Patch : v1.1 (8/07/12) # YEA System Options + KMS Generic Gauge #============================================================================== # Script by: # Mr. Bubble #-------...
class CourseTimeExpressionCollectionMap #[ # [weekday, [course_time_expression_collection1, course_time_expression_collection2]], # [weekday, []], #] attr_reader :line_course_time_expression_collections attr_reader :next_course_time_expression_collection attr_reader :next_course_time_expression...
# Source: https://launchschool.com/exercises/1d04b607 # Write a method that takes the 3 angles of a triangle as arguments, and # returns a symbol :right, :acute, :obtuse, or :invalid depending on whether # the triangle is a right, acute, obtuse, or invalid triangle. # You may assume integer valued angles so you don't...
class RestaurantReview < ApplicationRecord belongs_to :user belongs_to :restaurant validates :content, presence: :true validates :rating, presence: :true end
class AddFoursquareToRestaurants < ActiveRecord::Migration def change add_column :restaurants, :foursquare_id, :string add_column :restaurants, :foursquare_rating, :float end end
class BillDetail < ApplicationRecord has_one :bill has_one :product belongs_to :Product belongs_to :Bill validates :quantity, pesence: true, numericality: true end
class Micropost < ApplicationRecord belongs_to :user validates :user_id, presence: true validates :content, presence: true, length: { maximum: 255 } def feed_microposts Micropost.where(user_id: self.micropost_ids + [self.id]) end end
module Scorer class Story attr_accessor :project_id, :follower_ids, :updated_at, :current_state, :name, :comment_ids, :url, :story_type, :label_ids, :description, :requested_by_id, :planned_iteration_number, :external_id, :deadline, :owned_by_id, :owned_by, :created_at, :estim...
#!/usr/bin/env ruby # frozen_string_literal: true #=============================================================================== # # Before running, you must have the following programs: # # ruby, wget, gunzip (ou gzip), sqlite3 # # So: # sudo apt update # sudo apt install ruby-full wget gzip sqlite3...
module Roglew class FramebufferARB include Roglew::Contextual(FramebufferContextARB) attr_reader :handle, :id def initialize(handle) @handle = handle @id = handle.bind { |context| context.gen_framebuffers } ObjectSpace.define_finalizer(self, self.class.finalize(@handle, @id)) ...
class AddDepartmentRefToProfiles < ActiveRecord::Migration def change add_reference :profiles, :department, index: true, foreign_key: true end end
class CreatePets < ActiveRecord::Migration[5.1] def change create_table :pets do |t| t.references :user, null: false, unique: true, index: true # t.string :owner_email, null: false, unique: true # t.string :owner_firstname, null: false # t.string :owner_lastna...
require 'rails_helper' RSpec.feature 'List expenses in the API' do include API::JSONHelpers scenario 'all of them' do expenses = create_list(:expense, 2) visit api_expenses_path expect(map_json_attribute(json_response, :description)).to eq expenses.map(&:description) expect(map_json_attribute(js...
class Video < ActiveRecord::Base belongs_to :user # Paperclip delcaracion de adjuntos has_attached_file :video_file has_attached_file :mp4_file has_attached_file :webm_file has_attached_file :ogg_file # declaracion del estilo del video has_attached_file :thumbnail, styles: { medium_nr: "250x150!" } # ...
class MaterialsController < ApplicationController before_action :set_material, only: [:show, :edit, :update, :destroy] # GET /materials # GET /materials.json # if !current_user.admin # redirect_to root_path # end # how avoid intrusers at material route before_action do |controller| if user_sig...
require "spec_helper" describe SocialNetworkRDFDeserializer do let(:user) { User.create!(email: "dummy@example.com", password: "secret") } let(:deserializer) { SocialNetworkRDFDeserializer.new(user, content) } context "with a file with visual structure" do let(:content) { File.readlines("spec/data/Memorias_...
# 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...
module ExtScaffoldCoreExtensions module ActiveRecord module Base def to_ext_json(options = {}) success = options.delete(:success) # always transform attribute hash keys to model_name[attribute_name] if options.delete(:output_format) == :form_values # return array of id/val...
class AddNavigationTypeToPages < ActiveRecord::Migration[5.1] def change add_column :webinius_cms_pages, :navigation_type, :string end end
class ContestantPresenter < BasePresenter def id target.id end def name target.name end def avatar v.content_tag :div, class: :avatar, style: "background-image: url('#{target.avatar_path}')" do v.content_tag :div, nil, class: 'inner' end end # Message stating what other forms of v...
data_bag('vhosts').each do |v| vhost = data_bag_item('vhosts', v) next if vhost['servername'].to_s.empty? directory "/var/www/#{vhost['servername']}" do owner "www-data" group "www-data" mode 0755 end if %w(true yes on 1).include?(vhost['default_vhost'].to_s) confname = "000-#{vhost['server...
Given /the following users exist/ do |users_table| users_table.hashes.each do |user| User.create!(user) end end Given /the following articles exist/ do |articles_table| articles_table.hashes.each do |article| Article.create!(article) end end Given /the following comments exist/ do |comments_table| c...
class Account < ActiveRecord::Base extend FriendlyId friendly_id :username devise :database_authenticatable, :registerable, :recoverable, :rememberable, :validatable validates :username, presence: true, uniqueness: { case_sensitive: false }, format: { wit...