text
stringlengths
10
2.61M
require 'csv_row_model/concerns/model/attributes' require 'csv_row_model/concerns/hidden_module' # Shared between Import and Export, see test fixture for basic setup module CsvRowModel module AttributesBase extend ActiveSupport::Concern include Model::Attributes include HiddenModule # @return [Hash]...
class Manage::FileworkersController < ManageController before_action :require_login before_action :set_file, only: [:show, :destroy] def index # @nonpaged_files = Manage::Filewordker.order(created_at: :desc) # @files = @nonpaged_files.page(params[:page]).per(15) # # respond_to do |format| # fo...
require 'pry' class Song attr_accessor :name, :artist, :genre @@all = [] def initialize(name, artist = nil, genre = nil) # optional artist and genre arguments @name = name self.artist = artist if artist != nil # if artist provided then assign artist to song self.genre = genre if genre != nil # if ge...
class Issw < Formula homepage "https://github.com/vovkasm/input-source-switcher" url "https://github.com/vovkasm/input-source-switcher/archive/v0.3.tar.gz" sha256 "c4bb51aae132e672c886ed8add7e31300be21569ec3e2867639e6ee23b38d049" depends_on "cmake" => :build def install system "cmake", ".", *std_cmake_a...
module Hydramata module Works # Responsible for pushing the inputs onto the work. # Not much to see here. class ApplyUserInputToWork def self.call(collaborators = {}) new(collaborators).call end attr_reader :attributes, :work, :property_value_strategy def initialize(collabo...
require 'test_helper' class BlockGroupsControllerTest < ActionDispatch::IntegrationTest setup do @block_group = block_groups(:one) end test "should get index" do get block_groups_url assert_response :success end test "should get new" do get new_block_group_url assert_response :success ...
class TracersController < ApplicationController def index @tracer = Tracer.new(message: 'Trace message') end def create RecordTrace.new.perform(tracer_params[:message]) redirect_to tracers_url end private def tracer_params params.require(:tracer) end end
class Cat < ActiveRecord::Base validates :birth_date, :color, :sex, :name, :description, presence: true validates :sex, inclusion: {in: %w(M F)} validates :color, inclusion: {in: %w(Black White Purple)} has_many :cat_rental_requests, dependent: :destroy def age now = Time.now.utc.to_date now.year - ...
require "rails_helper" require "email_spec" require "email_spec/rspec" RSpec.describe NotificationsMailer, type: :mailer do context '#pending creates proper email object' do before(:each) { create(:card) } let (:user) { User.select_with_pending_reviews.first } subject { NotificationsMailer.pending(user...
class TicketsganadorestsController < ApplicationController before_action :set_ticketsganadorest, only: [:show, :edit, :update, :destroy] # GET /ticketsganadorests # GET /ticketsganadorests.json def index # @ticketsganadorests = Ticketsganadorest.all #Buscaremos tickets ganadores no pagos. Los tickets p...
=begin Write a method that takes a first name, a space, and a last name passed as a single String argument, and returns a string that contains the last name, a comma, a space, and the first name. Examples =end def swap_name(str) last, first = str.split.each_slice(1).to_a "#{first[0]}, #{last[0]}" end puts sw...
require "omnifocus" RSpec.describe Omnifocus do let(:omnifocus) { Omnifocus.new } before(:each) do omnifocus.activate_if_not_running! end describe "#projects" do it "returns a list of projects" do projects = omnifocus.projects expect(projects).not_to be_empty end end describe "#c...
require 'spec_helper' describe file('/srv/http/default') do it { should be_directory } it { should be_owned_by 'default' } it { should be_grouped_into 'http' } end # Installing packages describe package('sl') do it { should be_installed } end # Building packages from AUR describe package('aurvote') do it {...
class AddVehicleDetailsColumnsToEnquiries < ActiveRecord::Migration[5.2] def change add_column :enquiries, :make, :string add_column :enquiries, :model, :string add_column :enquiries, :colour, :string add_column :enquiries, :year, :string add_column :enquiries, :reference, :string end end
require 'rspec' require 'data_mapper' require_relative 'data_mapper_setup_tests' require_relative '../src/mapper' require_relative '../src/book_controller' describe 'Integration with db' do before do DataMapper.finalize @mapper = Mapper.new end it 'should save and retrieve a book from db' do boo...
module VirusScanner class File attr_accessor :body def self.scan_url(uuid, url) # Pass UUID and URL to file to check to the HTTP requests handler body = handler.post(uuid, url) body end def self.check_status(uuid) body = handler.get(uuid) body end def self.han...
module Ricer::Plugins::Conf class ConfChannel < ConfBase trigger_is :confc always_enabled alias :super_set_var :set_var alias :super_show_var :show_var alias :super_show_vars :show_vars alias :super_show_all_vars :show_all_vars has_usage :set_var, '<plugin> <variable> <value...
# frozen_string_literal: true # *** USER INPUTS TIME TESTS require_relative 'validate_time' describe 'Validate time' do it 'should return a valid time if a valid time is given' do expect(validate_time('breakfast')).to eq('breakfast') expect(validate_time('lunch')).to eq('lunch') expect(validate_time('di...
Rails.application.routes.draw do devise_for :accounts root 'posts#index' mount RedactorRails::Engine => '/redactor_rails' get "sessions/new" get 'archives', to: 'posts#archives' resources :posts resources :users get 'about', to: 'pages#about' get 'contact', to: 'pages#contact' get 'test', ...
feature 'Logging out' do scenario 'signing out after singing in' do correct_sign_up click_button 'submit' click_button 'Sign out' expect(page).to have_content('goodbye!') end end
source 'https://rubygems.org' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '4.0.2' # Use inherited resouces to tidy up controllers gem 'inherited_resources' # Use Devise to manage users and stuff # gem 'devise' # Use Active Admin for administration panels #gem 'activeadmin', github: ...
# Public: Checks wether or not an Integer is odd. # # num - The Integer that will be checked. # # Examples # # is_odd(6) # # => false # # Returns if the Integer is odd or not. def is_odd(num) if num % 2 == 1 return true else return false end end
require File.dirname(__FILE__) + '/../test_helper' class ReportTest < ActiveSupport::TestCase context "by_all" do test "should construct report with reviews of all status" do start_date = 2.days.ago end_date = 2.days.from_now report = Report.new( :name => "Daily review report"...
class CreateLoads < ActiveRecord::Migration def self.up create_table :loads do |t| t.string :name t.string :gng t.string :etsng end end def self.down drop_table :loads end end
class AddBeltToStripe < ActiveRecord::Migration def change add_reference :stripes, :belt, index: true add_foreign_key :stripes, :belts end end
module TestSessionsHelper def xsign_in(attendee) cookies.permanent[:xremember_token] = attendee.remember_token self.current_attendee = attendee end def xsigned_in? !current_attendee.nil? end def current_attendee=(attendee) @current_attendee = attendee end d...
require 'rails_helper' RSpec.describe "retrospectives/show", type: :view do before(:each) do @retrospective = assign(:retrospective, FactoryBot.create(:retrospective)) end it "renders attributes in <p>" do render expect(rendered).to match(/2/) expect(rendered).to match(//) end end
class TodoItemsController < ApplicationController before_action :find_todo_list def index end def new @todo_item = @todo_list.todo_items.new end def create @todo_item = @todo_list.todo_items.new(todo_item_params) if @todo_item.save flash[:success] = "Added todo list item." ...
class AddTimesToIndexHistories < ActiveRecord::Migration[5.1] def change add_column :index_histories, :times, :integer, default: 0 end end
class Squares def initialize(num) @num = num end def square_of_sum (0..@num).inject(:+)**2 end def sum_of_squares (0..@num).inject { |sum, sq| sum + sq**2 } end def difference square_of_sum - sum_of_squares end end module BookKeeping VERSION = 4 end
class Player attr_accessor :name, :progress def initialize(name) @name = name end end player = Player.new("Dave") output = Marshal.dump(player) new_player = Marshal.load(output) puts player.inspect puts new_player.inspect
class UseEnumForStatusColumns < ActiveRecord::Migration[6.0] def up change_column :memberships, :status, :integer, default: 1, using: 'status::integer' change_column :membership_logs, :status, :integer, default: 1, using: 'status::integer' change_column :subscriptions, :status, :integer, default: 1, using...
# frozen_string_literal: true require_relative 'display' # move class gets user moves and validates class Move include Display def initialize @first_move = true end # checks if valid move:- between 1 and 10, not duplicate def valid_move(move, board_entry) # if out of range return false return f...
require_relative '../lib/prime.rb' describe Prime do it 'checks if a number is prime' do expect(Prime.valid?(10)).to eq(false) expect(Prime.valid?(49)).to eq(false) expect(Prime.valid?(101)).to eq(true) expect(Prime.valid?(29)).to eq(true) end it 'generates any number of primes' do expect(Pr...
class RenameNameAndNumberAndAddressFromBuildings < ActiveRecord::Migration def change remove_column :buildings, :name, :string remove_column :buildings, :number, :string remove_column :buildings, :address, :text add_column :buildings, :streetno, :integer add_column :buildings, :streetname, :string ...
#! /usr/bin/env ruby require 'optparse' require 'orocos' require 'time' require 'rock/bundle' debug = false save_configuration = nil parser = OptionParser.new do |opt| opt.banner = <<-EOT usage: oroconf apply task_name /path/to/configuration conf_name1 conf_name2 usage: oroconf extract task_model [--save=FILE_O...
class CreateCalendars < ActiveRecord::Migration[5.0] def change create_table :calendars do |t| t.references :user t.string :name, default: 'My calendar' t.timestamps(null: false) end end end
module GithubTwitterServer class Cacher class Feed class << self attr_accessor :cache_threshold end self.cache_threshold = 5 * 60 include Friendly::Document attribute :path, String attribute :atom, String indexes :path self.table_name = :github_feeds ...
# frozen_string_literal: true class Pdf::Styles::Colored < Pdf::Styles::Base def tags super.merge(:domain => { :color => "#999", :font_weight => :bold, :font_size => 14}, :date => {:font_size => 5.mm, :color => "999999", :font_weight => :bold}, :subtitle => {:font_size => 4...
class ScheduleChannel < ApplicationCable::Channel periodically :broadcast_schedule, every: 15.minutes def subscribed stream_from "schedule:#{params[:location]}" broadcast_schedule end def broadcast_schedule events = Event.today.upcoming.in_location(params[:location]).limit(5).all ActionCable.s...
#Chapter 10 #10.3 #Shuffle =begin def shuffle some_array shuffled_array = [] while some_array.length > 0 length = some_array.length selected = some_array[rand(length)] #create new array with all items except 'selected' #replace with a function that deletes a specific entry from an array? new_array = [] s...
require 'test_helper' class ClassgrpsControllerTest < ActionController::TestCase setup do @classgrp = classgrps(:one) end test "should get index" do get :index assert_response :success assert_not_nil assigns(:classgrps) end test "should get new" do get :new assert_response :success ...
module Eevee # A class to abstract things from the application's application.yml. # Also has some system-wide methods to simplify task development. class Application # Returns the root of the application. def self.root if @root.nil? raise "Eevee::Application.root is not set. Have you run Eevee::Applicatio...
class Experience < ApplicationRecord belongs_to :student validates :start_date, presence: true validates :end_date, presence: true def formatted_start_date start_date.strftime("%B %e, %Y").gsub(" ", " ") end def formatted_end_date end_date.strftime("%B %e, %Y").gsub(" ", " ") end end
require 'spec_helper' RSpec.describe ActiveRecordFlorder::Base do def create_subject lambda { ASCMovable.create } end let!(:subject_1) { create_subject.call } let!(:subject_2) { create_subject.call } let!(:subject_3) { create_subject.call } let(:step_config) { subject_1.class::min_position_d...
require 'spec_helper' describe Timetable do let(:timetable){ Factory.build(:timetable) } context "Validations" do it "must be equal when have the same name" do tt = Timetable.new({:name => "timetable"}) (timetable.equal?tt).should be true end it "must not be equal when name is ...
# frozen_string_literal: true require "pg_party/model_decorator" require "ruby2_keywords" module PgParty module Model module ListMethods ruby2_keywords def create_partition(*args) PgParty::ModelDecorator.new(self).create_list_partition(*args) end ruby2_keywords def create_default_part...
class Student < ApplicationRecord belongs_to :department default_scope {joins(:department).where('departments.is_deleted = false')} end
class CreateHeadaches < ActiveRecord::Migration def self.up create_table :headaches do |t| t.integer :user_id, :null => false t.datetime :created_at t.datetime :updated_at t.datetime :onset_time, :default => Time.new t.time :length t.integer :intensity t.boolean :similar_...
require 'net/http' require 'uri' require 'base64' require 'json' require 'cgi' require 'digest/sha1' class Bullhorn autoload :Plugin, "bullhorn/plugin" autoload :Sender, "bullhorn/sender" autoload :Backtrace, "bullhorn/backtrace" LANGUAGE = "ruby" CLIENT_NAME = "bullhorn-ruby" VERSION = "0.1.0" URL ...
module JsonStructure class Object_ < Type def initialize(hash = nil) @hash = hash && hash.each_with_object({}) do |(key, value), new_hash| new_hash[key.to_s] = value end end def ===(value) return false unless value.is_a?(Hash) if @hash return @hash.all? do |key, t...
class User < ActiveRecord::Base # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable has_attached_file :thumbnail, :default_url => 'profile...
class AddBodyToTopic < ActiveRecord::Migration[6.0] def change add_column :topics, :body, :text end end
class AddAdvantageTransformationToStatistics < ActiveRecord::Migration def change add_column :statistics, :advantage_transformation, :string, limit: 10, after: :bounce end end
require "bundler/gem_tasks" task :clean do sh 'rm -f pkg/*.gem' end task :install_vm do Bundler.with_clean_env do sh "cd development && vagrant ssh -c 'vagrant plugin uninstall vundler && vagrant plugin install /vagrant/pkg/vundler-*.gem'" end end desc 'Rebuild plugin and install on Vagrant dev VM' task :d...
class CreateMatches < ActiveRecord::Migration def change create_table :matches do |t| t.date :date t.time :time t.string :place t.string :home_or_away t.boolean :cancelled, default: false t.timestamps end end end
class Tree attr_accessor :payload, :children def initialize(payload, children) @payload = payload @children = children end end def depth_first_search(node, value) if node.payload == value return node else node.children.each do |child| result = depth_first_search(child, ...
Rails.application.routes.draw do devise_for :users get ':controller/:action/:state/:page_number', constraints: {page_number: /[1-9][0-9]*/} get '/home', to: 'home#home' get '/:home_alt', to: 'home#home', constraints: {home_alt: /home_[a-z_]+_[a-z_]+/} get '/contact', to: 'contact#contact' get '/:contact_a...
# frozen_string_literal: true class CommentsController < ApplicationController before_action :authenticate_user! def new @post = Post.find(params[:id]) @comment = @post.comments.build end def create @post = Post.find(params[:id]) params = user_params params[:user_id] = current_user.id ...
require 'rspec' require './lib/customer' require 'time' RSpec.describe Customer do before(:each) do @customer = Customer.new({id: "1", first_name: "Joey", last_name: "Ondricka", created_at: 2012-03-27, update...
require 'spec_helper' describe CanvasStatsd::BlockTracking do before(:all) do CanvasStatsd::DefaultTracking.track_sql end it "works" do statsd = double() allow(statsd).to receive(:timing).with('mykey.total', anything) expect(statsd).to receive(:timing).with("mykey.sql.read", 1) CanvasStatsd...
class DrawingsController < ApplicationController def index image_paths = Dir.glob(Rails.root.join('public', 'uploads', 'drawings', '*')).map do |path| path.match(/\/public(\/uploads\/drawings\/.*)/) $1 end render json: { imagePaths: image_paths } end def create uploaded_fil...
module TDWTF class EndpointResource # # since 0.1.0 def request(url) raise ArgumentError, "URL is a required to send a request" if url.nil? uri = "#{TDWTF.base_url}#{url}" Request.get(uri) end end end
require 'rails_helper' include AuthHelper include JsonHelper include ExpiredKey RSpec.describe Api::ItemsController, type: :request do let(:user) { create(:user) } let(:list) { create(:list, user: user) } let(:controller) { Api::ItemsController.new } let(:api_key) { create(:api_key, user: user) } let(:key) {...
class ChangeDateFormatInMedia < ActiveRecord::Migration def change change_column :media, :media_created_at, :timestamp end end
Gem::Specification.new do |s| s.name = %q{google-spreadsheet-ruby} s.version = "0.0.1" s.authors = ["Hiroshi Ichikawa"] s.date = %q{2008-12-24} s.description = %q{This is a library to read/write Google Spreadsheet.} s.email = ["gimite+github@gmail.com"] s.extra_rdoc_files = ["README.txt"] s.files = ["RE...
module Opity class Connect def initialize options = Opity.options providers = Opity.providers @connections = { balancer: nil, compute: nil, dns: nil, } providers.each do |p| name = p.name type = p.type.to_sym data = Opity.secrets_...
class ContentfulController < ActionController::Base http_basic_authenticate_with name: Rails.application.credentials.contentful[:webhooks][:username], password: Rails.application.credentials.contentful[:webhooks][:password] params = [:verify_authenticity_token, { only: [:webhooks], raise: false }] skip_before_a...
class AddLevelAndWorkStatusToEmployees < ActiveRecord::Migration def change add_column :employees, :level, :string add_column :employees, :work_status, :string change_column :employees, :status, :string, default: 'inactif' end end
require "spec_helper" describe InclusionsController do describe "routing" do it "routes to #index" do get("/inclusions").should route_to("inclusions#index") end it "routes to #new" do get("/inclusions/new").should route_to("inclusions#new") end it "routes to #show" do get("/i...
require File.expand_path('easy_access_hash', File.dirname(__FILE__)) require 'active_support' class DisambiguatedResult attr_reader :original NUMBER_OF_VARIANTS = 3 def self.from_response(response) begin response_json = ActiveSupport::JSON.decode(response); rescue Exception => e puts "Err...
class User < ActiveRecord::Base devise :database_authenticatable, :recoverable, :validatable has_many :players, dependent: :destroy validates :username, presence: true before_create :set_access_token private # TODO: use 'rails token auth' def set_access_token self.access_token = SecureRandom.uuid...
require 'spec_helper' describe ApparelsHelper do include ApparelsHelper # has methods #login and #logout that modify the session describe "should be able to show" do it "root apparel" do a = Apparel.create! :name => 'Nohavice' render_apparel(a, [a.id]).should have_content(a.name) end it...
=begin Write a method that takes an Array of Integers between 0 and 19, and returns an Array of those Integers sorted based on the English words for each number: zero, one, two, three, four, five, six, seven, eight, nine, ten, eleven, twelve, thirteen, fourteen, fifteen, sixteen, seventeen, eighteen, nineteen E...
class RemoveRedundantFieldsFromPostsAndCategories < ActiveRecord::Migration def self.up remove_column :posts, :category_id remove_column :categories, :post_id end def self.down add_column :posts, :category_id, :integer add_column :categories, :post_id, :integer end end
class ContactsController < ApplicationController before_action :logged_in_user before_action :admin_user, only: :destroy def index if params[:search] @contacts = (Contact.search params[:search]).paginate(page: 1) else @contacts = Contact.all.paginate(page: params[:page], per_page: 10) end...
# frozen_string_literal: true class AddInvoicerTypeToPaymentNotifications < ActiveRecord::Migration[4.2] def change add_column(:payment_notifications, :invoicer_type, :string) unless column_exists?(:payment_notifications, :invoicer_type) end end
namespace :dummy do desc "Hydrate the database with some dummy data to make it easier to develop" task :reset => :environment do Recipe.destroy_all Recipe.create!([ {id: 1, created_at:"2019-06-01", updated_at:"2019-06-01", source_website: "https://damndelicious.net/2014/06/21/baked-parmesan-zucch...
require 'test_helper' class MuseumVisitsControllerTest < ActionController::TestCase setup do @museum_visit = museum_visits(:one) end test "should get index" do get :index assert_response :success assert_not_nil assigns(:museum_visits) end test "should get new" do get :new assert_res...
class SSHProvisioner < Vagrant.plugin("2", :provisioner) class Error < Vagrant::Errors::VagrantError; end def provision private_key_file = machine.config.sandbox.private_key_path public_key_file = private_key_file + ".pub" authorized_keys_file = "/home/vagrant/.ssh/authorized_keys" unless File.exi...
require 'goby' module Goby # Allows an Entity to try to escape from the opponent. class Escape < BattleCommand # Text for successful escape. SUCCESS = "Successful escape!\n\n" # Text for failed escape. FAILURE = "Unable to escape!\n\n" # Initializes the Escape command. def initialize ...
namespace :shows do namespace :import do desc 'Import the 2010 shows from the Comedy Festival website' task '2010' => :environment do Importers::ComedyFestival.import_2010 end desc 'Scrape performance dates and times from the MICF website' task :performances => :environment do Sho...
require_relative 'spec_helper' describe 'chef-server-populator::org' do let(:default_org) { 'nasa' } let(:test_org) do Mash.new( org_name: 'endurance', full_name: 'Endurance Shuttle Mission', validator_pub_key: 'validation_pub.pem' ) end let(:test_org_user) do Mash.new( na...
class Course < ApplicationRecord has_many :student_courses has_many :students, through: :student_courses has_many :assignments has_many :teacher_courses has_many :teachers, through: :teacher_courses validates :name, presence: true end
class Uploader < CarrierWave::Uploader::Base storage :file def store_dir "uploads/#{model.class.name.underscore}/#{model.id}" end # # def filename # "#{SecureRandom.base64}.#{file.extension}" # end end
require_relative 'card' class Hand =begin Royal Flush: Contains five cards, A, K, Q, J, 10, all of the same suit Straight Flush: Contains five cards, 9-2, all same suit 4 of a Kind: Contains four of five cards all of the same rank, suits can differ Full House: Three of a Kind and a Pair Flush: All five cards of the...
require 'rails_helper' describe Api::V1::OrderItemsController, type: :controller do let (:client) { FactoryGirl.create(:client) } let (:order) { FactoryGirl.create(:order, client: client, ship_method: nil) } let!(:item) { FactoryGirl.create(:order_item, order: order, quantity: 3) } let (:product) { FactoryGirl...
IdentityLinker = Struct.new(:user, :authenticated, :sp_data) do def set_active_identity active_identity end def update_user_and_identity_if_ial_token return if sp_data[:ial_token].blank? update_user update_active_identity end private def update_user user.update(ial_token: sp_data[:ia...
# frozen_string_literal: true module SearchAutocomplete # Autocomplete engine class Engine < ::Rails::Engine engine_name 'search_autocomplete' isolate_namespace SearchAutocomplete end end
class CreateReportingOverduePatients < ActiveRecord::Migration[6.1] def change create_view :reporting_overdue_patients, materialized: true add_index :reporting_overdue_patients, [:month_date, :patient_id], unique: true, name: "overdue_patients_month_date_patient_id" add_index :reporting_overdu...
ActiveAdmin.register ActivityPost do # See permitted parameters documentation: # https://github.com/activeadmin/activeadmin/blob/master/docs/2-resource-customization.md#setting-up-strong-parameters # batch_action :approve do |ids| batch_action_collection.find(ids).each do |activitypost| activitypost.approv...
class MemberPage::ApplicationController < ApplicationController layout 'member_page' before_action :authenticate_member! end
require_relative '../lib/calendar_item' class Organizer attr_accessor :name end class Item attr_accessor :start,:end,:location,:organizer,:my_response_type,:subject,:id, :recurrence end item = Item.new item.start = DateTime.parse("2015-06-26") item.end = DateTime.parse("2015-06-26") item.location = "xxxx" item.o...
class Product < ActiveRecord::Base belongs_to :user attr_accessible :name, :price, :quantity end
#encoding: UTF-8 # == Schema Information # # Table name: chapters # # id :integer not null, primary key # story_id :integer # reference :string(10) # content :text # created_at :datetime # updated_at :datetime # image :string(255...
module DeepStore class CodecFactory def self.call(*args) new.call(*args) end def call(codec_id, options = {}) case codec_id when :gzip Codecs::GzipCodec.new(options) else Codecs::NullCodec.new(options) end end end end
module Gollum class SiteMarkup < Gollum::Markup # Attempt to process the tag as a page link tag. # # tag - The String tag contents (the stuff inside the double # brackets). # no_follow - Boolean that determines if rel="nofollow" is added to all # <a> tags. # ...
class Sable::DSL::Context attr_reader :service_accounts def initialize(options, &block) @options = options @service_accounts = {} instance_eval(&block) end def service_account(email, &block) @service_accounts[email] = Sable::DSL::Context::ServiceAccount.new(email, &block) end end
FactoryBot.define do factory :ring_group_member do user ring_group available { false } trait :available do available { true } end trait :unavailable do available { false } end end end
require 'rails_helper' describe Dashboard::MailBoxesController do before :each do @request.env["devise.mapping"] = Devise.mappings[:user] @user = FactoryGirl.create :user sign_in @user @mail_box = @user.mail_boxes.create!(login: "dns.ryabokon", pop3_server: "pop3.google.com", domain: "google.com") ...