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
gbiczo/oxcelix
https://github.com/gbiczo/oxcelix
spec/integer_spec.rb
Ruby
mit
19
master
250
require './spec/spec_helper' describe "Integer object" do describe '#col_name' do it "returns a string representing an excel column name" do (0..25).each do |x| x.col_name.should == ('A'..'Z').to_a[x] end end end end
github
gbiczo/oxcelix
https://github.com/gbiczo/oxcelix
spec/sax/shared_strings_spec.rb
Ruby
mit
19
master
656
require './spec/spec_helper' describe Oxcelix::Sharedstrings do describe 'number of elements in shared_strings' do def values_from_oga require 'oga' doc = Oga.parse_xml(File.read('spec/fixtures/shared_strings.xml')) correct_values = doc.xpath('*[local-name() = "sst"]/*[local-name() =...
github
Cirex/padrino-csrf
https://github.com/Cirex/padrino-csrf
padrino-csrf.gemspec
Ruby
mit
19
master
908
# encoding: utf-8 $:.push File.expand_path('../lib', __FILE__) require 'padrino-csrf/version' Gem::Specification.new do |s| s.name = 'padrino-csrf' s.version = Padrino::CSRF::VERSION s.authors = ['Benjamin Bloch'] s.email = ['cirex@gamesol.org'] s.homepage = 'https://github.com/Cirex/...
github
Cirex/padrino-csrf
https://github.com/Cirex/padrino-csrf
Rakefile
Ruby
mit
19
master
679
$LOAD_PATH.unshift File.expand_path('../lib', __FILE__) require 'padrino-csrf/version' require 'rake' require 'yard' require 'rspec' require 'rspec/core/rake_task' RSpec::Core::RakeTask.new do |task| task.pattern = 'spec/**/*_spec.rb' end YARD::Rake::YardocTask.new task :build do `gem build padrino-csrf.gemspec...
github
Cirex/padrino-csrf
https://github.com/Cirex/padrino-csrf
lib/padrino-csrf.rb
Ruby
mit
19
master
732
# encoding: utf-8 require 'padrino-core' require 'padrino-helpers' FileSet.glob_require('padrino-csrf/**/*.rb', __FILE__) module Padrino module CSRF REQUEST_BLACKLIST = %w(POST PUT DELETE) class InvalidToken < RuntimeError def http_status 403 end end class << self # @priv...
github
Cirex/padrino-csrf
https://github.com/Cirex/padrino-csrf
lib/padrino-csrf/routing.rb
Ruby
mit
19
master
1,468
# encoding: utf-8 module Padrino module CSRF module Routing ### # Routing condition which lets you manually toggle CSRF authentication # # @param [Boolean] protect # Should the request be authenticated # # @raise [InvalidToken] # Raised when the CSRF parameter i...
github
Cirex/padrino-csrf
https://github.com/Cirex/padrino-csrf
lib/padrino-csrf/helpers.rb
Ruby
mit
19
master
1,398
# encoding: utf-8 module Padrino module CSRF module Helpers ### # Returns whether or not the CSRF parameter is authentic # # @return [Boolean] # *true* if CSRF is valid, *false* otherwise # # @since 0.1.0 # @api semipublic def csrf_valid? csrf_token =...
github
Cirex/padrino-csrf
https://github.com/Cirex/padrino-csrf
lib/padrino-csrf/form_helpers.rb
Ruby
mit
19
master
584
# encoding: utf-8 module Padrino module CSRF module FormHelpers ### # Returns a hidden HTML input field with this sessions CSRF token # # @return [String] # Generated HTML for hidden CSRF input field # # @since 0.1.0 # @api semipublic def token_field_tag ...
github
Cirex/padrino-csrf
https://github.com/Cirex/padrino-csrf
spec/helpers_spec.rb
Ruby
mit
19
master
2,614
require_relative 'spec' describe Padrino::CSRF::Helpers do include Padrino::Helpers::AssetTagHelpers include Padrino::Helpers::OutputHelpers include Padrino::Helpers::FormHelpers include Padrino::Helpers::TagHelpers include Padrino::CSRF::FormHelpers include Padrino::CSRF::Helpers let :params do {} ...
github
Cirex/padrino-csrf
https://github.com/Cirex/padrino-csrf
spec/spec.rb
Ruby
mit
19
master
424
PADRINO_ENV = 'test' require 'rspec' require 'rspec-html-matchers' require 'rack/test' require 'padrino-csrf' module TestHelpers def app @app ||= Sinatra.new(Padrino::Application) do register Padrino::CSRF set :prevent_request_forgery, true set :logging, false end end end RSpec.configur...
github
Cirex/padrino-csrf
https://github.com/Cirex/padrino-csrf
spec/csrf_spec.rb
Ruby
mit
19
master
2,466
require_relative 'spec' describe Padrino::CSRF do let :random_string do SecureRandom.hex(32) end it 'should validate CSRF tokens for POST requests' do app.post :test do # ... end post '/test', { _csrf_token: random_string }, 'rack.session' => { _csrf_token: random_string } last_respon...
github
tjaartvdwalt/jekyll-org-mode-converter
https://github.com/tjaartvdwalt/jekyll-org-mode-converter
jekyll-org-mode-converter.gemspec
Ruby
mit
19
master
2,314
# Generated by jeweler # DO NOT EDIT THIS FILE DIRECTLY # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec' # -*- encoding: utf-8 -*- # stub: jekyll-org-mode-converter 0.1.7 ruby lib Gem::Specification.new do |s| s.name = "jekyll-org-mode-converter" s.version = "0.1.7" s.required_rubygems_version...
github
tjaartvdwalt/jekyll-org-mode-converter
https://github.com/tjaartvdwalt/jekyll-org-mode-converter
Gemfile
Ruby
mit
19
master
422
source "http://rubygems.org" # Add dependencies required to use your gem here. # Example: # gem "activesupport", ">= 2.3.5" gem 'org-ruby' , '>= 0.9.12' # Add dependencies to develop your gem here. # Include everything needed to run rake, tests, features, etc. group :development do gem "shoulda", ">= 0" gem ...
github
tjaartvdwalt/jekyll-org-mode-converter
https://github.com/tjaartvdwalt/jekyll-org-mode-converter
Rakefile
Ruby
mit
19
master
1,516
# encoding: utf-8 require 'rubygems' require 'bundler' require 'org-ruby' begin Bundler.setup(:default, :development) rescue Bundler::BundlerError => e $stderr.puts e.message $stderr.puts "Run `bundle install` to install missing gems" exit e.status_code end require 'rake' require 'jeweler' Jeweler::Tasks.new...
github
tjaartvdwalt/jekyll-org-mode-converter
https://github.com/tjaartvdwalt/jekyll-org-mode-converter
lib/jekyll-org-mode-converter.rb
Ruby
mit
19
master
371
require 'org-ruby' module Jekyll class UpcaseConverter < Converter safe true priority :low # Match all files that end in .org def matches(ext) ext =~ /^\.org$/i end # Output goes to html def output_ext(ext) ".html" end def convert(content) p = Orgmode::Par...
github
tjaartvdwalt/jekyll-org-mode-converter
https://github.com/tjaartvdwalt/jekyll-org-mode-converter
test/test_jekyll-org-mode-converter.rb
Ruby
mit
19
master
238
require 'helper' class TestJekyllOrgModeConverter < Test::Unit::TestCase should "probably rename this file and start testing for real" do flunk "hey buddy, you should probably rename this file and start testing for real" end end
github
tjaartvdwalt/jekyll-org-mode-converter
https://github.com/tjaartvdwalt/jekyll-org-mode-converter
test/helper.rb
Ruby
mit
19
master
689
require 'simplecov' module SimpleCov::Configuration def clean_filters @filters = [] end end SimpleCov.configure do clean_filters load_adapter 'test_frameworks' end ENV["COVERAGE"] && SimpleCov.start do add_filter "/.rvm/" end require 'rubygems' require 'bundler' begin Bundler.setup(:default, :develop...
github
cotag/http-parser
https://github.com/cotag/http-parser
Rakefile
Ruby
mit
19
master
417
require 'rubygems' require 'rake' require 'rspec/core/rake_task' task :default => [:compile, :test] task :compile do protect = ['http_parser.c', 'http_parser.h'] Dir["ext/http-parser/**/*"].each do |file| begin next if protect.include? File.basename(file) FileUtils.rm file ...
github
cotag/http-parser
https://github.com/cotag/http-parser
http-parser.gemspec
Ruby
mit
19
master
1,101
# frozen_string_literal: true # -*- encoding: utf-8 -*- $:.push File.expand_path("../lib", __FILE__) require "http-parser/version" Gem::Specification.new do |s| s.name = "http-parser" s.version = HttpParser::VERSION s.authors = ["Stephen von Takach"] s.email = ["steve@cotag.me"] s.licen...
github
cotag/http-parser
https://github.com/cotag/http-parser
lib/http-parser.rb
Ruby
mit
19
master
350
# frozen_string_literal: true require "ffi" # Bindings to C libraries require "http-parser/ext" # Loads http-parser ext require "http-parser/errors" # http-parser error definitions require "http-parser/types" # http-parser data structures require "http-parser/parser" # the core http-parser abstr...
github
cotag/http-parser
https://github.com/cotag/http-parser
lib/http-parser/types.rb
Ruby
mit
19
master
8,378
# frozen_string_literal: true module HttpParser HTTP_MAX_HEADER_SIZE = (80 * 1024) # # These share a byte of data as a bitmap # TYPES = enum :http_parser_type, [ :request, 0, :response, :both ] FLAG = { :CHUNKED => 1 << 2, :CONNECTION_KEEP_ALIVE => ...
github
cotag/http-parser
https://github.com/cotag/http-parser
lib/http-parser/parser.rb
Ruby
mit
19
master
8,290
# frozen_string_literal: true module HttpParser class Parser CALLBACKS = [ :on_message_begin, :on_url, :on_status, :on_header_field, :on_header_value, :on_headers_complete, :on_body, :on_message_complete, :on_chunk_header, :on_chunk_complete ] # # Returns a ...
github
cotag/http-parser
https://github.com/cotag/http-parser
lib/http-parser/errors.rb
Ruby
mit
19
master
2,820
# frozen_string_literal: true module HttpParser class Error < StandardError class OK < Error; end # Any callback-related errors class CALLBACK < Error; end # Parsing-related errors class INVALID_EOF_STATE < Error; end class HEADER_OVERFLOW < Error; end clas...
github
cotag/http-parser
https://github.com/cotag/http-parser
ext/Rakefile
Ruby
mit
19
master
215
require 'ffi-compiler/compile_task' FFI::Compiler::CompileTask.new('http-parser-ext') do |t| t.cflags << "-Wall -Wextra -O3" t.cflags << "-D_GNU_SOURCE=1" if RbConfig::CONFIG["host_os"].downcase =~ /mingw/ end
github
cotag/http-parser
https://github.com/cotag/http-parser
spec/error_spec.rb
Ruby
mit
19
master
1,459
require 'http-parser' describe HttpParser::Parser, "#initialize" do before :each do @inst = HttpParser::Parser.new_instance end it "should return true when error" do expect(subject.parse(@inst, "GETS / HTTP/1.1\r\n")).to eq(true) expect(@inst.error?).to eq(true) end it "sh...
github
cotag/http-parser
https://github.com/cotag/http-parser
spec/parser_spec.rb
Ruby
mit
19
master
8,767
require 'http-parser' describe HttpParser::Parser, "#initialize" do before :each do @inst = HttpParser::Parser.new_instance end describe "callbacks" do describe "on_message_begin" do subject do described_class.new do |parser| parser.on_messag...
github
cotag/http-parser
https://github.com/cotag/http-parser
spec/instance_spec.rb
Ruby
mit
19
master
1,998
require 'http-parser' describe ::HttpParser::Instance, "#initialize" do context "when given a block" do it "should yield the new Instance" do expected = nil described_class.new { |inst| expected = inst } expect(expected).to be_kind_of(described_class) end ...
github
bbc/device_api-android
https://github.com/bbc/device_api-android
device_api-android.gemspec
Ruby
mit
19
master
714
Gem::Specification.new do |s| s.name = 'device_api-android' s.version = '1.2.20' s.date = Time.now.strftime("%Y-%m-%d") s.summary = 'Android Device Management API' s.description = 'Android implementation of DeviceAPI' s.authors = ['David Buckhurst','Jitesh Gosai', 'Asim Khan', 'Jon...
github
bbc/device_api-android
https://github.com/bbc/device_api-android
lib/device_api/android.rb
Ruby
mit
19
master
2,723
# Encoding: utf-8 require 'device_api/android/adb' require 'device_api/android/device' require 'device_api/android/signing' # Load plugins require 'device_api/android/plugins/audio' require 'device_api/android/plugins/memory' require 'device_api/android/plugins/battery' require 'device_api/android/plugins/disk' # Loa...
github
bbc/device_api-android
https://github.com/bbc/device_api-android
lib/device_api/android/device.rb
Ruby
mit
19
master
11,134
# Encoding: utf-8 require 'device_api/device' require 'device_api/android/adb' require 'device_api/android/aapt' require 'android/devices' # DeviceAPI - an interface to allow for automation of devices module DeviceAPI # Android component of DeviceAPI module Android # Device class used for containing the access...
github
bbc/device_api-android
https://github.com/bbc/device_api-android
lib/device_api/android/aapt.rb
Ruby
mit
19
master
1,123
# Encoding: utf-8 require 'open3' require 'ostruct' require 'device_api/execution' # DeviceAPI - an interface to allow for automation of devices module DeviceAPI # Android component of DeviceAPI module Android # Namespace for all methods encapsulating aapt calls class AAPT < DeviceAPI::Execution # C...
github
bbc/device_api-android
https://github.com/bbc/device_api-android
lib/device_api/android/adb.rb
Ruby
mit
19
master
14,882
# Encoding: utf-8 # TODO: create new class for aapt that will get the package name from an apk using: JitG # aapt dump badging packages/bbciplayer-debug.apk require 'open3' require 'ostruct' require 'device_api/execution' # DeviceAPI - an interface to allow for automation of devices module DeviceAPI # Android compon...
github
bbc/device_api-android
https://github.com/bbc/device_api-android
lib/device_api/android/signing.rb
Ruby
mit
19
master
4,386
# DeviceAPI - an interface to allow for automation of devices module DeviceAPI # Android component of DeviceAPI module Android # Namespace for all methods encapsulating adb calls class Signing < Execution # Creates a keystore used for signing apks # @param [Hash] options options to pass through...
github
bbc/device_api-android
https://github.com/bbc/device_api-android
lib/device_api/android/device/kindle.rb
Ruby
mit
19
master
809
module DeviceAPI module Android # Kindle specific device class class Kindle < Device # On non-Kindle devices, if a device is locked without a password (i.e. 'Swipe to unlock'), then # you can unlock that device by broadcasting a 'WakeUp' intent. On Kindle devices, this does not # work due to...
github
bbc/device_api-android
https://github.com/bbc/device_api-android
lib/device_api/android/device/samsung.rb
Ruby
mit
19
master
505
module DeviceAPI module Android # Samsung specific device class class Samsung < Device def initialize(options = {}) super packages = list_installed_packages multi_window = 'com.sec.android.app.FlashBarService' if packages.include?("package:#{multi_window}") # S...
github
bbc/device_api-android
https://github.com/bbc/device_api-android
lib/device_api/android/plugins/disk.rb
Ruby
mit
19
master
927
module DeviceAPI module Android module Plugin class Disk attr_reader :qualifier def initialize(options = {}) @qualifier = options[:qualifier] end def process_stats(options = {}) disk_info = {} stats = options[:data] || ADB.dumpsys(@qualifier, '...
github
bbc/device_api-android
https://github.com/bbc/device_api-android
lib/device_api/android/plugins/audio.rb
Ruby
mit
19
master
1,838
module DeviceAPI module Android module Plugin class Audio attr_reader :qualifier def initialize(options) @qualifier = options #[:serial] end def get_volume_steps audio = ADB.dumpsys( @qualifier, 'audio' ) vol_steps = audio.detect { |a| a.inclu...
github
bbc/device_api-android
https://github.com/bbc/device_api-android
lib/device_api/android/plugins/battery.rb
Ruby
mit
19
master
731
module DeviceAPI module Android module Plugin class Battery attr_reader :current_temp, :max_temp, :max_current, :voltage, :level, :health, :status, :powered def initialize(options = {}) qualifier = options[:qualifier] props = ADB.get_battery_info(qualifier) @cu...
github
bbc/device_api-android
https://github.com/bbc/device_api-android
lib/device_api/android/plugins/memory.rb
Ruby
mit
19
master
2,606
module DeviceAPI module Android # Plugins contain extra information about the attached device(s) module Plugin # Class used to provide information about process memory usage # and device memory usage class Memory # Class used for holding process information class MemInfo ...
github
bbc/device_api-android
https://github.com/bbc/device_api-android
spec/android_audio_spec.rb
Ruby
mit
19
master
1,787
require 'spec_helper' require 'device_api/android' describe DeviceAPI::Android::Plugin::Audio do describe 'Audio functions' do it 'should return volume' do out = <<-EOF volume steps: 19 - STREAM_SYSTEM: Mute count: 0 Current: 2: 19, 40000000: 7, EOF allow(O...
github
bbc/device_api-android
https://github.com/bbc/device_api-android
spec/android_spec.rb
Ruby
mit
19
master
12,361
require 'spec_helper' require 'device_api/android/device' describe DeviceAPI::Android::Device do describe '.model' do it 'Returns model name' do device = DeviceAPI::Android::Device.new(serial: 'SH34RW905290') allow(Open3).to receive(:capture3) { ['[ro.product.model]: [HTC One]\n', '', STAT...
github
bbc/device_api-android
https://github.com/bbc/device_api-android
spec/spec_helper.rb
Ruby
mit
19
master
237
require 'simplecov' SimpleCov.start $LOAD_PATH.unshift('./lib/') ProcessStatusStub = Struct.new(:exitstatus) STATUS_ZERO = ProcessStatusStub.new(0) STATUS_ONE = ProcessStatusStub.new(1) ENV['PATH'] = "./spec/adb_mock/:" + ENV['PATH']
github
bbc/device_api-android
https://github.com/bbc/device_api-android
spec/lib/android/device_spec.rb
Ruby
mit
19
master
2,653
require 'spec_helper' require 'device_api/android' require 'device_api/android/device' describe DeviceAPI::Android do describe '.devices' do it 'Returns an empty array when no devices are connected' do out = <<_______________________________________________________ List of devices attached _____________...
github
bbc/device_api-android
https://github.com/bbc/device_api-android
spec/lib/android/adb_spec.rb
Ruby
mit
19
master
11,048
require 'spec_helper' require 'device_api' require 'device_api/android/adb' # # # FIRST describe DeviceAPI::Android::ADB do describe '.devices' do it 'returns an empty array when there are no devices' do out = <<eos List of devices attached eos allow(Open3).to receive(:capture3) { [out, ''...
github
benbalter/naughty_or_nice
https://github.com/benbalter/naughty_or_nice
naughty_or_nice.gemspec
Ruby
mit
19
master
1,233
# frozen_string_literal: true require File.expand_path('lib/naughty_or_nice/version', __dir__) Gem::Specification.new do |gem| gem.name = 'naughty_or_nice' gem.version = NaughtyOrNice::VERSION # rubocop: disable Metrics/LineLength gem.summary = "You've made the list. We'll help you check it twice. Given a...
github
benbalter/naughty_or_nice
https://github.com/benbalter/naughty_or_nice
lib/naughty_or_nice.rb
Ruby
mit
19
master
2,798
# frozen_string_literal: true require 'public_suffix' require 'addressable/uri' require_relative './naughty_or_nice/version' # Primary module to be mixed into the child class module NaughtyOrNice # Source: http://bit.ly/1n2X9iv EMAIL_REGEX = %r{ ^ ( [\w!\#$%&'*+\-/=?\^`\{|\}~]+ ...
github
benbalter/naughty_or_nice
https://github.com/benbalter/naughty_or_nice
spec/naughty_or_nice_spec.rb
Ruby
mit
19
master
3,630
# frozen_string_literal: true RSpec.describe NaughtyOrNice do subject { TestHelper.new(domain) } let(:domain) { 'example.com' } # Test case => expected response { 'foo@github.gov' => 'github.gov', 'foo.github.gov' => 'foo.github.gov', 'http://github.gov' => 'github.gov', 'https://github.gov' ...
github
benbalter/naughty_or_nice
https://github.com/benbalter/naughty_or_nice
spec/spec_helper.rb
Ruby
mit
19
master
353
# frozen_string_literal: true RSpec.configure do |config| config.example_status_persistence_file_path = 'spec/examples.txt' config.disable_monkey_patching! config.default_formatter = 'doc' if config.files_to_run.one? config.order = :random Kernel.srand config.seed end require 'naughty_or_nice' class TestHe...
github
logstash-plugins/logstash-input-azure_event_hubs
https://github.com/logstash-plugins/logstash-input-azure_event_hubs
logstash-input-azure_event_hubs.gemspec
Ruby
apache-2.0
19
main
1,458
GEM_VERSION = File.read(File.expand_path(File.join(File.dirname(__FILE__), "VERSION"))).strip unless defined?(GEM_VERSION) Gem::Specification.new do |s| s.name = 'logstash-input-azure_event_hubs' s.version = GEM_VERSION s.licenses = ['Apache-2.0'] s.summary = 'Consumes events from Azu...
github
logstash-plugins/logstash-input-azure_event_hubs
https://github.com/logstash-plugins/logstash-input-azure_event_hubs
Gemfile
Ruby
apache-2.0
19
main
371
source 'https://rubygems.org' gemspec logstash_path = ENV['LOGSTASH_PATH'] || '../../logstash' if Dir.exist?(logstash_path) && ENV["LOGSTASH_SOURCE"] == "1" gem 'logstash-core', :path => "#{logstash_path}/logstash-core" gem 'logstash-core-plugin-api', :path => "#{logstash_path}/logstash-core-plugin-api" end if ...
github
logstash-plugins/logstash-input-azure_event_hubs
https://github.com/logstash-plugins/logstash-input-azure_event_hubs
lib/logstash-input-azure_event_hubs.rb
Ruby
apache-2.0
19
main
2,556
# AUTOGENERATED BY THE GRADLE SCRIPT. DO NOT EDIT. require 'jar_dependencies' require_jar('com.microsoft.azure', 'azure-eventhubs-eph', '3.3.0') require_jar('com.microsoft.azure', 'azure-eventhubs', '3.3.0') require_jar('com.microsoft.azure', 'qpid-proton-j-extensions', '1.2.4') require_jar('com.microsoft.azure', 'azu...
github
logstash-plugins/logstash-input-azure_event_hubs
https://github.com/logstash-plugins/logstash-input-azure_event_hubs
lib/logstash/inputs/processor.rb
Ruby
apache-2.0
19
main
3,703
# encoding: utf-8 require "logstash/util/loggable" module LogStash module Inputs module Azure class Processor include LogStash::Util::Loggable include com.microsoft.azure.eventprocessorhost.IEventProcessor def initialize(queue, codec, checkpoint_interval, decorator, meta_data) ...
github
logstash-plugins/logstash-input-azure_event_hubs
https://github.com/logstash-plugins/logstash-input-azure_event_hubs
lib/logstash/inputs/processor_factory.rb
Ruby
apache-2.0
19
main
649
# encoding: utf-8 require "logstash/inputs/processor" module LogStash module Inputs module Azure class ProcessorFactory include com.microsoft.azure.eventprocessorhost.IEventProcessorFactory def initialize(queue, codec, checkpoint_interval, decorator, meta_data) @queue = queue ...
github
logstash-plugins/logstash-input-azure_event_hubs
https://github.com/logstash-plugins/logstash-input-azure_event_hubs
lib/logstash/inputs/azure_event_hubs.rb
Ruby
apache-2.0
19
main
25,768
# encoding: utf-8 require "logstash-input-azure_event_hubs" require "logstash/inputs/base" require "logstash/namespace" require "stud/interval" require "logstash/inputs/processor_factory" require "logstash/inputs/error_notification_handler" require "logstash/inputs/named_thread_factory" require "logstash/inputs/look_ba...
github
logstash-plugins/logstash-input-azure_event_hubs
https://github.com/logstash-plugins/logstash-input-azure_event_hubs
lib/logstash/inputs/error_notification_handler.rb
Ruby
apache-2.0
19
main
663
# encoding: utf-8 require "logstash/util/loggable" module LogStash module Inputs module Azure class ErrorNotificationHandler include java.util.function.Consumer include LogStash::Util::Loggable def initialize @logger = self.logger end def accept(exception...
github
logstash-plugins/logstash-input-azure_event_hubs
https://github.com/logstash-plugins/logstash-input-azure_event_hubs
lib/logstash/inputs/look_back_position_provider.rb
Ruby
apache-2.0
19
main
690
# encoding: utf-8 require "logstash/util/loggable" module LogStash module Inputs module Azure class LookBackPositionProvider java_import com.microsoft.azure.eventhubs.EventPosition java_import java.time.Instant include java.util.function.Function include LogStash::Util::Lo...
github
logstash-plugins/logstash-input-azure_event_hubs
https://github.com/logstash-plugins/logstash-input-azure_event_hubs
lib/logstash/inputs/named_thread_factory.rb
Ruby
apache-2.0
19
main
502
module LogStash module Inputs module Azure class NamedThreadFactory include java.util.concurrent.ThreadFactory java_import java.util.concurrent.atomic.AtomicInteger def initialize(name, id) @name = name @id = id @counter = AtomicInteger.new(-1) ...
github
logstash-plugins/logstash-input-azure_event_hubs
https://github.com/logstash-plugins/logstash-input-azure_event_hubs
spec/inputs/azure_event_hub_spec.rb
Ruby
apache-2.0
19
main
17,515
# encoding: utf-8 require "logstash/devutils/rspec/spec_helper" require "logstash/inputs/azure_event_hubs" java_import com.microsoft.azure.eventprocessorhost.EventProcessorHost java_import com.microsoft.azure.eventprocessorhost.InMemoryCheckpointManager java_import com.microsoft.azure.eventprocessorhost.InMemoryLeaseM...
github
RailsGirlsCPH/mentor-mentee-platform
https://github.com/RailsGirlsCPH/mentor-mentee-platform
server/Gemfile
Ruby
mit
19
master
1,877
source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } ruby '2.6.5' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rack-cors', require: 'rack/cors' gem 'rails', '~> 6.1.5' # Use sqlite3 as the database for Active Record group :development, :test do gem '...
github
RailsGirlsCPH/mentor-mentee-platform
https://github.com/RailsGirlsCPH/mentor-mentee-platform
server/test/test_helper.rb
Ruby
mit
19
master
307
ENV['RAILS_ENV'] ||= 'test' require File.expand_path('../config/environment', __dir__) require 'rails/test_help' class ActiveSupport::TestCase # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. fixtures :all # Add more helper methods to be used by all tests here... end
github
RailsGirlsCPH/mentor-mentee-platform
https://github.com/RailsGirlsCPH/mentor-mentee-platform
server/spec/spec_helper.rb
Ruby
mit
19
master
4,975
# This file was generated by the `rails generate rspec:install` command. Conventionally, all # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. # The generated `.rspec` file contains `--require spec_helper` which will cause # this file to always be loaded, without a need to explicitly require ...
github
RailsGirlsCPH/mentor-mentee-platform
https://github.com/RailsGirlsCPH/mentor-mentee-platform
server/spec/rails_helper.rb
Ruby
mit
19
master
3,125
# This file is copied to spec/ when you run 'rails generate rspec:install' require 'spec_helper' ENV['RAILS_ENV'] ||= 'test' require File.expand_path('../config/environment', __dir__) # Prevent database truncation if the environment is production abort('The Rails environment is running in production mode!') if Rails.en...
github
RailsGirlsCPH/mentor-mentee-platform
https://github.com/RailsGirlsCPH/mentor-mentee-platform
server/spec/swagger_helper.rb
Ruby
mit
19
master
1,318
require 'rails_helper' RSpec.configure do |config| # Specify a root folder where Swagger JSON files are generated # NOTE: If you're using the rswag-api to serve API descriptions, you'll need # to ensure that it's configured to serve Swagger from the same folder config.swagger_root = Rails.root.join('swagger')....
github
RailsGirlsCPH/mentor-mentee-platform
https://github.com/RailsGirlsCPH/mentor-mentee-platform
server/spec/support/controller_spec_helper.rb
Ruby
mit
19
master
598
module ControllerSpecHelper # generate tokens from user id def token_generator(user_id) JsonWebToken.encode(user_id: user_id) end # generate expired tokens from user id def expired_token_generator(user_id) JsonWebToken.encode({ user_id: user_id }, (Time.now.to_i - 10)) end # return valid headers...
github
RailsGirlsCPH/mentor-mentee-platform
https://github.com/RailsGirlsCPH/mentor-mentee-platform
server/spec/factories/api_users.rb
Ruby
mit
19
master
436
FactoryBot.define do factory :api_user do email { Faker::Internet.safe_email } password { Faker::Lorem.word } # Misc doesn't seem to work {Faker::Misc.password} first_name { Faker::Name.first_name } last_name { Faker::Name.last_name } username { Faker::Name.name } city { Faker::Address.city } ...
github
RailsGirlsCPH/mentor-mentee-platform
https://github.com/RailsGirlsCPH/mentor-mentee-platform
server/spec/factories/experiences.rb
Ruby
mit
19
master
640
FactoryBot.define do factory :experience do available_offline { Faker::Boolean.boolean(true_ratio: 1) } available_online { Faker::Boolean.boolean(true_ratio: 1) } # it is invalid for available_offline and available_online to both be set to false. # therefore when generating test data for spec one valu...
github
RailsGirlsCPH/mentor-mentee-platform
https://github.com/RailsGirlsCPH/mentor-mentee-platform
server/spec/factories/wishes.rb
Ruby
mit
19
master
625
FactoryBot.define do factory :wish do available_offline { Faker::Boolean.boolean(true_ratio: 1) } available_online { Faker::Boolean.boolean(true_ratio: 1) } # it is invalid for available_offline and available_online to both be set to false. # therefore when generating test data for spec one value is a...
github
RailsGirlsCPH/mentor-mentee-platform
https://github.com/RailsGirlsCPH/mentor-mentee-platform
server/spec/auth/authorize_api_request_spec.rb
Ruby
mit
19
master
2,270
RSpec.describe AuthorizeApiRequest do # Create test user let(:user) { create(:api_user) } # Mock `Authorization` header let(:header) { { 'Authorization' => token_generator(user.id) } } # Invalid request subject subject(:invalid_request_obj) { described_class.new({}) } # Valid request subject subject(:re...
github
RailsGirlsCPH/mentor-mentee-platform
https://github.com/RailsGirlsCPH/mentor-mentee-platform
server/spec/auth/authenticate_user_spec.rb
Ruby
mit
19
master
897
RSpec.describe AuthenticateUser do # create test user let(:user) { create(:api_user) } # valid request subject subject(:valid_request_auth_obj) { described_class.new(user.email, user.password) } subject(:invalid_request_auth_obj) { described_class.new('foo', 'bar') } # Test suite for AuthenticateUser#call ...
github
RailsGirlsCPH/mentor-mentee-platform
https://github.com/RailsGirlsCPH/mentor-mentee-platform
server/spec/requests/api/v1/programminglanguages_spec.rb
Ruby
mit
19
master
5,937
RSpec.describe Api::V1::ProgramminglanguagesController, type: :request do # initialize test data let!(:api_user) { create(:api_user) } let(:authorization) { token_generator(api_user.id) } let!(:programminglanguages) { create_list(:programminglanguage, 10) } let(:programminglanguage_id) { programminglanguages....
github
RailsGirlsCPH/mentor-mentee-platform
https://github.com/RailsGirlsCPH/mentor-mentee-platform
server/spec/requests/api/v1/wishes_spec.rb
Ruby
mit
19
master
8,726
RSpec.describe Api::V1::WishesController, type: :request do # initialize test data let!(:api_user) { create(:api_user) } let!(:programminglanguage) { create(:programminglanguage) } let!(:meetinginterval) { create(:meetinginterval) } let!(:wishes) do create_list( :wish, 5, api_user_id: ap...
github
RailsGirlsCPH/mentor-mentee-platform
https://github.com/RailsGirlsCPH/mentor-mentee-platform
server/spec/requests/api/v1/experiences_spec.rb
Ruby
mit
19
master
8,347
RSpec.describe Api::V1::ExperiencesController, type: :request do # initialize test data let!(:api_user) { create(:api_user) } let!(:programminglanguage) { create(:programminglanguage) } let!(:meetinginterval) { create(:meetinginterval) } let!(:experiences) { create_list(:experience, 5, api_user_id: api_user.i...
github
RailsGirlsCPH/mentor-mentee-platform
https://github.com/RailsGirlsCPH/mentor-mentee-platform
server/spec/requests/api/v1/profiles_spec.rb
Ruby
mit
19
master
4,263
# # Decided not to use mocking, but this could be changed in the future. Mocking could allow test to be independent of functionality of authorisation behaviour. # # example # allow(feed).to receive(:fetch).and_return("imagine I'm a JSON string") # feed.fetch # => "imagine I'm a JSON string" # example for authorisation ...
github
RailsGirlsCPH/mentor-mentee-platform
https://github.com/RailsGirlsCPH/mentor-mentee-platform
server/spec/requests/api/v1/api_users_spec.rb
Ruby
mit
19
master
5,267
RSpec.describe Api::V1::ApiUsersController, type: :request do # initialize test data let!(:api_user_list) { create_list(:api_user, 2) } let!(:api_user_id) { api_user_list.first.id } let!(:authorization) { token_generator(api_user_id) } describe 'ApiUsers API', capture_examples: true do path '/api/v1/sign...
github
RailsGirlsCPH/mentor-mentee-platform
https://github.com/RailsGirlsCPH/mentor-mentee-platform
server/spec/requests/api/v1/meetingintervals_spec.rb
Ruby
mit
19
master
5,784
RSpec.describe Api::V1::MeetingintervalsController, type: :request do # initialize test data let!(:api_user) { create(:api_user) } let(:authorization) { token_generator(api_user.id) } let!(:meetingintervals) { create_list(:meetinginterval, 10) } let(:meetinginterval_id) { meetingintervals.first.id } descri...
github
RailsGirlsCPH/mentor-mentee-platform
https://github.com/RailsGirlsCPH/mentor-mentee-platform
server/spec/models/experience_spec.rb
Ruby
mit
19
master
2,034
RSpec.describe Experience, type: :model do let!(:api_user) do create(:api_user, mentee: true) end let!(:prog) { create(:programminglanguage) } let!(:meet) { create(:meetinginterval) } describe 'validations' do subject do create(:experience, api_user_id: api_user.id, pr...
github
RailsGirlsCPH/mentor-mentee-platform
https://github.com/RailsGirlsCPH/mentor-mentee-platform
server/spec/models/api_user_spec.rb
Ruby
mit
19
master
1,065
RSpec.describe ApiUser, type: :model do # Association test # ensure an item record has 1:m relationship with the *** model describe 'validations' do subject { build(:api_user, mentor: false, mentee: false) } # Validation test it { is_expected.to have_many(:wishes).dependent(:destroy) } it { is_e...
github
RailsGirlsCPH/mentor-mentee-platform
https://github.com/RailsGirlsCPH/mentor-mentee-platform
server/spec/models/wish_spec.rb
Ruby
mit
19
master
1,790
RSpec.describe Wish, type: :model do let!(:api_user) do create(:api_user, mentee: true) end let!(:prog) { create(:programminglanguage) } let!(:meet) { create(:meetinginterval) } describe 'validations' do subject { create(:wish, api_user_id: api_user.id, programminglanguage_id: prog.id, meetinginterva...
github
RailsGirlsCPH/mentor-mentee-platform
https://github.com/RailsGirlsCPH/mentor-mentee-platform
server/db/schema.rb
Ruby
mit
19
master
3,075
# 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
RailsGirlsCPH/mentor-mentee-platform
https://github.com/RailsGirlsCPH/mentor-mentee-platform
server/db/seeds.rb
Ruby
mit
19
master
2,993
ApiUser.destroy_all Meetinginterval.destroy_all Programminglanguage.destroy_all Wish.destroy_all Experience.destroy_all users = ApiUser.create!([ { first_name: 'Mary', last_name: 'Black', city: 'Dublin', mentor...
github
RailsGirlsCPH/mentor-mentee-platform
https://github.com/RailsGirlsCPH/mentor-mentee-platform
server/db/migrate/20200127185634_create_experiences.rb
Ruby
mit
19
master
420
# This migration creates experiences table in database class CreateExperiences < ActiveRecord::Migration[6.0] def change create_table :experiences do |t| t.boolean :available_offline t.boolean :available_online t.string :qualification t.belongs_to :api_user, foreign_key: true t.refer...
github
RailsGirlsCPH/mentor-mentee-platform
https://github.com/RailsGirlsCPH/mentor-mentee-platform
server/db/migrate/20200314184044_add_foreign_key_constraint_to_active_storage_attachments_for_blob_id.active_storage.rb
Ruby
mit
19
master
413
# This migration comes from active_storage (originally 20180723000244) class AddForeignKeyConstraintToActiveStorageAttachmentsForBlobId < ActiveRecord::Migration[6.0] def up return if foreign_key_exists?(:active_storage_attachments, column: :blob_id) return unless table_exists?(:active_storage_blobs) ad...
github
RailsGirlsCPH/mentor-mentee-platform
https://github.com/RailsGirlsCPH/mentor-mentee-platform
server/db/migrate/20191020165743_create_wishes.rb
Ruby
mit
19
master
396
# This migration creates wishes table in database class CreateWishes < ActiveRecord::Migration[6.0] def change create_table :wishes do |t| t.boolean :available_offline t.boolean :available_online t.string :goal t.belongs_to :api_user, foreign_key: true t.references :programminglangua...
github
RailsGirlsCPH/mentor-mentee-platform
https://github.com/RailsGirlsCPH/mentor-mentee-platform
server/db/migrate/20190623093635_create_api_users.rb
Ruby
mit
19
master
417
# This migration creates api users table in database class CreateApiUsers < ActiveRecord::Migration[5.2] def change create_table :api_users do |t| t.string :first_name t.string :last_name t.string :username t.string :city t.string :email t.string :password_digest t.boolea...
github
RailsGirlsCPH/mentor-mentee-platform
https://github.com/RailsGirlsCPH/mentor-mentee-platform
server/db/migrate/20191020165447_create_programminglanguages.rb
Ruby
mit
19
master
250
# This migration creates programming languages table in database class CreateProgramminglanguages < ActiveRecord::Migration[6.0] def change create_table :programminglanguages do |t| t.string :language t.timestamps end end end
github
RailsGirlsCPH/mentor-mentee-platform
https://github.com/RailsGirlsCPH/mentor-mentee-platform
server/db/migrate/20191020165516_create_meetingintervals.rb
Ruby
mit
19
master
238
# This migration creates meeting intervals table in database class CreateMeetingintervals < ActiveRecord::Migration[6.0] def change create_table :meetingintervals do |t| t.string :interval t.timestamps end end end
github
RailsGirlsCPH/mentor-mentee-platform
https://github.com/RailsGirlsCPH/mentor-mentee-platform
server/config/routes.rb
Ruby
mit
19
master
716
Rails.application.routes.draw do mount Rswag::Ui::Engine => '/api-docs' mount Rswag::Api::Engine => '/api-docs' post 'auth/login', to: 'authentication#authenticate' namespace :api do namespace :v1 do post 'signup', to: 'api_users#create' resources :programminglanguages resources :meetingi...
github
RailsGirlsCPH/mentor-mentee-platform
https://github.com/RailsGirlsCPH/mentor-mentee-platform
server/config/application.rb
Ruby
mit
19
master
1,096
# #These two lines prevented deployment to heroku, need to look into affect later # require 'dotenv' # Dotenv.load 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 Mentor...
github
RailsGirlsCPH/mentor-mentee-platform
https://github.com/RailsGirlsCPH/mentor-mentee-platform
server/config/initializers/rswag-api.rb
Ruby
mit
19
master
695
Rswag::Api.configure do |c| # Specify a root folder where Swagger JSON files are located # This is used by the Swagger middleware to serve requests for API descriptions # NOTE: If you're using rswag-specs to generate Swagger, you'll need to ensure # that it's configured to generate files in the same folder c....
github
RailsGirlsCPH/mentor-mentee-platform
https://github.com/RailsGirlsCPH/mentor-mentee-platform
server/config/initializers/rswag-ui.rb
Ruby
mit
19
master
555
Rswag::Ui.configure do |c| # List the Swagger endpoints that you want to be documented through the swagger-ui # The first parameter is the path (absolute or relative to the UI host) to the corresponding # endpoint and the second is a title that will be displayed in the document selector # NOTE: If you're using ...
github
RailsGirlsCPH/mentor-mentee-platform
https://github.com/RailsGirlsCPH/mentor-mentee-platform
server/config/environments/production.rb
Ruby
mit
19
master
5,021
Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. config.cache_classes = true # Eager load code on boot. This eager loads most of Rails and # your application in memory, allowing both threaded web serve...
github
RailsGirlsCPH/mentor-mentee-platform
https://github.com/RailsGirlsCPH/mentor-mentee-platform
server/app/lib/message.rb
Ruby
mit
19
master
629
class Message def self.not_found(record = 'record') "Sorry, #{record} not found." end def self.invalid_credentials 'Invalid credentials' end def self.invalid_token 'Invalid token' end def self.missing_token 'Missing token' end def self.unauthorized 'Unauthorized request' end ...
github
RailsGirlsCPH/mentor-mentee-platform
https://github.com/RailsGirlsCPH/mentor-mentee-platform
server/app/lib/json_web_token.rb
Ruby
mit
19
master
671
class JsonWebToken # secret to encode and decode token HMAC_SECRET = Rails.application.secrets.secret_key_base def self.encode(payload, exp = 24.hours.from_now) # set expiry to 24 hours from creation time payload[:exp] = exp.to_i # sign token with application secret JWT.encode(payload, HMAC_SECRE...
github
RailsGirlsCPH/mentor-mentee-platform
https://github.com/RailsGirlsCPH/mentor-mentee-platform
server/app/auth/authorize_api_request.rb
Ruby
mit
19
master
936
class AuthorizeApiRequest def initialize(headers = {}) @headers = headers end # Service entry point - return valid user object def call { user: user } end private attr_reader :headers def user # check if user is in the database # memoize user object @user ||= ApiUser.fi...
github
RailsGirlsCPH/mentor-mentee-platform
https://github.com/RailsGirlsCPH/mentor-mentee-platform
server/app/auth/authenticate_user.rb
Ruby
mit
19
master
555
class AuthenticateUser def initialize(email, password) @email = email @password = password end # Service entry point def call JsonWebToken.encode(user_id: user.id) if user end private attr_reader :email, :password # verify user credentials def user user = ApiUser.find_by(email: ema...
github
RailsGirlsCPH/mentor-mentee-platform
https://github.com/RailsGirlsCPH/mentor-mentee-platform
server/app/models/api_user.rb
Ruby
mit
19
master
577
class ApiUser < ApplicationRecord # encrypt password has_secure_password # Can write model association here for example has_many :wishes, dependent: :destroy has_many :experiences, dependent: :destroy # validation validates_presence_of :email, :password_digest, :username validates :email, uniqueness: ...
github
RailsGirlsCPH/mentor-mentee-platform
https://github.com/RailsGirlsCPH/mentor-mentee-platform
server/app/models/profile.rb
Ruby
mit
19
master
577
class Profile < ApplicationRecord # encrypt password has_secure_password # Can write model association here for example has_many :wishes, dependent: :destroy has_many :experiences, dependent: :destroy # validation validates_presence_of :email, :password_digest, :username validates :email, uniqueness: ...
github
RailsGirlsCPH/mentor-mentee-platform
https://github.com/RailsGirlsCPH/mentor-mentee-platform
server/app/models/experience.rb
Ruby
mit
19
master
731
class Experience < ApplicationRecord belongs_to :api_user belongs_to :programminglanguage delegate :language, to: :programminglanguage belongs_to :meetinginterval delegate :interval, to: :meetinginterval validates_presence_of :qualification validates_presence_of :api_user_id validate :validate_mentee ...
github
RailsGirlsCPH/mentor-mentee-platform
https://github.com/RailsGirlsCPH/mentor-mentee-platform
server/app/models/wish.rb
Ruby
mit
19
master
1,264
class Wish < ApplicationRecord belongs_to :api_user belongs_to :programminglanguage delegate :language, to: :programminglanguage belongs_to :meetinginterval delegate :interval, to: :meetinginterval validates_presence_of :goal validates_presence_of :api_user_id validate :validate_mentee validate :onlin...
github
RailsGirlsCPH/mentor-mentee-platform
https://github.com/RailsGirlsCPH/mentor-mentee-platform
server/app/controllers/authentication_controller.rb
Ruby
mit
19
master
404
class AuthenticationController < ApplicationController # return auth token once user is authenticated skip_before_action :authorize_request, only: :authenticate def authenticate auth_token = AuthenticateUser.new(auth_params[:email], auth_params[:password]).call json_response(auth_token: auth_token)...