text
stringlengths
10
2.61M
# frozen_string_literal: true RSpec.describe Contentful::Importer do around do |example| VCR.use_cassette('contentful items') do example.run end end it 'inherits from ApplicationService' do expect(described_class.superclass).to eq(ApplicationService) end it 'respondes to call' do expe...
require 'thor' require 'stax/aws/sts' require 'aws-sdk-ssm' ## clean exit on ctrl-c for all methods trap('SIGINT', 'EXIT') module Stax class Base < Thor no_commands do def app_name @_app_name ||= options[:app].empty? ? nil : cfn_safe(options[:app]) end def branch_name @_branc...
module RailsLazyCommands def log(message=nil, args={}) Rails.logger.debug(print_message(message, args)) end def clear Rails.cache.clear end def today Date.current end def now Time.current end private def print_message(message, args) "#{ args.fetch(:evidence, '==============...
class CreateObservations < ActiveRecord::Migration def change create_table :observations do |t| t.integer :student_id t.datetime :observed_on t.string :name t.datetime :birthdate t.string :grade t.string :teacher t.string :allergies t.string :diet t.string ...
require 'spec_helper' describe Scene do describe '#best_scenario' do it 'returns best scenario' do scene = create(:scene) response_sport = create(:response, scene: scene, upvotes: 1) response_alcohol = create(:response, scene: scene, upvotes: -1) response_sport_gym = create(:response, sce...
#!/usr/bin/ruby # encoding: utf-8 require 'shellwords' require 'fileutils' require 'optparse' def class_exists?(class_name) klass = Module.const_get(class_name) klass.is_a?(Class) rescue NameError false end if class_exists? 'Encoding' Encoding.default_external = Encoding::UTF_8 if Encoding.respond_to?('defau...
class SumOfMultiples def self.to(limit, mults=[3, 5]) result = (0...limit).select { |num| mults.any? { |mult| num % mult == 0 } } result.inject(:+) end def initialize(*mults) @mults = mults.empty? ? [3, 5] : mults end def to(limit) self.class.to(limit, @mults) end end # class SumOfMult...
#! /bin/env ruby require 'sqlite3' SQLITEFILE = "/home/seijiro/crawler/crawler.db" def create_db sql =<<-SQL CREATE TABLE IF NOT EXISTS crawler( id integer primary key, name text, path text, created_at TIMESTAMP DEFAULT (DATETIME('now','localtime')) ); SQL db = SQLite3::Database.new(SQLITEFILE) db.exec...
require 'rails/generators' module Hydramata module Works class ComplexPredicateGenerator < Rails::Generators::NamedBase source_root File.expand_path('../templates', __FILE__) def create_properties_files template("properties_edit.html.erb", "app/views/hydramata/works/properties/#{file_name}/_...
class CalculationAlgorithmsController < ApplicationController before_action :set_calculation_algorithm, only: [:show, :edit, :update, :destroy] # GET /calculation_algorithms # GET /calculation_algorithms.json def index @calculation_algorithms = CalculationAlgorithm.all end # GET /calculation_algorithm...
require 'test_helper' module M2R class ExamplesTest < MiniTest::Unit::TestCase include MongrelHelper def test_rack_example user = TestUser.new user.visit("/handler") user.see!("SENDER", "PATH", "HEADERS", "x-forwarded-for", "x-forwarded-for", "BODY") end def test_handler_example ...
# -*- mode: ruby -*- # vi: set ft=ruby : Vagrant.configure("2") do |config| # Utilisation de la boxe que nous avons choisi d'utiliser config.vm.box = "generic/debian10" # Dans le cas d'une construction d'image personnel, le paramètre config.vm.box_url est à utiliser si vous souhaitez mettre l'image ailleurs ...
module Alumina # A molecule as represented by HIN data, consisting of multiple {Atom Atoms}. class Molecule include Alumina::HIN::Writer::Molecule # @return [Fixnum] The unique numerical identifier for this molecule. attr_accessor :id # @return [String, nil] The optional label given to th...
class DummyStock < ActiveRecord::Base validates :stock_id, numericality: {only_integer: true, greater_than_or_equal_to: 1 } validates :sale_pladmin_id, numericality: {only_integer: true, greater_than_or_equal_to: 1 } validates :cancel_pladmin_id, numericality: {only_integer: true, greater_than_or_equal_to: 1 } ...
class AddTeamIdToUsers < ActiveRecord::Migration[6.0] def change add_column :users, :team_id, :integer end end #adding team_id column to users #Establish a one-many relationship between the primary and dependent models:
# frozen_string_literal: true require 'test_helper' class Api::FilmsControllerTest < ActionDispatch::IntegrationTest # index test 'GET / - works' do get api_films_url, as: :json assert_equal 200, status end test 'GET / - responds with all films as json' do get api_films_url, as: :json assert_...
class HumanPlayer attr_accessor :name, :mark attr_reader :board def initialize(name) @name = name end def get_input string = gets.chomp.to_s [string[0].to_i, string[-1].to_i] end def get_move p 'where' next_move = get_input until @board.empty?(next_move) puts 'taken. stop ...
require "json" require "retries" module CheetahMail class Segmentation def initialize @segments_url = "https://app.cheetahmail.com/cm/r/segments/active" end def segments @segments ||= begin fail NotAuthorised unless CheetahMail.logged_in? json = AGENT.get_file(@s...
require 'test_helper' class RelationshipTest < ActiveSupport::TestCase def setup @relationship = Relationship.new(follower_id: users(:michael).id, followed_id: users(:archer).id) end teardown do Rails.cache.clear end test "should be valid" do assert @relati...
class AddColumnExchangeOfRateToPurchaseOrders < ActiveRecord::Migration def change add_column :purchase_orders, :exchange_of_rate, :float end end
#!/usr/bin/env ruby class Passport @@field_keys = [:byr, :iyr, :eyr, :hgt, :hcl, :ecl, :pid] def initialize(entry) @fields = {} entry.split.each do |field| matchData = field.match(/(\w{3}):(\S+)/) @fields[matchData[1].to_sym] = matchData[2] end end def valid? return false if !(@@...
class CommentsController < ApplicationController before_action :authenticate_user!, only: :create before_action :set_post, only: :create # POST /comments def create @comment = @post.comments.new(comment_params) if @comment.save flash[:notice] = 'Comment was successfully created.' else f...
require 'test_helper' feature 'Delete an article' do # visitors scenario 'visitors cannot access button to delete an article' do # Given that I am a visitor # When I go to the list of articles visit articles_path # Then I won't have access to a link remove any articles page.wont_have_link 'Cut...
class CreateBooks < ActiveRecord::Migration[5.1] def change create_table :books do |t| t.string :title t.text :description t.decimal :price, precision: 10, scale: 2 t.integer :quantity t.integer :year t.text :materials t.json :dimensions, default: {'H': 0, 'W': 0, 'D': 0}...
class PersonelDetail < ApplicationRecord has_paper_trail belongs_to :user has_one :home_address, dependent: :destroy has_many :family_details, dependent: :destroy has_many :dependent_cards, dependent: :destroy has_many :bank_accounts, dependent: :destroy has_many :investments, dependent: :de...
require 'net/http' require 'rexml/document' require 'action_view' require 'date' require 'pry' require './lib/unique' require './lib/word' require './lib/dictionary' require './lib/letter' require './lib/puzzle' include Unique include REXML include ActionView::Helpers::SanitizeHelper class Solv...
class M1030 attr_reader :options, :name, :field_type, :node def initialize @name = "Number of Venous and Arterial Ulcers: Enter the total number of venous and arterial ulcers present. (M1030)" @field_type = TEXT @node = "M1030" @options = [] @options << FieldOption.new("") end def se...
class User < ActiveRecord::Base before_create :before_create_user #accept_terms attr_accessible(:terms) validates_acceptance_of(:terms, :message=>:accept_terms,:on=>:create) #handle attr_accessible(:handle) validates_uniqueness_of(:handle, :case_sensitive=>false) validates_length_of(:handle,:minimum=>4,...
class CreatePens < ActiveRecord::Migration def change create_table :pens do |t| t.string :name, null: false, default: "unnamed pen" t.string :manufacturer t.text :description t.string :line t.text :filling_mechanism end end end
require 'spec_helper' describe GapIntelligence::Pricing do include_examples 'Record' describe 'attributes' do subject { described_class.new build(:pricing) } it 'has published_date' do expect(subject).to respond_to(:published_date) end it 'has net_price' do expect(subject).to respo...
json.array!(@products) do |product| json.extract! product, :id, :name, :price, :model, :asin, :mrp, :sale, :link, :source json.url product_url(product, format: :json) end
# frozen_string_literal: true module Cloudcost # InfluxDB output methods for the ServerList class module VolumeInfluxdbOutput def totals_influx_line_protocol lines = [] tag_set = [ "profile=#{@options[:profile] || "?"}", "state=#{volumes_attached_state}" ] metrics = calc...
# encoding: utf-8 class Login < SitePrism::Page set_url '/login' element :username, 'input[ng-model="user.name"]' element :password, 'input[ng-model="user.password"]' element :loginBtn, '.main-button' def loginIn(user, pass) username.set user password.set pass ...
# frozen_string_literal: true # filename: login_page.rb require_relative 'base_page' # Login class to deal with tectonic login page class Login < BasePage include RSpec::Matchers USERNAME_INPUT = { id: 'login' }.freeze PASSWORD_INPUT = { id: 'password' }.freeze SUBMIT_INPUT = { ...
Brymck::Application.routes.draw do scope "(:locale)", :locale => /en|ja/ do # Languages (must come before resources :code) scope "/code" do resources :languages end # Generic resources resources :code, :comments # Post resources resources :posts do member do put :publ...
# == Schema Information # # Table name: users # # id :integer not null, primary key # first_name :string(255) # last_name :string(255) # radius_name :string(255) # password_digest :string(255) # remember_token :string(255) # admin :boolean default(FALSE) # ...
require 'rails_helper' RSpec.describe User, type: :model do context "super administrator" do it "is correctly validates super_administrator role" do # Returns a saved User instance user = create(:user, role: :super_administrator) expect(user.super_administrator?).to be true ...
class AddOrderinfoToCustomers < ActiveRecord::Migration def change add_column :customers, :productname, :string add_column :customers, :productnumber, :integer end end
require 'spec_helper' require_relative '../lib/documentation_finder.rb' describe DocumentationFinder do it 'should find all documentation markdown files that exists' do entries = ['source/doc1.html.md', 'source/doc2.html.md', 'source/doc3.html.md'] expect(Dir).to receive(:glob) ...
# # Author:: Seth Chisamore <schisamo@opscode.com> # Cookbook Name:: mediawiki # Recipe:: db_bootstrap # # Copyright 2011, Opscode, 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 # # ...
class Subject < ApplicationRecord has_many :lessons validates :title, presence: true validates :explanation, presence: true validates :order, presence: true end
class Game < ApplicationRecord has_many :tiles has_many :players, through: :tiles # Randomly generate board def generate_board self.size ||= 8 map_size = self.size * self.size heights = generate_tile_heights(map_size) # Assign heights to tiles (0...map_size).each do |i| Tile.create(g...
module Builderscon class Base def self.connection @@connection ||= Faraday.new(url: 'http://api.dev.builderscon.io:8080') do |faraday| faraday.request :url_encoded faraday.response :logger faraday.adapter Faraday.default_adapter faraday.basic_auth(ENV['BUILDERSCON_KEY'], EN...
require 'rubygems' require 'bundler/setup' namespace :scan do COUNT_FILES = 0 COUNT_LINES = 1 def scan(path, lines, counter = 0) entries = Dir.new(path).reject { |x| %w[. ..].include? x } entries.map! { |x| path.join x } entries.reduce(counter) do |count, item| if File.directory? item ...
module ApplicationHelper def fa(icon_key, additional_class = nil) content_tag :i, "", class: "fa fa-#{icon_key.to_s} #{additional_class}" end def checkmark(text = nil, state = false) out = state ? fa("check-circle", "success fa-lg") : fa(:minus, "muted fa-lg") out += content_tag(:span, text, class: ...
require_relative '../../minitest_helper' module WWIT module Archive class TestOptions < MiniTest::Test include TestSetup def setup @options = Options.parse() end def test_options_defaults Options.default_options.each_key do |key| assert_equal Options.default_op...
class Grouping < ActiveRecord::Base belongs_to :audit_strc_type has_many :audit_fields has_many :field_enumerations, through: :audit_fields has_many :audit_field_values, through: :audit_fields validates :name, presence: true validates :display_order, presence: true, uniqueness: ...
class WithdrawPossibilitiesService attr_reader :amount def initialize(amount) @amount = amount end def self.call(...) new(...).call end def call possibilities = if amount >= 20 [ cash_possibility(value: amount), cash_possib...
class RepliesController < ApplicationController before_action :set_reply, only: [:show, :edit, :update, :destroy] before_action :set_artical, only: [:show, :edit, :update, :destroy] def new @reply = Reply.new end def index @replies = Reply.All end def show end def creat...
#! /usr/bin/env ruby require "json" require "algoliasearch" require "open-uri" #### #### LAUNCH #### if ARGV.length != 3 $stderr << "usage: push.rb APPLICATION_ID API_KEY INDEX\n" exit 1 end #### #### HELPER METHODS #### def get_price_range price case price when 0..50 "1 - 50" when 50..100 "50 - 100" w...
class BillCalculator # 招待コードは500円引き INVITATION_CODE_DISCOUNT = 500 attr_accessor :user, :code, :used_point, :payed_amount, :add_user_point, :invitation_code, :is_code_used def initialize(user, total_amount, code, used_point) @user = user @code = code @used_point = used_point @payed_amount = to...
require 'rdf' require 'rdf/spec' require 'rdf/ntriples' share_as :RDF_Mutable do include RDF::Spec::Matchers before :each do raise '+@filename+ must be defined in a before(:each) block' unless instance_variable_get('@filename') raise '+@repository+ must be defined in a before(:each) block' unless instanc...
class RenameQustionnairesToQuestionnaires < ActiveRecord::Migration[6.0] def change rename_table :qustionnaires, :questionnaires end end
# frozen_string_literal: true # Stores product information class Product < ApplicationRecord monetize :price_cents end
module DamperRepairReport class PhotoPage include Report::PhotoPageWritable def initialize(record, options = {}, group_name, facility_name) @record = record @options = options @group_name = group_name @facility_name = facility_name end def write(pdf) super pdf...
redis_url = if Rails.env.production? 'redis://localhost:6379/0' elsif Rails.env.development? 'redis://localhost:6379/0' else 'redis://localhost:6379/0' end Sidekiq.configure_server do |config| config.redis = { url: redis_url } end Sidekiq.configure_client do |config| config.redis = {...
class Alien < ApplicationRecord has_many :cows, dependent: :nullify end
# RESULTS DESCRIPTION # current user status Then /^account stays inactive$/ do User.find_by_email(@user.email).should_not be_active end Then /^account is activated$/ do User.find_by_email(@user.email).should be_active end # activation code status Then /^activation code is set$/ do User.find_by_email(...
module FeatureHelper def new_timestamp @time ||= Time.now.to_i end def user_register(user) @register_page = RegisterPage.new @register_page.load @register_page.login_field.set user @register_page.password_field.set '1234qwer' @register_page.password_confirmation_field.set '1234qwer' @r...
module Adminpanel class TestObject < ActiveRecord::Base include Adminpanel::Base has_and_belongs_to_many :categories, join_table: "adminpanel_test_object_category" mount_images :textfiles def self.form_attributes [ { 'name' => { 'type' => 'text_field', ...
require File.dirname(__FILE__) + '/../test_helper' class StrategyTest < ActiveSupport::TestCase fixtures :products, :cobrands, :sources, :users def test_clean_review_not_quarantined review_params = { :sound_bite => 'Functional test review sound bite', :content => str_of_size(255), :...
Rails.application.routes.draw do mount Adminio::Engine => "/adminio" end
require "spec_helper" describe Redson::Model do let(:model) { Redson::Model.new } it "knows how to prase keys from Rails style nested name attribute strings" do to_keys = model.parse_keys("student[name][age]") expect(to_keys).to eq(["student", "name", "age"]) end context "api calls" do it "ap...
module Matrons module Profiles class Edit < AbstractView def form alternative_form_for :matron_update_profile, rh.matrons_profile_path, method: :patch, values: {matron_update_profile: matron_update_profile} do input_field(self, label_text: Matron::UpdateProfile.translate(:identifier), fiel...
class Api::ProjectsController < Api::ApplicationController def index @projects = Project.search(params[:search]).result(distinct: true). page(params[:page]).per(params[:per]) respond_with(@projects.map do |project| { id: project.id, title: project.title, group: project...
class User < ActiveRecord::Base validates :email, presence: true def self.from_slack(info_hash) user = find_or_initialize_by(email: info_hash['email']) user.name = info_hash['name'] user end def auth_token AuthToken.encode(user_id: id) end end
class Api::V4::CallResultTransformer < Api::V4::Transformer class << self def from_request(call_result_payload, fallback_facility_id: nil) super(call_result_payload) .then { |payload| add_fallback_patient_id(payload) } .then { |payload| add_fallback_facility_id(payload, fallback_facility_id)...
require 'spec_helper' describe Tribunal do it { should validate_presence_of(:name) } it { should validate_presence_of(:code) } it { should validate_uniqueness_of(:name) } it { should validate_uniqueness_of(:code) } it { should have_and_belong_to_many(:users) } end
class Race < ApplicationRecord belongs_to :user has_many :trainings has_many :workouts, through: :trainings validates :title, :distance, :category, presence: true # 2021-01-15 02 validates :distance, numericality: { message: "%{value} must be a number" } # 2021-01-15 02 validate :not_a_duplica...
class GregorianCalendar < Calendar DEFAULT_OPTIONS = {:year_starts_in => :january, # Starting month :week_starts_on => :sunday, # For week calculations :year => -1, # Which fiscal year? -1 mean...
# == Schema Information # # Table name: depusers # # id :integer not null, primary key # username :string not null # created_at :datetime not null # updated_at :datetime not null # deleted_at :datetime indexed # # Indexes # # index_depusers_on_deleted_at (dele...
# frozen_string_literal: true module Mutations class CancelSaleOfVariant < BaseMutation # arguments passed to the `resolved` method argument :variant_id, ID, required: true argument :location_id, ID, required: true argument :inventory_item_condition_name, String, required: true # return type from...
class InterviewsController < ApplicationController before_action :set_user, only: [:index, :show] before_action :correct_user, only: [:destroy] before_action :different_user, only: [:approve] before_action :set_interview, only: [:show, :edit, :update, :destroy] def index @interviews = @user.interviews.or...
require 'spec_helper' describe Squab::Event do it "Makes an event object" do se = Squab::Event.new('Some string', 'http://foo.com', 'test', 'rspec') expect(se.value).to eq 'Some string' expect(se.url).to eq 'http://foo.com' expect(se.uid).to eq 'test' expect(se.source).to eq 'rspec' end it "...
require 'test_helper' class WordTest < ActiveSupport::TestCase def test_word_is_english_and_spanish word = Word.new english: 'never', spanish:'nunca' assert_equal 'never', word.english assert_equal 'nunca', word.spanish end fixtures :words # Check if Word.random generates a random numbre (model's...
require 'adapter' require 'memcached' module Adapter module Memcached def read(key) decode(client.get(key_for(key))) rescue ::Memcached::NotFound end def write(key, value) client.set(key_for(key), encode(value)) end def delete(key) read(key).tap { client.delete(key_for(key...
require 'spec_helper' describe 'reprepro::update' do let :default_params do { :basedir => '/var/packages', :name => 'lenny-backports', :suite => 'lenny', :repository => 'dev', :url => 'http://backports.debian.org/debian-backports', :filter_name => 'l...
class Banner < Draco::Entity component Size, width: 520, height: 120 component Rotation, angle: 0 component Sprite, path: 'sprites/kenney-ui-pack/red_panel.png', color: '#ffffff'.to_color component Centered component Visible component Duration, ticks: 30 def self.notify(ticks = 30...
class DashboardsController < ApplicationController load_and_authorize_resource def show @dashboard = Dashboard.find(params[:id]) end def index @dashboards = current_user.dashboards respond_to do |format| format.html{} format.json{render json: @dashboards, status: :ok } end end ...
#!/usr/bin/env ruby require_relative 'led_3fet' if __FILE__ == $0 then options = { :address => 0x8a # Use the spi_3fets board by default } options[:address] = ARGV[1] if ARGV[1] led = RGBLed.new options puts "Current color:", " RGB: #{led.get_rgb}", " HSV: #{led.get_hsv}" puts "Starting color wheel rotat...
class Unit < ActiveRecord::Base has_many :drivers has_many :vehicle_issues scope :active, where(:active => true) scope :inactive, where(:active => false) def to_s number.to_s end end
require_relative 'questions_database' require_relative 'question' require_relative 'user' class QuestionFollow attr_accessor :question_id, :follower_id attr_reader :id def self.find_by_id(id) data = QuestionsDBConnection.instance.execute(<<-SQL, id) SELECT * FROM question_follow...
require 'json' channel = RabbitMq.consumer_channel queue = channel.queue('geocoding', durable: true) queue.subscribe(manual_ack: true) do |delivery_info, properties, payload| Thread.current[:request_id] = properties.headers['request_id'] payload = JSON(payload) coordinates = Geocoder.geocode(payload['city']) ...
require 'tmpdir' mainjs = File.read(Capybara::Poltergeist::Client::PHANTOMJS_SCRIPT) def patch_js_file(file, pattern, &blck) js = File.read(file) js.gsub!(pattern, &blck) patch_path = "#{Dir.tmpdir}/poltergeist_patch_#{File.basename(file)}" File.open(patch_path, 'w') do |file| file.write js end patch...
module InContact class Contacts < TokenAuthenticatedResource def active connection.get("contacts/active") end end end
module GitHub class HTTP def self.github login = Setting.by_key('github_username') password = Setting.by_key('github_password') github = Octokit::Client.new(:login => login, :password => password) end def self.add_hook(project) hook_url = Setting.by_key('lurch_url').to_s + '/...
class BeatsController < ApplicationController before_action :set_beat, only: %i[ show edit update destroy ] # GET /beats or /beats.json def index @beats = Beat.all end # GET /beats/1 or /beats/1.json def show end # GET /beats/new def new @beat = Beat.new end # GET /beats/1/edit def e...
# # Copyright 2009 Huygens Instituut for the History of the Netherlands, Den Haag, The Netherlands. # # This file is part of New Women Writers. # # New Women Writers is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundat...
# encoding: UTF-8 namespace :seed do desc "Fix mode of new Japanese" task :fix_mode_of_new_jp => :environment do mode = Mode.where(label: "ファイル編集").first_or_create! VimCommand.update_all("mode_id = #{mode.id}", "id between 3937 and 3944") end end
class IndustriesController < ApplicationController before_action :set_industry, only: [:show] # GET /industries # GET /industries.json def index @industry = params[:industry] @super = params[:super_sector] @sector = params[:sector] @sub = params[:sub_sector] if !@industry.blank? @...
me = 31 puts me > 40 ? "You're getting old" : "You're not that old" def splat_method(*parameters) parameters.each do |x| puts "You entered #{x}" end end splat_method("clay", "jordan", "ashley") clayton = 4 puts clayton if clayton > 3 clayton_object = { name: "Clayton", height: 72, weight: 187 } clayt...
# frozen_string_literal: true require 'uploadcare' module Uploadcare module Param # This header is added to track libraries using Uploadcare API class UserAgent # Generate header from Gem's config # # @example Uploadcare::Param::UserAgent.call # UploadcareRuby/3.0.0-dev/Pubkey_(Rub...
# frozen_string_literal: true require 'test_helper' class UsersLoginTest < ActionDispatch::IntegrationTest def setup @user = users(:test1) end test 'signed in user is redirected to root_path' do get new_user_session_path assert_equal 200, status @david = User.create(email: 'david@mail.com', pas...
require 'logger' require_relative 'domain' class World require_relative 'world_controller' include WorldController # Runs once at initialization def initialize @logger = Logger.new(STDOUT) @entities = {} end # Runs once on graceful shutdown def shutdown end # Runs each frame def frame ...
# Cookbook Name:: genome_scipy_app # Attribute:: default # # Copyright 2017, Tyrone Saunders. All Rights Reserved. #################### # Data Bag Secrets # #################### if Chef::Config[:solo] default['secrets']['aws'] = Chef::DataBagItem.load('secrets', 'aws') default['secrets']['github'] = Chef::DataBagI...
class RemoveColumnPartnairId < ActiveRecord::Migration[5.2] def change remove_column :rewards, :partnairs_id end end
class Api::V1::DispatcherController < ActionController::API def show if dispatcher? render json: DispatcherSerializer.new(@user).serialized_json else render status: 403, json: {message: "Unauthorized"} end end def update # is this needed? if this_dispatcher? @user = User.fi...
require 'spec_helper' describe RemoteNode do let(:user) { User.make! } it "should be invalid without a name, deployment and user" do remote_node = RemoteNode.new() remote_node.should have(1).error_on(:name) remote_node.should have(1).error_on(:user_id) remote_node.should have(1).error_on(:deployme...
class DropEmployeeSkillsInterestedIn < ActiveRecord::Migration def up drop_table :employee_skills_interested_in end def down end end
FactoryBot.define do factory :contact do name 'test' sequence(:code) { |n| "test#{n}" } phone '+123.456789' email 'test@test.com' street 'test' city 'test' zip 12345 country_code 'EE' ident '37605030299' ident_type 'priv' ident_country_code 'EE' registrar factory :...