text
stringlengths
10
2.61M
require 'spec_helper' describe Moderator::PostsController do render_views include_context 'Moderator signed in' describe '#edit' do let!(:subject) { create(:subject) } let!(:post) { create(:post, subject: subject) } let(:call_request) { get :edit, subject_id: subject.id, id: post.id } context '...
class Recruiter < ActiveRecord::Base has_many :positions validates :name, presence: true validates :name, uniqueness: true end
require 'test_helper' require 'robut/plugin/quips' class Robut::Plugin::QuipsTest < Test::Unit::TestCase def setup @connection = Robut::ConnectionMock.new @presence = Robut::PresenceMock.new(@connection) @plugin = Robut::Plugin::Quips.new(@presence) @plugin.store["quips"] = ["the fancier i try and m...
class UsersController < ApplicationController def index @users = User.with_projects respond_to do |format| format.json { render json: @users.to_json } format.html {} end end def authenticate render json: current_user.to_json end def show @user = User.find(params[:id]) @...
# frozen_string_literal: true require 'test_helper' module Vedeu class ApplicationHelperTestClass include Vedeu::ApplicationHelper end describe ApplicationHelper do let(:described) { Vedeu::ApplicationHelper } let(:included_described) { Vedeu::ApplicationHelperTestClass } let(:incl...
namespace :data do desc <<-HEREDOC This task scrubs the building data by: 1) standardizing the abbreviations (st. vs st vs street, etc.) 2) adding city, state, and BBL (if in New York) to each building 3) associating each user with a building 4) removes duplicates based on zip and street ...
class CreateRewords < ActiveRecord::Migration[5.2] def change default = {total: 0, success: 0} create_table :rewords do |t| t.json "2", default: default t.json "3", default: default t.json "4", default: default t.json "5", default: default t.json "6", default: default t.jso...
require 'spec_helper' module Foortran describe Lexer do let(:lexer) { Lexer.new(source) } let(:source) { get_source_file("helloworld.f90") } describe ".tokenize" do it "returns tokenized source" do expect(Lexer.tokenize(source)).to eq(lexer.tokenize) end end describe ".new"...
require_relative '../../../test_helper' class MomentumCms::Admin::PagesControllerTest < ActionController::TestCase def setup @site = momentum_cms_sites(:default) @page = momentum_cms_pages(:default) @template = momentum_cms_templates(:default) MomentumCms::Page.all.each do |page| page.slug = "...
class ChangeIndexOnVideos < ActiveRecord::Migration def change remove_index :videos, :series_id add_index :videos, :series_id end end
class StoresController < ApplicationController before_action :store_lookup, only: [:show] def index stores = Store.all render json: stores end def show render json: @store end private def store_lookup begin @store = Store.find(params[:id]) rescue ActiveRecord::RecordNotFound...
# encoding: utf-8 #! /usr/bin/env ruby ## # Auteur CrakeTeam # Version 0.1 : Date : Mon Mar 17 09:42 2013 # require 'gtk2' class Dialogue @popup @messageCentre attr_reader :popup, :messageCentre private_class_method :new def initialize(fenetreParent, largeur, hauteur, titre, messag...
Rails.application.routes.draw do namespace :api do namespace :public do get "locations/:country_code", to: "locations#show", as: "location" get "target_groups/:country_code", to: "target_groups#show", as: "target_group" end namespace :private do get "locations/:country_code", to: "locati...
class CategoryListsController < ApplicationController def index @category = PersonalWatchList.find(params[:personal_watchlist_id]).category_lists render json: { category_lists: @category} end def show @category = CategoryList.find(params[:id]) render json: { category: @cat...
require 'json' require 'thor/shell' require 'pry' $stage = ENV.fetch('STAGE', 'dev') def say_status *args @shell ||= Thor::Base.shell.new @shell.say_status *args end @event = <<"EOS" { "Records": [ { "s3": { "s3SchemaVersion": "1.0", "bucket": { "name": "agrishot-#{$stage}-p...
require "csv" class ApplicationDatatable < AjaxDatatablesRails::ActiveRecord extend Forwardable def_delegators :@view, :officer_url, :incident_url, :field_contact_url, :complaint_url, :case_url, :swat_url, :detail_url, :citation_url, :edit_article_url, :signed_in?, :organization_url def initialize(params, opts...
Rails.application.routes.draw do put '/people', to: 'people#update' resources :people # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html end
require "rails_helper" RSpec.describe Payment, type: :model do let(:user) {FactoryBot.create :user} let(:room) {FactoryBot.create :room} let(:booking) {FactoryBot.create :booking, user: user, room: room} describe "validations" do it do should validate_numericality_of(:amount) .is_greater_than(S...
class AddGenerationNumToPokemon < ActiveRecord::Migration[5.2] def change add_column :pokemons, :generation_num, :string end end
# puts "#{__FILE__}" require 'json' class RootController < ApplicationController helpers RootHelper if defined?(RootHelper) get '/' do logger.info "Someone is attempting to GET /" title "Root" erb :'root/index' end get '/env' do title "Environment" erb :'root/env' end get '/prote...
class User < ActiveRecord::Base has_many :albums # Include default devise modules. Others available are: # :token_authenticatable, :confirmable, # :lockable, :timeoutable, :validatable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable # S...
class Trainingsplan < ApplicationRecord belongs_to :user has_many :exercises, through: :collection validates :goal, presence: true end
class ZoneController < ApplicationController include PrivilegeHelper include PmailHelper include ZoneHelper # get zone from id, and topics # @zone # @topics before_action :pre_action_zone, only: [:main, :edit_zone, :update_zone, :destroy_zone, :update_icon] # get topic from id, and get zone from zone_id...
class Survey < ActiveRecord::Base belongs_to :maker, class_name: "User" has_many :taken_surveys has_many :questions has_many :takers, through: :taken_surveys, source: :taker validates :title, presence: :true validates :description, presence: :true def next_question_id(current_question_id = "none") i...
Aws.config[:ec2] = { stub_responses: { describe_vpc_endpoints: { vpc_endpoints: [ { vpc_endpoint_id: 'vpce-123456789abcdefgh', vpc_endpoint_type: 'Gateway', vpc_id: 'vpc-12345678', service_name: 'com.amazonaws.us-east-1.s3', state: 'available', ...
desc "Fill database with ghost users" task :ghosts, [:n_groups, :n_users, :debug] => :environment do |t, args| if args[:n_groups].nil? or args[:n_users].nil? puts "Usage: rake ghost[num_groups,num_users(per group),'debug'(optional)]" exit end csv = File.new("ghosts.csv", "w") csv.write("GroupName,UserID...
# Source: http://www.secg.org/collateral/sec2_final.pdf module ECDSA class Group Secp224k1 = new( name: 'secp224k1', p: 0xFFFFFFFF_FFFFFFFF_FFFFFFFF_FFFFFFFF_FFFFFFFF_FFFFFFFE_FFFFE56D, a: 0, b: 5, g: [0xA1455B33_4DF099DF_30FC28A1_69A467E9_E47075A9_0F7E650E_B6B7A45C, 0x7E0...
require "test_helper" require 'base64' describe Rugged::Repository do describe "packfile stuff" do before do path = File.dirname(__FILE__) + '/fixtures/testrepo.git/' @repo = Rugged::Repository.new(path) end it "can tell if a packed object exists" do assert @repo.exists?("41bc8c69075b...
module Lolita module Configuration module Factory class Field class << self # There are three ways to add field. # *<tt>first</tt> - Pass name and type # Field.add(dbi,"name","type") # *<tt>second</tt> - Pass it through hash # Field.add(dbi,:name => "name"...
class CreateBillings < ActiveRecord::Migration[6.0] def change create_table :billings do |t| t.integer :booking_id t.decimal :total_amount_paid, precision: 10, scale: 2 t.decimal :discount_rate, precision: 10, scale: 2 t.text :details t.timestamps end end end
require 'spec_helper' require 'rails' describe DummyText::Text do it "should get the file position of the template" do DummyText::Text.get_file.should == "./lib/dummy_text/template/text_template.txt" end it "should get the file as a string" do file = Dir.glob(File.dirname(__FILE__) + "/fixtures/sho...
require 'spec_helper' describe "desenvolvedors/new" do before(:each) do assign(:desenvolvedor, stub_model(Desenvolvedor, :nome => "MyString", :endereco => "MyString", :telefone => "MyString", :cpf => "MyString", :rg => "MyString", :dtnascimento => "MyString", :email => "...
class FontSplineSans < Formula head "https://github.com/google/fonts/raw/main/ofl/splinesans/SplineSans%5Bwght%5D.ttf", verified: "github.com/google/fonts/" desc "Spline Sans" desc "Original typeface initiated by the spline team" homepage "https://fonts.google.com/specimen/Spline+Sans" def install (share/...
module Xcprofiler class Execution Struct.new('Position', :path, :line, :column) attr_reader :time, :position, :method_name def initialize(time, position, method_name) @time = time.to_f unless position =~ /<invalid loc>/ path, line, column = position.split(':') @position = Str...
$:.push File.expand_path("../lib", __FILE__) require "shoppe/kiwipay/version" Gem::Specification.new do |s| s.name = "shoppe-kiwipay" s.version = Shoppe::Kiwipay::VERSION s.authors = ["Brendan Kilfoil"] s.email = ["brendan@nakedapps.co.nz"] s.homepage = "http://tryshoppe.com" s.sum...
#!/usr/bin/env ruby require 'rubygems' require 'optparse' require 'narray' require 'adc16' begin require 'pgplot/plotter' rescue LoadError $stderr.puts 'Unable to load the pgplotter gem.' $stderr.puts 'You can install it by running "gem install pgplotter".' exit 1 end include Pgplot OPTS = { :chips => ('...
class AffiliateLink < ActiveRecord::Base belongs_to :user belongs_to :affiliate_link_category alias :category :affiliate_link_category attr_accessible :anchor_text, :keyword, :link, :affiliate_link_category_id validates :anchor_text, :keyword, :link, :affiliate_link_category_id, presence: true validates ...
module Team class CommentsController < ApplicationController before_action :set_chat def create @comment = Comment.create! content: params[:comment][:content], chat: @chat, user_id: @current_user.id end private def set_chat @chat = Chat.find(params[:chat_id]) end end end
# Copyright 2013 Ride Connection # # 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 # # Unless required by applicable law or agreed to in writi...
# -*- encoding : utf-8 -*- class AllowNullValueForGroupIdInGroupInvitations < ActiveRecord::Migration def change change_column_null :group_invitations, :group_id, true end end
# encoding: utf-8 # # © Copyright 2013 Hewlett-Packard Development Company, L.P. # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights #...
require 'date' require 'nokogiri' require_relative '../platform.rb' # Device Config class PlexDeviceConfig < DeviceConfig attr_reader :auth_token def initialize(config) super(config) @auth_token = config['auth_token'] raise "Version check definition for platform '#{PlexPlatform.name}' does not in...
class EntityRepService attr_reader :entity def initialize(entity, push_service, mailer_service) @entity = entity @push_service = push_service @mailer_service = mailer_service end def report raise 'no configs for entity' unless config # TODO: custom result.save if config.keep_history no...
class AddExaminationToCourses < ActiveRecord::Migration def change add_reference :courses, :examination, index: true add_foreign_key :courses, :examinations end end
require 'spec_helper' describe "batch_charities/edit" do before(:each) do @batch_charity = assign(:batch_charity, stub_model(BatchCharity, :batch_id => "", :charity_id => "" )) end it "renders the edit batch_charity form" do render # Run the generator again with the --webrat flag if...
class RemoveCountFromSeenMovie < ActiveRecord::Migration def self.up remove_column :seen_movies, :count end def self.down add_column :seen_movies, :count, :integer end end
class Vote < ApplicationRecord belongs_to :user belongs_to :art, counter_cache: :vote_count end
module Controllers class Application < Sinatra::Base get '/keyboards', auth: :user do serialize(200, current_user.keyboards, serializer: Serializers::Keyboard) end post '/keyboards', auth: :user do required!(:name) keyboard = Models::Keyboard.create!(user_id: current_user.id, name: par...
class Ability include CanCan::Ability def initialize(user) user ||= User.new # Guest User if user.new_record? can :read, :all else # All registered users can [:read, :create], :all # Articles owner can [:update, :destroy], [ArticleDecorator, CommentDecorator, Comment],...
require "spec_helper" describe "practicingruby::_postgresql" do let(:postgresql_version) { "9.1" } let(:postgresql_port) { 5432 } it "installs PostgreSQL server" do expect(package "postgresql-#{postgresql_version}").to be_installed end it "installs PostgreSQL client" do expect(package "postgresql-c...
# frozen_string_literal: true # /lib/sandbox/persistence/repositories/articles.rb module Main module Repositories class Users < Repository[:users] commands :create, :delete def all users.to_a end def find(id) users.by_pk(id).one! end end end end
# This file was generated by GoReleaser. DO NOT EDIT. class Terraformer < Formula desc "A go program that generates terraform using go templates ..." homepage "https://github.com/klaeff/terraformer" url "https://github.com/klaeff/terraformer/releases/download/1.0.6/terraformer_1.0.6_Darwin_x86_64.tar.gz" versio...
require "podio" class PodioAdapter def initialize Podio.setup(api_key: ENV["PB_PODIO_CLIENT_ID"], api_secret: ENV["PB_PODIO_CLIENT_SECRET"]) # Podio.client.authenticate_with_credentials(ENV["PB_PODIO_USERNAME"], ENV["PB_PODIO_PASSWORD"]) Podio.client.authenticate_with_app(ENV["PB_PODIO_APP_ID"], ENV["PB...
# frozen_string_literal: true require 'encase' require 'jiji/configurations/mongoid_configuration' require 'jiji/utils/value_object' require 'jiji/web/transport/transportable' require 'singleton' module Jiji::Model::Trading class Interval include Jiji::Utils::ValueObject include Jiji::Web::Transport::Trans...
class CreateMembers < ActiveRecord::Migration def change create_table :members do |t| t.string :id t.string :password t.string :food t.integer :calorie t.date :date t.string :bld t.timestamps null: false end end end
# 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...
# # This extension stores untranslated keys as translation stubs in the database. This is useful if you have a web based # translation tool. It will populate with untranslated keys as the application is being used. A translator can then go # through these. Example usage: # # I18n::Backend::Chain.send(:include, I...
# frozen_string_literal: true module J8 class BinaryOperator < J8::BiFunction def self.max_by(comparator = nil, &block) callable = from_callable_class(comparator, block, J8::Comparator) J8::BinaryOperator.new(->(a, b) { callable.compare(a, b) <= 0 ? a : b }) end def self.min_by(comparator =...
class Ingredient attr_reader :name, :cost def initialize(name, cost) @name, @cost = name, cost end def ==(other) raise 'Comparable error! Objects have difference type.' unless other.is_a? Ingredient @name == other.name && @cost == other.cost end end
require 'spec_helper' require 'search_videos' describe UsersController do describe "index action for users" do it "should return all videos by default" do video = create(:video) video2 = create(:video) get :index assigns(:videos).should == [video2, video] end it "should return t...
class CreateLicenses < ActiveRecord::Migration[6.0] def change create_table :licenses do |t| t.string :name, null: false t.integer :qty t.text :key t.string :licenser_name t.string :licenser_email t.boolean :reassignable, null: false, default: false t.monetize :cost, amou...
require 'test_helper' class InvoiceIngredientsControllerTest < ActionController::TestCase setup do @invoice_ingredient = invoice_ingredients(:one) end test "should get index" do get :index assert_response :success assert_not_nil assigns(:invoice_ingredients) end test "should get new" do ...
require 'open-uri' require 'nokogiri' require 'pry' class SponsorList def self.fetch document.css(".sponsorList li").each do |html| sponsor_name = html["id"] label = binding.pry end end private def self.document Nokogiri::HTML(open("http://codemash.org/sponsors")) end end cl...
require File.dirname(__FILE__) + '/setup' require 'javaclass/gems/zip_file' module TestJavaClass module TestGems class TestZipFile < Test::Unit::TestCase def setup @folder = "#{TEST_DATA_PATH}/zip_file" end def test_patch_for_invalid_flags assert_two_directories(...
require_relative '../spec_helper' RSpec.describe 'phabricator', type: :class do on_supported_os.each do |os, facts| context "on #{os}" do let(:facts) do facts end it { is_expected.to compile.with_all_deps } describe 'phabricator::config' do it do is_expected.to...
class Users::EventsController < ApplicationController before_action :authenticate_user!, except: [:index] before_action :ensure_correct_user, only: [:update, :edit, :destroy] def new @event = Event.new end def create @event = Event.new(event_params) @event.user_id = current_user.id if @event...
require 'spec_helper' describe DashboardController do describe 'routing' do it 'GET /dashboard' do expect(get '/dashboard').to route_to('dashboard#index') end end end
# Search in a bitonic array. An array is bitonic if it is comprised of an # increasing sequence of integers followed immediately by a decreasing sequence # of integers. Write a program that, given a bitonic array of n distinct integer # values, determines whether a given integer is in the array. # # Standard version: U...
# This class represents a recommendation from a CIS Benchmark. More information about CIS # Benchmarks can be found at https://www.cisecurity.org/cis-benchmarks/. class Control @section_number @title @applicability_level @applicability_description @description @rationale @audit @remediation @impact ...
class TumblrFeed < Feed def get_user_link(name) @tumblr_client = TumblrClient.new_client get_blog(name) [@blog["blog"]["name"], @blog["blog"]["url"]] end def get_pic(uid) @tumblr_client = TumblrClient.new_client @avatar = @tumblr_client.avatar(uid) end def get_blog(name) @tumblr_cli...
# # Be sure to run `pod spec lint TTSource.podspec' to ensure this is a # valid spec and to remove all comments including this before submitting the spec. # # To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html # To see working Podspecs in the CocoaPods repo see https://github.co...
module Mirren module Accounts class Account < BaseStruct attribute :username, Types::String attribute :email, Types::String attribute :withdraw do attribute :BTC do attribute :address, Types::NilOrString attribute :label, Types::NilOrString attribute :auto_p...
module Reportable include ActiveSupport::Concern def to_report self.class.report_attributes.map do |report_attribute| send(report_attribute).to_s end end module ClassMethods def self.report_attributes raise 'Not implemented' end end end
class Membership < ApplicationRecord acts_as_paranoid belongs_to :group belongs_to :user has_many :posts, dependent: :destroy validates_presence_of :token, on: :create validate :token_match, on: :create private def token_match @group_token = Group.find(self.group_id).membership_token ...
require 'csv' module Grocery class Customer attr_reader :id, :email, :delivery_address, :all_info, :customer_information def initialize(id, email, delivery_address) @id = id.to_i @email = email @delivery_address = delivery_address ### Is it necessary to add this customer information ...
class User < ActiveRecord::Base attr_accessible *attribute_names, :login # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable and :omniauthable devise :invitable, :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable,...
class Buy < ApplicationRecord has_one :deliverys belongs_to :user belongs_to :item end
# Binary search tree module BinaryTree def self.from_array(array) Node.new(array.first).tap do |tree| array.each { |v| tree.push v } end end class EmptyNode def to_a [] end def include?(*) false end def push(*) false end alias_method :<<, :push def inspect "{}" end end cl...
require 'test_helper' class UsrsControllerTest < ActionController::TestCase setup do @usr = usrs(:one) end test "should get index" do get :index assert_response :success assert_not_nil assigns(:usrs) end test "should get new" do get :new assert_response :success end test "shoul...
class ChangeTypeTweetId < ActiveRecord::Migration def self.up change_column(:statuses, :tweet_id, :integer, :limit => 8) end def self.down change_column(:statuses, :tweet_id, :float) end end
class EventsController < ApplicationController def index params[:category].present? ? @events = current_user.events.page(params[:page]) : @events = Event.all.page(params[:page]) @event_roles = Membership.where(event_id: @events.ids, user_id: current_user.id).each_with_object({}) {|member, result| r...
class Auto::TestcaseCategoriesController < ApplicationController include Auto # act_as_extjs_direct # GET /testc_categories # GET /testc_categories.xml def tree node_id, options = params[:data] result = if node_id && node_id!='root' father = TestcaseCategory.find(node_id) tree_as_json(fa...
# -*- encoding : utf-8 -*- # The business logic for password management of accounts. # # This code is part of the Stoffi Music Player Project. # Visit our website at: stoffiplayer.com # # Author:: Christoffer Brodd-Reijer (christoffer@stoffiplayer.com) # Copyright:: Copyright (c) 2013 Simplare # License:: GNU General...
require 'spec_helper' describe PostSearchQuery do let(:query) { PostSearchQuery.new } let!(:ira){ FactoryGirl.create(:user, given_name: 'Ira', family_name: 'Kaplan', created_at: 1.day.ago )} let!(:unpublished){ FactoryGirl.create(:post, published_at: nil)} let!(:published_by_ira){ FactoryGirl.create(:post, ...
# Copyright (c) 2016 Scott O'Hara, oharagroup.net # frozen_string_literal: true # Category serializer class CategorySerializer < ActiveModel::Serializer # Only serialize children if eagerly loaded has_many :children, if: -> { !object.parent && object.children.loaded? } attributes :id, :name, :direction, :parent_id,...
require_relative 'spec_helper' describe "Reservation class tests" do before do room_num = 1 room = Hotel::Room.new(room_num) @reserv_data = { id: 1011, room: room, start_date: "2018-03-09", end_date: "2018-03-15", } @reservation = Hotel::Reservation.new(@reserv_data) end...
# frozen_string_literal: true RSpec.describe Minutely::TimeRange do it 'includes Comparable' do expect(described_class).to include Comparable end it 'includes Enumerable' do expect(described_class).to include Enumerable end describe '#initialize' do it 'sets #from from first arg' do from ...
#!/usr/bin/env ruby require 'chef' require 'choice' require 'json' Choice.options do header "" header "Specific options:" option :int_conf do short '-c' long '--knife_conf=PATH_TO_KNIFE_RB' desc 'Knife config file to use for querying chef' default File.expand_path('~/.chef/knife.rb') end ...
FactoryGirl.define do factory :tool do sequence(:title) { |n| "Title#{n}" } url "http://my-tool" body "My tool review." end end
class Product < ApplicationRecord has_many :reviews, dependent: :destroy has_and_belongs_to_many :categories belongs_to :merchant has_many :orderitems, dependent: :destroy has_many :orders, through: :orderitems validates :name, presence: true, uniqueness: true validates :cost, presence: true, numericalit...
FactoryBot.define do factory :device do app user sequence(:name) {|n| "device#{n}" } device_id { Digest::SHA256.hexdigest(FFaker::Internet.email)[0, Device::DEVICE_ID_LEN] } device_id_prefix { device_id[0, Device::DEVICE_ID_PREFIX_LEN] } device_secret { Digest::SHA256.hexdigest(FFake...
When("I visit the landing page") do visit root_path end Then("I should see {string}") do |text| expect(page).to have_content text end When("I click on {string} button") do |button| click_link_or_button button end Then("I should see a list of {string}") do |element| expect(page).to have_element element end
include_recipe 'bcpc-hadoop::hadoop_config' ::Chef::Recipe.send(:include, Bcpc_Hadoop::Helper) ::Chef::Resource::Bash.send(:include, Bcpc_Hadoop::Helper) %w{hadoop-mapreduce-historyserver}.each do |pkg| package hwx_pkg_str(pkg, node[:bcpc][:hadoop][:distribution][:release]) do action :install end hdp_select...
# Copyright (c) 2009-2011 VMware, Inc. require 'httpclient' Given /^I deploy a service demo application using the "([^""]*)" service$/ do |service| expected_health = 1.0 @app = SERVICE_TEST_APP @app_detail = create_app(@app, @token) case service when "mysql" @service_detail = provision_mysql_service(@tok...
# -*- mode: ruby -*- # vi: set ft=ruby : #box general config $mainIp = "192.168.100.10" $hostname = "dev.local" $vhostsAlias = ["site1.dev.local", "site2.dev.local"] $options = { 'multihost' => true, 'xdebug' => true, 'cache' => true, 'phpunit' => true } # perform conditional config Vagrant.configure...
# after_midnight2.rb # As seen in the previous exercise, the time of day can be represented as the # number of minutes before or after midnight. If the number of minutes is # positive, the time is after midnight. If the number of minutes is negative, # the time is before midnight. # Write two methods that each take a ...
class TextShoutsController < ApplicationController include Concerns::CreateShout private def build_content TextShout.new(text_shout_parameters) end def text_shout_parameters params.require(:text_shout).permit(:body) end end
# -*- encoding : utf-8 -*- class OpenSAPChinaConnector < AbstractXikoloConnector NAME = 'openSAP China' ROOT_API = 'https://open.sap.cn/api/' COURSE_LINK = 'https://open.sap.cn/courses/' end
require_relative "../../app/presenters/word_presenter" RSpec.describe WordPresenter do describe "#excerpt" do subject { described_class.new(word).excerpt } let(:word) { double excerpt: "Ich trinke Wasser", content: "Wasser" } it { is_expected.to eq "Ich trinke <strong>Wasser</strong>" } end end
json.array!(@areas) do |area| json.extract! area, :id, :nazwa json.url area_url(area, format: :json) end