source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
mattfawcett/litmus
https://github.com/mattfawcett/litmus
lib/litmus/test.rb
Ruby
mit
19
master
668
module Litmus class Test < Base def self.list get('/tests.xml')["test_sets"] end def self.show(id) get("/tests/#{id}.xml")["test_set"] end def self.rename(id, new_name) builder = Builder::XmlMarkup.new builder.instruct! :xml, :version=>"1.0" builder.test_set do |tes...
github
tonyta/active_model_serializers_matchers
https://github.com/tonyta/active_model_serializers_matchers
active_model_serializers_matchers.gemspec
Ruby
mit
19
master
1,170
# encoding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'active_model_serializers_matchers/version' Gem::Specification.new do |spec| spec.name = "active_model_serializers_matchers" spec.version = ActiveModelSerializersMatchers::VER...
github
tonyta/active_model_serializers_matchers
https://github.com/tonyta/active_model_serializers_matchers
spec/active_model_serializers_matchers_spec.rb
Ruby
mit
19
master
744
require 'spec_helper' describe ActiveModelSerializersMatchers do describe '#have_many' do it 'returns a new AssociationMatcher of type :has_many' do expect(described_class::AssociationMatcher) .to receive(:new).with(:association_root, :has_many) .and_call_original expect(have_many(:a...
github
tonyta/active_model_serializers_matchers
https://github.com/tonyta/active_model_serializers_matchers
spec/spec_helper.rb
Ruby
mit
19
master
272
require 'coveralls' Coveralls.wear! require 'active_model_serializers' require 'active_model_serializers_matchers' Dir[Pathname(__FILE__).join('../support/**/*.rb')].each { |f| require f } RSpec.configure do |config| config.include ActiveModelSerializersMatchers end
github
tonyta/active_model_serializers_matchers
https://github.com/tonyta/active_model_serializers_matchers
spec/support/shared_examples.rb
Ruby
mit
19
master
7,026
shared_examples 'it has_one :foo' do it 'should pass a have_one :foo expectation' do expectation = have_one(:foo) expect(subject).to expectation expect(expectation.description).to eq('have one :foo') end it 'should fail a have_one :fuu expectation' do expect { expect(subject).to have_one(:f...
github
tonyta/active_model_serializers_matchers
https://github.com/tonyta/active_model_serializers_matchers
spec/support/rspec_fail_matchers.rb
Ruby
mit
19
master
463
module RSpec module Matchers def fail raise_error(RSpec::Expectations::ExpectationNotMetError) end def fail_with(message) raise_error(RSpec::Expectations::ExpectationNotMetError, message) end def fail_matching(message) if String === message regexp = /#{Regexp.escape(mes...
github
tonyta/active_model_serializers_matchers
https://github.com/tonyta/active_model_serializers_matchers
spec/active_model_serializers_matchers/association_matcher_spec.rb
Ruby
mit
19
master
10,416
require 'spec_helper' describe ActiveModelSerializersMatchers::AssociationMatcher do describe 'negated expectations' do let(:serializer) do Class.new(ActiveModel::Serializer) { has_one :foo } end let(:error_class) { ActiveModelSerializersMatchers::NegatedUseNotSupportedError } let(:error_mess...
github
tonyta/active_model_serializers_matchers
https://github.com/tonyta/active_model_serializers_matchers
lib/active_model_serializers_matchers.rb
Ruby
mit
19
master
300
Dir[Pathname(__FILE__).join('../**/*.rb')].each { |f| require f } module ActiveModelSerializersMatchers def have_many(association_root) AssociationMatcher.new(association_root, :has_many) end def have_one(association_root) AssociationMatcher.new(association_root, :has_one) end end
github
tonyta/active_model_serializers_matchers
https://github.com/tonyta/active_model_serializers_matchers
lib/active_model_serializers_matchers/association_matcher.rb
Ruby
mit
19
master
1,020
module ActiveModelSerializersMatchers class AssociationMatcher attr_reader :actual, :root, :type, :checks def initialize(root, type) @root = root @type = type @checks = [AssociationCheck.new(self, type)] end def matches?(actual) @actual = actual.is_a?(Class) ? actual : actual...
github
tonyta/active_model_serializers_matchers
https://github.com/tonyta/active_model_serializers_matchers
lib/active_model_serializers_matchers/negated_use_not_supported_error.rb
Ruby
mit
19
master
215
module ActiveModelSerializersMatchers class NegatedUseNotSupportedError < StandardError def initialize super('negated expectations are not supported by ActiveModelSerializersMatchers') end end end
github
tonyta/active_model_serializers_matchers
https://github.com/tonyta/active_model_serializers_matchers
lib/active_model_serializers_matchers/association_matcher/key_check.rb
Ruby
mit
19
master
845
module ActiveModelSerializersMatchers class AssociationMatcher class KeyCheck attr_reader :matcher, :key def initialize(matcher, key) @matcher = matcher @key = key end def pass? actual_key.to_s == key.to_s end def fail? !pass? end ...
github
tonyta/active_model_serializers_matchers
https://github.com/tonyta/active_model_serializers_matchers
lib/active_model_serializers_matchers/association_matcher/embed_key_check.rb
Ruby
mit
19
master
952
module ActiveModelSerializersMatchers class AssociationMatcher class EmbedKeyCheck attr_reader :matcher, :embed_key def initialize(matcher, embed_key) @matcher = matcher @embed_key = embed_key end def pass? actual_embed_key.to_s == embed_key.to_s end ...
github
tonyta/active_model_serializers_matchers
https://github.com/tonyta/active_model_serializers_matchers
lib/active_model_serializers_matchers/association_matcher/association_check.rb
Ruby
mit
19
master
1,144
module ActiveModelSerializersMatchers class AssociationMatcher class AssociationCheck attr_reader :matcher, :type def initialize(matcher, type) @matcher = matcher @type = type end def pass? return false if matcher.root_association.nil? matcher.root_associa...
github
tonyta/active_model_serializers_matchers
https://github.com/tonyta/active_model_serializers_matchers
lib/active_model_serializers_matchers/association_matcher/serializer_check.rb
Ruby
mit
19
master
946
module ActiveModelSerializersMatchers class AssociationMatcher class SerializerCheck attr_reader :matcher, :serializer def initialize(matcher, serializer) @matcher = matcher @serializer = serializer end def pass? actual_serializer.to_s == serializer.to_s end...
github
jayvdb/jekyll-netlify
https://github.com/jayvdb/jekyll-netlify
jekyll-netlify.gemspec
Ruby
mit
19
main
1,144
lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'jekyll/netlify/version' Gem::Specification.new do |spec| spec.name = 'jekyll-netlify' spec.version = Jekyll::Netlify::VERSION spec.authors = ['John Vandenberg'] spec.email = ...
github
jayvdb/jekyll-netlify
https://github.com/jayvdb/jekyll-netlify
lib/jekyll/netlify/environment.rb
Ruby
mit
19
main
940
module Jekyll module Netlify # :no_doc: class Environment attr_reader :jekyll_env def initialize @netlify_context = ENV['CONTEXT'] if netlify? @jekyll_env = 'production' else @jekyll_env = Jekyll.env end end def prefixed_env ...
github
jayvdb/jekyll-netlify
https://github.com/jayvdb/jekyll-netlify
lib/jekyll/netlify/generator.rb
Ruby
mit
19
main
2,811
require_relative 'environment' module Jekyll module Netlify # Netlify plugin generator class Generator < Jekyll::Generator safe true def generate(site) env = Environment.new if netlify? ENV['JEKYLL_ENV'] = env.jekyll_env site.config['environment'] = env.jekyll_...
github
jayvdb/jekyll-netlify
https://github.com/jayvdb/jekyll-netlify
test/test_netlify.rb
Ruby
mit
19
main
10,002
require 'minitest/autorun' require 'minitest/unit' require 'shoulda' require 'mocha/minitest' require 'jekyll' require 'jekyll-netlify' def jekyll_test_site File.join(File.dirname(__FILE__), 'test_site') end def get_about_page(site) site.pages[0] end class Jekyll::NetlifyTest < Minitest::Test context 'normal b...
github
sensu-plugins/sensu-plugins-pagerduty
https://github.com/sensu-plugins/sensu-plugins-pagerduty
sensu-plugins-pagerduty.gemspec
Ruby
mit
19
master
2,263
lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'date' require_relative 'lib/sensu-plugins-pagerduty' Gem::Specification.new do |s| s.authors = ['Sensu-Plugins and contributors'] s.date = Date.today.to_s s.description ...
github
sensu-plugins/sensu-plugins-pagerduty
https://github.com/sensu-plugins/sensu-plugins-pagerduty
Rakefile
Ruby
mit
19
master
971
require 'bundler/gem_tasks' require 'github/markup' require 'redcarpet' require 'rspec/core/rake_task' require 'rubocop/rake_task' require 'yard' require 'yard/rake/yardoc_task' args = [:spec, :make_bin_executable, :yard, :rubocop, :check_binstubs] YARD::Rake::YardocTask.new do |t| OTHER_PATHS = %w().freeze t.fil...
github
sensu-plugins/sensu-plugins-pagerduty
https://github.com/sensu-plugins/sensu-plugins-pagerduty
bin/mutator-pagerduty-priority-override.rb
Ruby
mit
19
master
2,851
#!/usr/bin/env ruby # # PagerDuty # === # # DESCRIPTION: # This mutator take the Client hash and looks for overrides of the pager_team. # PagerDuty Handler looks for client['pager_team'] to know which pager duty api token to use. # This will allow user to set high and low priority alerts on the client as a whole,...
github
sensu-plugins/sensu-plugins-pagerduty
https://github.com/sensu-plugins/sensu-plugins-pagerduty
bin/handler-pagerduty.rb
Ruby
mit
19
master
5,057
#!/usr/bin/env ruby # # This handler creates and resolves PagerDuty incidents, refreshing # stale incident details every 30 minutes # # Copyright 2011 Sonian, Inc <chefs@sonian.net> # # Released under the same terms as Sensu (the MIT license); see LICENSE # for details. # # Note: The sensu api token could also be confi...
github
sensu-plugins/sensu-plugins-pagerduty
https://github.com/sensu-plugins/sensu-plugins-pagerduty
test/spec_helper.rb
Ruby
mit
19
master
273
# require 'codeclimate-test-reporter' # CodeClimate::TestReporter.start RSpec.configure do |c| c.formatter = :documentation c.color = true end def fixture_path File.expand_path('../fixtures', __FILE__) end def fixture(f) File.new(File.join(fixture_path, f)) end
github
sensu-plugins/sensu-plugins-pagerduty
https://github.com/sensu-plugins/sensu-plugins-pagerduty
test/bin/handler-pagerduty_spec.rb
Ruby
mit
19
master
5,849
require 'json' require_relative '../spec_helper.rb' require_relative '../../bin/handler-pagerduty.rb' # rubocop:disable Style/ClassVars class PagerdutyHandler at_exit do @@autorun = false end def settings @settings ||= JSON.parse(fixture('pagerduty_settings.json').read) end end describe 'Handlers' do...
github
sensu-plugins/sensu-plugins-pagerduty
https://github.com/sensu-plugins/sensu-plugins-pagerduty
test/bin/mutator-pagerduty-priority-override_spec.rb
Ruby
mit
19
master
8,594
require 'json' require_relative '../spec_helper.rb' require_relative '../../bin/mutator-pagerduty-priority-override.rb' describe 'Mutators' do before do @script = File.expand_path('../../bin/mutator-pagerduty-priority-override.rb', File.dirname(__FILE__)) end it 'should pass event through -- critical' do ...
github
seamusabshere/cacheable
https://github.com/seamusabshere/cacheable
Rakefile
Ruby
mit
19
master
1,805
require 'rubygems' require 'rake' begin require 'jeweler' Jeweler::Tasks.new do |gem| gem.name = "cacheable" gem.summary = %Q{DEPRECATED: use the "cache_method" gem instead. Like ActiveSupport::Memoizable, but for caching. Uses Evan Weaver's memcached gem (i.e. libmemcached) for speed.} gem.description...
github
seamusabshere/cacheable
https://github.com/seamusabshere/cacheable
lib/cacheable.rb
Ruby
mit
19
master
5,644
require 'active_support' require 'active_support/version' %w{ active_support/core_ext/object active_support/core_ext/class }.each do |active_support_3_requirement| require active_support_3_requirement end if ActiveSupport::VERSION::MAJOR == 3 require 'set' require 'zlib' unless defined?(MEMCACHED_MAXIMUM_KEY_LE...
github
seamusabshere/cacheable
https://github.com/seamusabshere/cacheable
test/test_cacheable.rb
Ruby
mit
19
master
5,418
require 'helper' # There are two reasons to apologize for these tests: # * Most tests cover multiple things # * ...and all of them refer to Twilight. # Sorry about that. require 'vampire' require 'human' class TestCacheable < Test::Unit::TestCase def setup Cacheable.repository.flush @flush_count = 1 Va...
github
seamusabshere/cacheable
https://github.com/seamusabshere/cacheable
test/test_cacheable_with_memoizable.rb
Ruby
mit
19
master
969
require 'helper' require 'vampire' # in general, these tests are contrived in the sense that you wouldn't want to flush the cache without flushing the memoization, too class TestCacheableWithMemoizable < Test::Unit::TestCase def setup Cacheable.repository.flush end class ElephantVampire < Vampire ext...
github
seamusabshere/cacheable
https://github.com/seamusabshere/cacheable
test/helper.rb
Ruby
mit
19
master
425
require 'rubygems' require 'test/unit' require 'shoulda' require 'ruby-debug' $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $LOAD_PATH.unshift(File.dirname(__FILE__)) require 'cacheable' class Test::Unit::TestCase end # my test stuff starts here require 'memcached' # expects a running memcache...
github
seamusabshere/cacheable
https://github.com/seamusabshere/cacheable
test/test_cacheable_modularity.rb
Ruby
mit
19
master
1,824
require 'helper' class TestCacheableModularity < Test::Unit::TestCase class Dummy def self.cache_key; 'Dummy'; end def cache_key; "Dummy/#{@name}"; end def initialize(name); @name = name; end end should "define cacheify so that it works for 'class' methods" do assert_nothing_raised do cl...
github
seamusabshere/cacheable
https://github.com/seamusabshere/cacheable
test/vampire.rb
Ruby
mit
19
master
1,396
class Vampire extend Cacheable cattr_accessor :enemy_count, :eye_color_count @@enemy_count = 0 @@eye_color_count = 0 class << self def cache_key 'Vampire' end def enemy self.enemy_count += 1 'Children of the Moon' end cacheify :enemy def eye_color(phase) ...
github
seamusabshere/cacheable
https://github.com/seamusabshere/cacheable
test/test_cacheable_registry.rb
Ruby
mit
19
master
2,314
require 'helper' require 'mocha' class TestCacheableRegistry < Test::Unit::TestCase class Dummy def self.cache_key; 'Dummy'; end def cache_key; "Dummy/#{@name}"; end def initialize(name); @name = name; end extend Cacheable class << self def class_method_1; end cacheify :class_method_1...
github
ayushn21/bridgetown-sitemap
https://github.com/ayushn21/bridgetown-sitemap
Rakefile
Ruby
mit
19
main
254
# frozen_string_literal: true require "bundler/gem_tasks" task spec: :test require "rake/testtask" Rake::TestTask.new(:test) do |test| test.libs << "lib" << "test" test.pattern = "test/**/test_*.rb" test.verbose = true test.warning = false end
github
ayushn21/bridgetown-sitemap
https://github.com/ayushn21/bridgetown-sitemap
Gemfile
Ruby
mit
19
main
255
# frozen_string_literal: true source "https://rubygems.org" gemspec gem "bridgetown", ENV["BRIDGETOWN_VERSION"] if ENV["BRIDGETOWN_VERSION"] group :test do gem "minitest" gem "minitest-profile" gem "minitest-reporters" gem "minitest-hooks" end
github
ayushn21/bridgetown-sitemap
https://github.com/ayushn21/bridgetown-sitemap
bridgetown-sitemap.gemspec
Ruby
mit
19
main
884
# frozen_string_literal: true require_relative "lib/bridgetown-sitemap/version" Gem::Specification.new do |spec| spec.name = "bridgetown-sitemap" spec.summary = "Automatically generate a sitemap.xml for your Bridgetown site." spec.version = BridgetownSitemap::VERSION spec.authors = ["Ayush ...
github
ayushn21/bridgetown-sitemap
https://github.com/ayushn21/bridgetown-sitemap
test/helper.rb
Ruby
mit
19
main
887
# frozen_string_literal: true require "minitest/autorun" require "minitest/reporters" require "minitest/hooks/default" require "bridgetown" Bridgetown.begin! require File.expand_path("../lib/bridgetown-sitemap", __dir__) # Report with color. Minitest::Reporters.use! [ Minitest::Reporters::DefaultReporter.new( ...
github
ayushn21/bridgetown-sitemap
https://github.com/ayushn21/bridgetown-sitemap
test/test_sitemap.rb
Ruby
mit
19
main
11,521
# frozen_string_literal: true require "helper" class TestSitemap < BridgetownSitemap::Test def prepare_site Bridgetown.reset_configuration! @config = Bridgetown.configuration( "full_rebuild" => true, "root_dir" => root_dir, "source" => source_dir, "destination" => dest_dir...
github
ayushn21/bridgetown-sitemap
https://github.com/ayushn21/bridgetown-sitemap
lib/bridgetown-sitemap.rb
Ruby
mit
19
main
373
# frozen_string_literal: true require "bridgetown" require "bridgetown-sitemap/builder" require "bridgetown-sitemap/git_inspector" require "bridgetown-sitemap/grouped_resources" require "bridgetown-sitemap/grouped_generated_pages" require "bridgetown/resource/base" Bridgetown.initializer :"bridgetown-sitemap" do |con...
github
ayushn21/bridgetown-sitemap
https://github.com/ayushn21/bridgetown-sitemap
lib/bridgetown/resource/base.rb
Ruby
mit
19
main
302
# frozen_string_literal: true module Bridgetown module Resource class Base def sitemap_last_modified_at ( data.last_modified_at || BridgetownSitemap::GitInspector.new(self).latest_git_commit_date || date )&.to_time end end end end
github
ayushn21/bridgetown-sitemap
https://github.com/ayushn21/bridgetown-sitemap
lib/bridgetown-sitemap/builder.rb
Ruby
mit
19
main
1,864
# frozen_string_literal: true require "fileutils" module BridgetownSitemap class Builder < Bridgetown::Builder def build hook :site, :pre_render, priority: :low do |site| @site = site @site.generated_pages << sitemap unless file_exists?("sitemap.xml") @site.generated_pages << robo...
github
ayushn21/bridgetown-sitemap
https://github.com/ayushn21/bridgetown-sitemap
lib/bridgetown-sitemap/grouped_resources.rb
Ruby
mit
19
main
964
# frozen_string_literal: true module BridgetownSitemap class GroupedResources def initialize(resources) @grouped_resources = resources.group_by do |resource| url = resource.relative_url.to_s locale = resource.data.locale.to_s base_url = locale.empty? ? url : url.sub("/#{locale}/", "...
github
ayushn21/bridgetown-sitemap
https://github.com/ayushn21/bridgetown-sitemap
lib/bridgetown-sitemap/git_inspector.rb
Ruby
mit
19
main
857
# frozen_string_literal: true module BridgetownSitemap class GitInspector def initialize(resource) @resource = resource end def latest_git_commit_date return nil unless git_repo? return nil unless repo_origin? date = cache.getset(@resource.id) do `git log -1 --pretty="fo...
github
ayushn21/bridgetown-sitemap
https://github.com/ayushn21/bridgetown-sitemap
lib/bridgetown-sitemap/grouped_generated_pages.rb
Ruby
mit
19
main
1,046
# frozen_string_literal: true module BridgetownSitemap class GroupedGeneratedPages def initialize(generated_pages) @grouped_generated_pages = generated_pages.group_by do |page| url = if page.respond_to?(:original_resource) && page.original_resource page.original_resource.relative_url.to_s...
github
davidesantangelo/yll
https://github.com/davidesantangelo/yll
Gemfile
Ruby
mit
19
main
2,475
source "https://rubygems.org" ruby "3.4.2" # Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main" gem "rails", "~> 8.0.1" # The modern asset pipeline for Rails [https://github.com/rails/propshaft] gem "propshaft" # Use sqlite3 as the database for Active Record gem "sqlite3", ">= 2.1" # Use th...
github
davidesantangelo/yll
https://github.com/davidesantangelo/yll
app/models/link.rb
Ruby
mit
19
main
2,349
class Link < ApplicationRecord has_secure_password validations: false # Validations validates :url, presence: true, format: { with: URI::DEFAULT_PARSER.make_regexp(%w[http https]), message: "must be a valid HTTP/HTTPS URL" } validates...
github
davidesantangelo/yll
https://github.com/davidesantangelo/yll
app/controllers/application_controller.rb
Ruby
mit
19
main
426
class ApplicationController < ActionController::Base # Only allow modern browsers supporting webp images, web push, badges, import maps, CSS nesting, and CSS :has. allow_browser versions: :modern protect_from_forgery with: :exception, unless: -> { request.format.json? } before_action :set_cache_control_headers...
github
davidesantangelo/yll
https://github.com/davidesantangelo/yll
app/controllers/redirects_controller.rb
Ruby
mit
19
main
952
class RedirectsController < ApplicationController rescue_from ActiveRecord::RecordNotFound, with: :link_not_found before_action :set_link, only: :show before_action :authenticate, only: :show, if: -> { @link.password_digest.present? } after_action :increment_clicks, only: :show, if: -> { response.status == 302 ...
github
davidesantangelo/yll
https://github.com/davidesantangelo/yll
app/controllers/api/v1/links_controller.rb
Ruby
mit
19
main
887
module Api module V1 class LinksController < ApplicationController rate_limit to: 10, within: 3.minutes, only: :create, with: -> { render_rejection :too_many_requests } protect_from_forgery with: :null_session # POST /api/v1/links def create link = Link.new(link_params) if...
github
davidesantangelo/yll
https://github.com/davidesantangelo/yll
config/routes.rb
Ruby
mit
19
main
942
Rails.application.routes.draw do # Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html # Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500. # Can be used by load balancers and uptime monitors to verify that the app is live. get...
github
davidesantangelo/yll
https://github.com/davidesantangelo/yll
config/application.rb
Ruby
mit
19
main
1,111
require_relative "boot" require "rails/all" # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) module Yll class Application < Rails::Application # Initialize configuration defaults for originally generated Rails versi...
github
davidesantangelo/yll
https://github.com/davidesantangelo/yll
db/schema.rb
Ruby
mit
19
main
1,212
# This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # This file is the source Rails uses to define your schema when running `bin/rai...
github
davidesantangelo/yll
https://github.com/davidesantangelo/yll
db/migrate/20250223174204_create_links.rb
Ruby
mit
19
main
369
class CreateLinks < ActiveRecord::Migration[8.0] def change create_table :links do |t| t.string :url t.string :password_digest t.datetime :expires_at t.string :code t.integer :clicks, default: 0 t.timestamps end add_index :links, :url add_index :links, :code, uniq...
github
davidesantangelo/yll
https://github.com/davidesantangelo/yll
spec/rails_helper.rb
Ruby
mit
19
main
3,188
# This file is copied to spec/ when you run 'rails generate rspec:install' require 'spec_helper' ENV['RAILS_ENV'] ||= 'test' require_relative '../config/environment' # Prevent database truncation if the environment is production abort("The Rails environment is running in production mode!") if Rails.env.production? # Un...
github
davidesantangelo/yll
https://github.com/davidesantangelo/yll
spec/models/link_spec.rb
Ruby
mit
19
main
3,876
require "rails_helper" RSpec.describe Link, type: :model do let(:valid_url) { "https://example.com" } let(:valid_attributes) { { url: valid_url, expires_at: 1.day.from_now } } subject { Link.new(valid_attributes) } before do # Stub Faraday.head to simulate a reachable URL for any URL string. allow(Far...
github
davidesantangelo/yll
https://github.com/davidesantangelo/yll
spec/controllers/redirects_controller_spec.rb
Ruby
mit
19
main
2,022
require "rails_helper" RSpec.describe "Redirects", type: :request do let(:link_url) { "https://example.com" } context "when link exists and is not expired" do context "and does not require a password" do let!(:link) { Link.create!(url: link_url, expires_at: 1.day.from_now, code: "DUMMY123") } it ...
github
davidesantangelo/yll
https://github.com/davidesantangelo/yll
spec/controllers/api/v1/links_controller_spec.rb
Ruby
mit
19
main
2,527
require "rails_helper" RSpec.describe "Api::V1::Links", type: :request do let(:valid_url) { "https://example.com" } let(:valid_attributes) { { url: valid_url, expires_at: 1.day.from_now } } let(:invalid_attributes) { { url: "invalid_url" } } describe "POST /api/v1/links" do context "with valid parameters"...
github
discourse/discourse-jwt
https://github.com/discourse/discourse-jwt
plugin.rb
Ruby
mit
19
main
1,062
# frozen_string_literal: true # name: discourse-jwt # about: JSON Web Tokens Auth Provider # version: 0.1 # author: Robin Ward gem "omniauth-jwt2", "0.1.0", require: false require "omniauth/jwt" class JWTAuthenticator < Auth::ManagedAuthenticator def name "jwt" end def register_middleware(omniauth) om...
github
discourse/discourse-jwt
https://github.com/discourse/discourse-jwt
migrate/20200131192600_move_jwt_to_managed_authenticator.rb
Ruby
mit
19
main
590
# frozen_string_literal: true class MoveJwtToManagedAuthenticator < ActiveRecord::Migration[5.2] def up execute <<~SQL INSERT INTO user_associated_accounts ( provider_name, provider_uid, user_id, created_at, updated_at ) SELECT 'jwt', replace(key, 'jwt_user_', ''...
github
evernym/mobile-sdk
https://github.com/evernym/mobile-sdk
examples/ios/MSDKSampleAppObjC/Podfile
Ruby
apache-2.0
19
main
1,257
# Uncomment the next line to define a global platform for your project platform :ios, '11.0' source 'https://cdn.cocoapods.org/' source 'https://gitlab.com/evernym/mobile/mobile-sdk.git' pre_install do |installer| Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dep...
github
evernym/mobile-sdk
https://github.com/evernym/mobile-sdk
examples/ios/MSDKSampleAppSwift/Podfile
Ruby
apache-2.0
19
main
1,302
# Uncomment the next line to define a global platform for your project platform :ios, '11.0' source 'https://cdn.cocoapods.org/' source 'https://gitlab.com/evernym/mobile/mobile-sdk.git' pre_install do |installer| Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dep...
github
drone/homebrew-drone
https://github.com/drone/homebrew-drone
Abstract/abstract-drone.rb
Ruby
apache-2.0
19
master
2,896
require "formula" class AbstractDrone < Formula def self.init homepage "https://github.com/harness/drone-cli" head "https://github.com/harness/drone-cli.git" url artifact_url sha256 sha256sum test do system "#{bin}/drone", "--version" end end def self.curl_cmd c = 'curl -L -s'...
github
drone/homebrew-drone
https://github.com/drone/homebrew-drone
Formula/drone@0.8.rb
Ruby
apache-2.0
19
master
345
require File.expand_path("../../Abstract/abstract-drone", __FILE__) class DroneAT08 < AbstractDrone version "0.8" init url "https://github.com/harness/drone-cli/releases/download/v0.8.6/drone_darwin_amd64.tar.gz" sha256 `curl -L -s https://github.com/harness/drone-cli/releases/download/v0.8.6/drone_checksums.t...
github
drone/homebrew-drone
https://github.com/drone/homebrew-drone
Formula/drone@0.7.rb
Ruby
apache-2.0
19
master
345
require File.expand_path("../../Abstract/abstract-drone", __FILE__) class DroneAT07 < AbstractDrone version "0.7" init url "https://github.com/harness/drone-cli/releases/download/v0.7.0/drone_darwin_amd64.tar.gz" sha256 `curl -L -s https://github.com/harness/drone-cli/releases/download/v0.7.0/drone_checksums.t...
github
drone/homebrew-drone
https://github.com/drone/homebrew-drone
Formula/drone@1.2.rb
Ruby
apache-2.0
19
master
345
require File.expand_path("../../Abstract/abstract-drone", __FILE__) class DroneAT12 < AbstractDrone version "1.2" init url "https://github.com/harness/drone-cli/releases/download/v1.2.4/drone_darwin_amd64.tar.gz" sha256 `curl -L -s https://github.com/harness/drone-cli/releases/download/v1.2.4/drone_checksums.t...
github
drone/homebrew-drone
https://github.com/drone/homebrew-drone
Formula/drone@1.3.rb
Ruby
apache-2.0
19
master
345
require File.expand_path("../../Abstract/abstract-drone", __FILE__) class DroneAT13 < AbstractDrone version "1.3" init url "https://github.com/harness/drone-cli/releases/download/v1.3.3/drone_darwin_amd64.tar.gz" sha256 `curl -L -s https://github.com/harness/drone-cli/releases/download/v1.3.3/drone_checksums.t...
github
drone/homebrew-drone
https://github.com/drone/homebrew-drone
Formula/drone@0.6.rb
Ruby
apache-2.0
19
master
345
require File.expand_path("../../Abstract/abstract-drone", __FILE__) class DroneAT06 < AbstractDrone version "0.6" init url "https://github.com/harness/drone-cli/releases/download/v0.6.0/drone_darwin_amd64.tar.gz" sha256 `curl -L -s https://github.com/harness/drone-cli/releases/download/v0.6.0/drone_checksums.t...
github
drone/homebrew-drone
https://github.com/drone/homebrew-drone
Formula/drone@1.1.rb
Ruby
apache-2.0
19
master
345
require File.expand_path("../../Abstract/abstract-drone", __FILE__) class DroneAT11 < AbstractDrone version "1.1" init url "https://github.com/harness/drone-cli/releases/download/v1.1.4/drone_darwin_amd64.tar.gz" sha256 `curl -L -s https://github.com/harness/drone-cli/releases/download/v1.1.4/drone_checksums.t...
github
drone/homebrew-drone
https://github.com/drone/homebrew-drone
Formula/drone@1.0.rb
Ruby
apache-2.0
19
master
345
require File.expand_path("../../Abstract/abstract-drone", __FILE__) class DroneAT10 < AbstractDrone version "1.0" init url "https://github.com/harness/drone-cli/releases/download/v1.0.8/drone_darwin_amd64.tar.gz" sha256 `curl -L -s https://github.com/harness/drone-cli/releases/download/v1.0.8/drone_checksums.t...
github
drone/homebrew-drone
https://github.com/drone/homebrew-drone
Formula/drone@1.4.rb
Ruby
apache-2.0
19
master
345
require File.expand_path("../../Abstract/abstract-drone", __FILE__) class DroneAT14 < AbstractDrone version "1.4" init url "https://github.com/harness/drone-cli/releases/download/v1.4.0/drone_darwin_amd64.tar.gz" sha256 `curl -L -s https://github.com/harness/drone-cli/releases/download/v1.4.0/drone_checksums.t...
github
drone/homebrew-drone
https://github.com/drone/homebrew-drone
Formula/drone@1.5.rb
Ruby
apache-2.0
19
master
345
require File.expand_path("../../Abstract/abstract-drone", __FILE__) class DroneAT15 < AbstractDrone version "1.5" init url "https://github.com/harness/drone-cli/releases/download/v1.5.0/drone_darwin_amd64.tar.gz" sha256 `curl -L -s https://github.com/harness/drone-cli/releases/download/v1.5.0/drone_checksums.t...
github
drone/homebrew-drone
https://github.com/drone/homebrew-drone
Formula/drone@1.7.rb
Ruby
apache-2.0
19
master
345
require File.expand_path("../../Abstract/abstract-drone", __FILE__) class DroneAT17 < AbstractDrone version "1.7" init url "https://github.com/harness/drone-cli/releases/download/v1.7.0/drone_darwin_amd64.tar.gz" sha256 `curl -L -s https://github.com/harness/drone-cli/releases/download/v1.7.0/drone_checksums.t...
github
drone/homebrew-drone
https://github.com/drone/homebrew-drone
Formula/drone@1.6.rb
Ruby
apache-2.0
19
master
345
require File.expand_path("../../Abstract/abstract-drone", __FILE__) class DroneAT16 < AbstractDrone version "1.6" init url "https://github.com/harness/drone-cli/releases/download/v1.6.0/drone_darwin_amd64.tar.gz" sha256 `curl -L -s https://github.com/harness/drone-cli/releases/download/v1.6.0/drone_checksums.t...
github
kaitai-io/kaitai_struct_ruby_runtime
https://github.com/kaitai-io/kaitai_struct_ruby_runtime
Gemfile
Ruby
mit
19
master
468
# frozen_string_literal: true source 'https://rubygems.org' group :test do # * https://rubygems.org/gems/rantly/versions/3.0.0 requires Ruby >= 3.3.0 # * https://rubygems.org/gems/rantly/versions/2.0.0 requires Ruby >= 2.4.0 # * https://rubygems.org/gems/rantly/versions/1.2.0 requires Ruby >= 0 gem 'rantly', ...
github
kaitai-io/kaitai_struct_ruby_runtime
https://github.com/kaitai-io/kaitai_struct_ruby_runtime
kaitai-struct.gemspec
Ruby
mit
19
master
1,756
# -*- encoding: utf-8 -*- require File.expand_path('../lib/kaitai/struct/struct', __FILE__) Gem::Specification.new do |s| s.name = 'kaitai-struct' s.version = Kaitai::Struct::VERSION s.authors = ['Mikhail Yakshin'] s.email = 'greycat@kaitai.io' s.homepage = 'https://kaitai.io/' s.summary = 'Kaitai Struc...
github
kaitai-io/kaitai_struct_ruby_runtime
https://github.com/kaitai-io/kaitai_struct_ruby_runtime
lib/kaitai/struct/struct.rb
Ruby
mit
19
master
25,958
require 'stringio' module Kaitai module Struct VERSION = '0.11' ## # Common base class for all structured generated by Kaitai Struct. # Stores stream object that this object was parsed from in {#_io}, # stores reference to parent structure in {#_parent} and root # structure in {#_root} and provides a few helper meth...
github
kaitai-io/kaitai_struct_ruby_runtime
https://github.com/kaitai-io/kaitai_struct_ruby_runtime
spec/subio_spec.rb
Ruby
mit
19
master
6,356
require 'kaitai/struct/struct' require 'stringio' RSpec.describe Kaitai::Struct::SubIO do context "in 12345 asking for 234" do before(:each) do parent_io = StringIO.new("12345") @io = Kaitai::Struct::SubIO.new(parent_io, 1, 3) @normal_io = StringIO.new("234") end describe "#seek" do ...
github
kaitai-io/kaitai_struct_ruby_runtime
https://github.com/kaitai-io/kaitai_struct_ruby_runtime
spec/kaitaistream_spec.rb
Ruby
mit
19
master
6,785
require 'kaitai/struct/struct' require 'stringio' require 'socket' require 'fileutils' require 'rspec' # normally not needed, but RubyMine doesn't autocomplete RSpec methods without it require 'rantly' require 'rantly/rspec_extensions' # `.dup` is needed in Ruby 1.9, otherwise `RuntimeError: can't modify frozen Strin...
github
sidoh/easy_upnp
https://github.com/sidoh/easy_upnp
easy_upnp.gemspec
Ruby
mit
19
master
944
$:.push File.expand_path('../lib', __FILE__) require "easy_upnp/version" Gem::Specification.new do |gem| gem.name = 'easy_upnp' gem.version = EasyUpnp::VERSION gem.summary = "A super easy to use UPnP control point client" gem.authors = ['Christopher Mullins'] gem.email = 'chris@sidoh.org' gem.hom...
github
sidoh/easy_upnp
https://github.com/sidoh/easy_upnp
lib/easy_upnp/options_base.rb
Ruby
mit
19
master
825
module EasyUpnp class OptionsBase class Builder attr_reader :options def initialize(supported_options) @options = {} supported_options.each do |k| define_singleton_method("#{k}=") { |v| @options[k] = v } define_singleton_method("#{k}") do |&block| @opt...
github
sidoh/easy_upnp
https://github.com/sidoh/easy_upnp
lib/easy_upnp/ssdp_searcher.rb
Ruby
mit
19
master
2,887
require 'socket' require 'ipaddr' require 'timeout' require 'easy_upnp/upnp_device' module EasyUpnp class SsdpSearcher # These are dictated by the SSDP protocol and cannot be changed MULTICAST_ADDR = '239.255.255.250' MULTICAST_PORT = 1900 DEFAULT_OPTIONS = { # Number of seconds to wait for...
github
sidoh/easy_upnp
https://github.com/sidoh/easy_upnp
lib/easy_upnp/upnp_device.rb
Ruby
mit
19
master
2,231
require 'uri' require 'nori' require 'open-uri' require 'savon' require 'easy_upnp/control_point/device_control_point' module EasyUpnp class UpnpDevice attr_reader :uuid, :host def initialize(uuid, service_definitions) @uuid = uuid @service_definitions = service_definitions end def sel...
github
sidoh/easy_upnp
https://github.com/sidoh/easy_upnp
lib/easy_upnp/events/event_parsers.rb
Ruby
mit
19
master
398
require 'nokogiri' module EasyUpnp class DefaultEventParser def parse(event_xml) x = Nokogiri::XML(event_xml) prop_changes = x.xpath('//e:propertyset/e:property/*', e: 'urn:schemas-upnp-org:event-1-0').map do |n| [n.name.to_sym, n.text] end Hash[prop_changes] end end cla...
github
sidoh/easy_upnp
https://github.com/sidoh/easy_upnp
lib/easy_upnp/events/event_client.rb
Ruby
mit
19
master
2,655
require 'net/http' module EasyUpnp class EventClient class SubscriptionError < StandardError; end def initialize(events_endpoint) @events_endpoint = URI(events_endpoint) end def subscribe(callback, timeout: 300) req = SubscribeRequest.new( @events_endpoint, callback, ...
github
sidoh/easy_upnp
https://github.com/sidoh/easy_upnp
lib/easy_upnp/events/http_listener.rb
Ruby
mit
19
master
2,036
require 'webrick' require 'thread' require 'easy_upnp/events/event_parsers' module EasyUpnp class HttpListener class Options < EasyUpnp::OptionsBase DEFAULTS = { # Port to listen on. Default value "0" will cause OS to choose a random # ephemeral port listen_port: 0, # Addr...
github
sidoh/easy_upnp
https://github.com/sidoh/easy_upnp
lib/easy_upnp/events/subscription_manager.rb
Ruby
mit
19
master
3,741
module EasyUpnp class Options < EasyUpnp::OptionsBase DEFAULTS = { ## # Number of seconds to request our event subscription be active for. The # server can set it to whatever it wants. requested_timeout: 300, ## # Number of seconds before a subscription expires before we reque...
github
sidoh/easy_upnp
https://github.com/sidoh/easy_upnp
lib/easy_upnp/control_point/service_method.rb
Ruby
mit
19
master
2,638
module EasyUpnp class ServiceMethod attr_reader :name, :in_args, :out_args def initialize(name, in_args, out_args, arg_references) @name = name @in_args = in_args @out_args = out_args @arg_references = arg_references end def call_method(client, args_hash, validator_provider) ...
github
sidoh/easy_upnp
https://github.com/sidoh/easy_upnp
lib/easy_upnp/control_point/argument_validator.rb
Ruby
mit
19
master
3,855
module EasyUpnp class ArgumentValidator class Builder def initialize(&block) @validators = {} block.call(self) if block end def in_range(min, max, step = 1) add_validator(RangeValidator.new((min..max).step(step))) end def allowed_values(*values) add_...
github
sidoh/easy_upnp
https://github.com/sidoh/easy_upnp
lib/easy_upnp/control_point/device_control_point.rb
Ruby
mit
19
master
5,926
require 'nokogiri' require 'open-uri' require 'nori' require 'easy_upnp/control_point/validator_provider' require 'easy_upnp/control_point/client_wrapper' require 'easy_upnp/control_point/service_method' require 'easy_upnp/events/event_client' require 'easy_upnp/events/http_listener' require 'easy_upnp/events/subscri...
github
sidoh/easy_upnp
https://github.com/sidoh/easy_upnp
lib/easy_upnp/control_point/validator_provider.rb
Ruby
mit
19
master
939
require 'easy_upnp/control_point/argument_validator' module EasyUpnp module ValidatorProvider def self.no_op_provider NoOpValidatorProvider.new end def self.from_xml(xml) validators = {} xml.xpath('//serviceStateTable/stateVariable').each do |var| name = var.xpath('name').text...
github
sidoh/easy_upnp
https://github.com/sidoh/easy_upnp
lib/easy_upnp/control_point/client_wrapper.rb
Ruby
mit
19
master
1,563
module EasyUpnp class ClientWrapper def initialize(endpoint, urn, call_options, advanced_typecasting, log_enabled, log_level, cookies) # For some reason was not able to pass these options in th...
github
vyorkin-personal/synchronisable
https://github.com/vyorkin-personal/synchronisable
Gemfile
Ruby
mit
19
master
237
source 'https://rubygems.org' gemspec gem 'pry' gem 'byebug' gem 'pry-byebug' group :test, :development do gem 'pre-commit' end group :test do gem 'coveralls', require: false gem 'codeclimate-test-reporter', require: false end
github
vyorkin-personal/synchronisable
https://github.com/vyorkin-personal/synchronisable
synchronisable.gemspec
Ruby
mit
19
master
2,274
lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'synchronisable/version' Gem::Specification.new do |spec| spec.name = 'synchronisable' spec.version = Synchronisable::VERSION::STRING spec.platform = Gem::Platform::RUBY spec.authors ...
github
vyorkin-personal/synchronisable
https://github.com/vyorkin-personal/synchronisable
Guardfile
Ruby
mit
19
master
310
# A sample Guardfile # More info at https://github.com/guard/guard#readme guard :rspec, cmd: 'bundle exec rspec', all_on_start: false, all_after_pass: false do watch(%r{^spec/.+_spec\.rb$}) watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } watch('spec/spec_helper.rb') { "spec" } end
github
vyorkin-personal/synchronisable
https://github.com/vyorkin-personal/synchronisable
Rakefile
Ruby
mit
19
master
626
require 'rake' require 'bundler/gem_tasks' require 'rspec/core/rake_task' RSpec::Core::RakeTask.new(:spec) def run_in_dummy_app(command) success = system("cd spec/dummy && #{command}") raise "#{command} failed" unless success end task default: :ci task test: :spec desc 'Run all tests for CI' task ci: %w(db:setu...
github
vyorkin-personal/synchronisable
https://github.com/vyorkin-personal/synchronisable
spec/spec_helper.rb
Ruby
mit
19
master
1,877
require "codeclimate-test-reporter" CodeClimate::TestReporter.start ENV['RAILS_ENV'] ||= 'test' require 'database_cleaner' require 'factory_girl' require 'factory_girl_sequences' if ENV['COVERAGE'] require 'simplecov' SimpleCov.start end if ENV['TRAVIS'] require 'coveralls' Coveralls.wear! end $LOAD_PATH.u...
github
vyorkin-personal/synchronisable
https://github.com/vyorkin-personal/synchronisable
spec/factories/match.rb
Ruby
mit
19
master
245
FactoryGirl.define do factory :match do association :home_team, :factory => :team association :away_team, :factory => :team weather { generate :string } beginning { Time.current - rand(200).minutes - 100.minutes } end end
github
vyorkin-personal/synchronisable
https://github.com/vyorkin-personal/synchronisable
spec/factories/player.rb
Ruby
mit
19
master
251
FactoryGirl.define do factory :player do first_name { generate :string } last_name { generate :string } birthday { generate :date } citizenship { generate :string } height { rand } weight { rand } end end
github
vyorkin-personal/synchronisable
https://github.com/vyorkin-personal/synchronisable
spec/factories/team.rb
Ruby
mit
19
master
284
FactoryGirl.define do factory :team do name { generate :string } trait :with_stadium do association :stadium end trait :with_players do after(:build) do |object, evaluator| create_list(:player, 11, :team => object) end end end end
github
vyorkin-personal/synchronisable
https://github.com/vyorkin-personal/synchronisable
spec/factories/remote/tournament.rb
Ruby
mit
19
master
518
FactoryGirl.define do factory :remote_tournament, class: Hash do tour_id { generate :tournament_id } eman { generate :string } eman_trohs { generate :string } gninnigeb { generate :date } gnidge { generate :date } initialize_with { attributes } trait :with_stages do a...