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
spree-contrib/spree_email_to_friend
https://github.com/spree-contrib/spree_email_to_friend
spree_email_to_friend.gemspec
Ruby
bsd-3-clause
46
master
1,765
# encoding: utf-8 lib = File.expand_path('../lib/', __FILE__) $LOAD_PATH.unshift lib unless $LOAD_PATH.include?(lib) require 'spree_email_to_friend/version' Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.name = 'spree_email_to_friend' s.version = SpreeEmailToFriend.version s.s...
github
spree-contrib/spree_email_to_friend
https://github.com/spree-contrib/spree_email_to_friend
Rakefile
Ruby
bsd-3-clause
46
master
324
require 'bundler' Bundler::GemHelper.install_tasks require 'rspec/core/rake_task' require 'spree/testing_support/common_rake' RSpec::Core::RakeTask.new task default: [:spec] desc 'Generates a dummy app for testing' task :test_app do ENV['LIB_NAME'] = 'spree_email_to_friend' Rake::Task['common:test_app'].invoke ...
github
spree-contrib/spree_email_to_friend
https://github.com/spree-contrib/spree_email_to_friend
app/mailers/spree/to_friend_mailer.rb
Ruby
bsd-3-clause
46
master
375
class Spree::ToFriendMailer < ActionMailer::Base default from: Spree::Store.current.mail_from_address || '' def mail_to_friend(object, mail) @object = object @mail = mail opts = {} opts[:to] = mail.recipients default_url_options[:host] = mail.host opts[:subject] = mail.subject opts[:r...
github
spree-contrib/spree_email_to_friend
https://github.com/spree-contrib/spree_email_to_friend
app/controllers/spree/email_sender_controller.rb
Ruby
bsd-3-clause
46
master
1,927
class Spree::EmailSenderController < Spree::StoreController # helper Spree::StoreHelper # helper Spree::BaseHelper before_action :find_object def send_mail if request.get? @mail_to_friend = Spree::MailToFriend.new(sender_email: spree_current_user.try(:email)) else mail_to_friend end ...
github
spree-contrib/spree_email_to_friend
https://github.com/spree-contrib/spree_email_to_friend
app/controllers/spree/admin/captcha_settings_controller.rb
Ruby
bsd-3-clause
46
master
363
module Spree module Admin class CaptchaSettingsController < BaseController def update params[:preferences].each do |key, value| Spree::Captcha::Config.set_preference(key, value) end respond_to do |format| format.html { redirect_to edit_admin_captcha_settings_path...
github
spree-contrib/spree_email_to_friend
https://github.com/spree-contrib/spree_email_to_friend
app/models/spree/mail_to_friend.rb
Ruby
bsd-3-clause
46
master
1,651
class Spree::MailToFriend include ActiveModel::Validations include ActiveModel::Conversion attr_accessor :host, :subject, :sender_name, :sender_email, :recipient_name, :recipient_email, :message, :recipients, :invalid_recipients EMAILREGEX = /\A[-a-z0-9_+\.]+\@([-a-z0-9]+\.)+[a-z0-9]{2,8}\z/i validates :sub...
github
spree-contrib/spree_email_to_friend
https://github.com/spree-contrib/spree_email_to_friend
app/models/spree/captcha_configuration.rb
Ruby
bsd-3-clause
46
master
438
class Spree::CaptchaConfiguration < Spree::Preferences::Configuration THEMES = %w(red white blackglass clean custom) # These keys works for localhost. preference :secret_key, :string, default: '6LfIsgEAAAAAAGfB6Z0lEUtdL3GVuBkRa9cYlMZz' preference :site_key, :string, default: '6LfIsgEAAAAAALpT20eiC3RslZQmmCb...
github
spree-contrib/spree_email_to_friend
https://github.com/spree-contrib/spree_email_to_friend
app/overrides/add_captcha_settings_to_admin_configurations_menu.rb
Ruby
bsd-3-clause
46
master
314
Deface::Override.new( virtual_path: 'spree/admin/shared/_configuration_menu', name: 'add_captcha_admin_option', insert_bottom: '[data-hook="admin_configurations_sidebar_menu"]', text: '<%= configurations_sidebar_menu_item Spree.t(:captcha_settings, scope: :captcha), edit_admin_captcha_settings_path %>' )
github
spree-contrib/spree_email_to_friend
https://github.com/spree-contrib/spree_email_to_friend
app/overrides/add_email_to_friend_link_to_products.rb
Ruby
bsd-3-clause
46
master
406
Deface::Override.new( virtual_path: 'spree/products/show', name: 'converted_product_description_351026984', insert_bottom: '[data-hook="product_description"], #product_description[data-hook]', text: '<p class="email_to_friend"><%= link_to Spree.t(:send_to_friend, scope: :email_to_friend), email_to_friend_path("...
github
spree-contrib/spree_email_to_friend
https://github.com/spree-contrib/spree_email_to_friend
spec/spec_helper.rb
Ruby
bsd-3-clause
46
master
769
require 'simplecov' SimpleCov.start 'rails' ENV['RAILS_ENV'] ||= 'test' begin require File.expand_path('../dummy/config/environment', __FILE__) rescue LoadError puts 'Could not load dummy application. Please ensure you have run `bundle exec rake test_app`' exit end require 'rspec/rails' require 'shoulda-matche...
github
spree-contrib/spree_email_to_friend
https://github.com/spree-contrib/spree_email_to_friend
spec/factories/mail_factory.rb
Ruby
bsd-3-clause
46
master
532
FactoryGirl.define do factory :mail, class: Spree::MailToFriend do host 'localhost' sender_name { FFaker::Name.name } sender_email { FFaker::Internet.email(sender_name) } recipient_name { FFaker::Name.name } recipient_email { FFaker::Internet.email(recipient_name)...
github
spree-contrib/spree_email_to_friend
https://github.com/spree-contrib/spree_email_to_friend
spec/support/database_cleaner.rb
Ruby
bsd-3-clause
46
master
386
require 'database_cleaner' RSpec.configure do |config| config.before(:suite) do DatabaseCleaner.clean_with :deletion end config.before do DatabaseCleaner.strategy = :transaction end config.before(:each, :js) do DatabaseCleaner.strategy = :deletion end config.before do DatabaseCleaner.s...
github
spree-contrib/spree_email_to_friend
https://github.com/spree-contrib/spree_email_to_friend
spec/support/spree.rb
Ruby
bsd-3-clause
46
master
400
require 'spree/testing_support/factories' require 'spree/testing_support/controller_requests' require 'spree/testing_support/authorization_helpers' require 'spree/testing_support/url_helpers' RSpec.configure do |config| config.include FactoryGirl::Syntax::Methods config.include Spree::TestingSupport::ControllerReq...
github
spree-contrib/spree_email_to_friend
https://github.com/spree-contrib/spree_email_to_friend
spec/support/captcha.rb
Ruby
bsd-3-clause
46
master
217
RSpec.configure do |config| Recaptcha.configuration.skip_verify_env.delete('test') config.before do # reset captcha config Spree::Captcha::Config.set(Spree::Captcha::Config.default_preferences) end end
github
spree-contrib/spree_email_to_friend
https://github.com/spree-contrib/spree_email_to_friend
spec/models/mail_to_friend_spec.rb
Ruby
bsd-3-clause
46
master
573
RSpec.describe Spree::MailToFriend, type: :model do context 'validate required fields' do it 'verify test data hase been generated' do expect(build(:mail)).to be_valid end end context 'invalid recipents should be removed' do let(:mail) do build(:mail, invalid_recipients: ['invaild']) ...
github
spree-contrib/spree_email_to_friend
https://github.com/spree-contrib/spree_email_to_friend
spec/features/email_sender_spec.rb
Ruby
bsd-3-clause
46
master
1,608
RSpec.feature 'Email to friend', :js do given(:product) { create(:product) } given(:mail) { build(:mail) } background do visit spree.product_path(product) expect(page).to have_text product.name expect(page).to have_link 'Email a friend' end context 'without captcha' do background do ...
github
spree-contrib/spree_email_to_friend
https://github.com/spree-contrib/spree_email_to_friend
spec/features/admin/captcha_settings_spec.rb
Ruby
bsd-3-clause
46
master
595
RSpec.feature 'Admin Captcha Settings', :js do stub_authorization! context 'when update' do background 'visits admin pannel' do visit spree.edit_admin_captcha_settings_path end scenario 'display Captcha Settings on front end' do expect(page).to have_text 'Captcha Settings' choose 'Ye...
github
spree-contrib/spree_email_to_friend
https://github.com/spree-contrib/spree_email_to_friend
spec/controllers/email_sender_controller_spec.rb
Ruby
bsd-3-clause
46
master
420
RSpec.describe Spree::EmailSenderController, type: :controller do let!(:product) { create(:product) } before do allow(controller).to receive(:spree_current_user) { nil } end context '#send_mail' do # can be different types but no clue what they can be except from product specify do spree_get...
github
spree-contrib/spree_email_to_friend
https://github.com/spree-contrib/spree_email_to_friend
spec/controllers/admin/captcha_settings_controller_spec.rb
Ruby
bsd-3-clause
46
master
1,515
RSpec.describe Spree::Admin::CaptchaSettingsController, type: :controller do stub_authorization! before do user = create(:admin_user) allow(controller).to receive(:try_spree_current_user) { user } end context '#update' do it 'redirects to edit captcha settings page' do spree_put :update, pre...
github
spree-contrib/spree_email_to_friend
https://github.com/spree-contrib/spree_email_to_friend
spec/mailers/to_friend_mailer_spec.rb
Ruby
bsd-3-clause
46
master
1,052
RSpec.describe Spree::ToFriendMailer, type: :mailer do let!(:product) { create(:product) } context 'mail content' do let(:mail_object) { build(:mail) } let(:email) { described_class.mail_to_friend(product, mail_object) } it 'is reply to the sender email' do expect(email).to reply_to(mail_o...
github
spree-contrib/spree_email_to_friend
https://github.com/spree-contrib/spree_email_to_friend
lib/spree_email_to_friend/version.rb
Ruby
bsd-3-clause
46
master
331
module SpreeEmailToFriend # Returns the version of the currently loaded SpreeEmailToFriend as a # <tt>Gem::Version</tt>. def self.version Gem::Version.new VERSION::STRING end module VERSION MAJOR = 1 MINOR = 3 TINY = 0 PRE = nil STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')...
github
spree-contrib/spree_email_to_friend
https://github.com/spree-contrib/spree_email_to_friend
lib/spree_email_to_friend/engine.rb
Ruby
bsd-3-clause
46
master
668
require 'recaptcha/rails' module Spree::Captcha end module SpreeEmailToFriend class Engine < Rails::Engine engine_name 'spree_email_to_friend' config.autoload_paths += %W(#{config.root}/lib) initializer 'spree.email_to_friend.preferences', after: 'spree.environment' do Spree::Captcha::Config = S...
github
spree-contrib/spree_email_to_friend
https://github.com/spree-contrib/spree_email_to_friend
config/routes.rb
Ruby
bsd-3-clause
46
master
333
routes = lambda do match '/email_to_friend/:type/:id' => 'email_sender#send_mail', as: :email_to_friend, via: [:get, :post] namespace :admin do resource :captcha_settings end end if Spree::Core::Engine.respond_to?(:add_routes) Spree::Core::Engine.add_routes(&routes) else Spree::Core::Engine.routes.draw(...
github
audy/catsay
https://github.com/audy/catsay
Rakefile
Ruby
mit
46
master
409
desc 'run tests' task :spec do system 'bundle exec rspec' end task default: :spec namespace :gem do spec = Gem::Specification.load('catsay.gemspec') gemfile = "catsay-#{spec.version}.gem" desc 'Build gem' task build: gemfile file gemfile do system 'gem build catsay.gemspec' end desc 'Release ge...
github
audy/catsay
https://github.com/audy/catsay
catsay.gemspec
Ruby
mit
46
master
627
Gem::Specification.new do |s| s.name = 'catsay' s.version = '0.3.2' s.licenses = ['MIT'] s.summary = 'Cats in your terminal' s.description = 'Like cowsay but with cats' s.authors = ['Austin G. Davis-Richardson'] s.email = 'harekrishna@gmail.com' s.files = ['bin/catsay'...
github
audy/catsay
https://github.com/audy/catsay
spec/catsay_spec.rb
Ruby
mit
46
master
233
require 'spec_helper' describe Catsay do let(:kitty) { Catsay::Cat.new(template: '<%= @message %>') } let(:message) { 'Meow, world!' } it 'can meow a message' do expect(kitty.meow(message).strip).to eq(message) end end
github
audy/catsay
https://github.com/audy/catsay
spec/spec_helper.rb
Ruby
mit
46
master
204
require 'bundler' require 'tempfile' $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') require 'catsay' Bundler.require :test, :development Coveralls.wear! RSpec.configure do |_config| end
github
audy/catsay
https://github.com/audy/catsay
spec/cli_spec.rb
Ruby
mit
46
master
694
require 'spec_helper' describe 'CatSay::CLI' do let(:cli) { Catsay::CLI } it 'can list cats (through API)' do expect(cli.send(:cats).size).to_not be(0) end it 'exists' do expect(cli).to_not be(nil) end it '#cats lists all cats in cats/' do expect(cli.cats).to_not be_empty expect(cli.cat...
github
audy/catsay
https://github.com/audy/catsay
lib/catsay.rb
Ruby
mit
46
master
4,395
require 'erb' require 'set' $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__)) require 'cat' require 'exceptions' module Catsay # handle CLI stuff class CLI class << self # - parses command-line arguments # - finds the cat and makes it meow # (or gives an error) def run! ...
github
audy/catsay
https://github.com/audy/catsay
lib/cat.rb
Ruby
mit
46
master
474
module Catsay # Cat class does the meowing. class Cat # create a new instance of cat # :template specifies which template to use # the default template is :default def initialize(kwargs = {}) @template = kwargs[:template] self end # renders the message using an erb template ...
github
benjamintanweihao/code_rippa
https://github.com/benjamintanweihao/code_rippa
code_rippa.gemspec
Ruby
mit
46
master
1,478
# -*- encoding: utf-8 -*- require File.expand_path('../lib/code_rippa/version', __FILE__) Gem::Specification.new do |gem| gem.authors = ["Benjamin Tan Wei Hao"] gem.email = ["benjamintanweihao@gmail.com"] gem.platform = Gem::Platform::RUBY gem.description = %q{Converts source code into a (...
github
benjamintanweihao/code_rippa
https://github.com/benjamintanweihao/code_rippa
lib/code_rippa.rb
Ruby
mit
46
master
10,603
require 'find' require 'code_rippa/uv_overrides' require 'code_rippa/version' require 'ansi' require 'ansi/progressbar' require 'language_sniffer' require 'rainbow' require 'color' require 'ptools' include ANSI YAML::ENGINE.yamler = 'psych' module CodeRippa MAX_WIDTH = 120 @@supported_syntax = nil ...
github
benjamintanweihao/code_rippa
https://github.com/benjamintanweihao/code_rippa
lib/code_rippa/uv_overrides.rb
Ruby
mit
46
master
1,270
require 'uv' # These module monkey patches the original Spox's Ultraviolet, in order # to override defaults. module Uv @@set_table_columns = true Uv.syntax_path = File.join(File.dirname(__FILE__), 'syntax') Uv.render_path = File.join(File.dirname(__FILE__), 'render') Uv.theme_path = File.join(File.dirn...
github
benjamintanweihao/code_rippa
https://github.com/benjamintanweihao/code_rippa
lib/code_rippa/syntax/yaml_converter.rb
Ruby
mit
46
master
874
require 'yaml' require 'syck' require 'fileutils' if ARGV.empty? $stderr.puts "! Must pass one or more filenames to convert from Syck output to Psych output." exit 1 end bad_files = ARGV.select{ |f| ! File.exists?(f) } if bad_files.any? $stderr.puts "! Aborting because the following files do not exist:" $stde...
github
benjamintanweihao/code_rippa
https://github.com/benjamintanweihao/code_rippa
test/test_public_methods.rb
Ruby
mit
46
master
692
require 'minitest/autorun' require 'code_rippa' describe CodeRippa do def fixtures_path File.join(File.expand_path(File.open(".")), "test", "fixtures") end before do Dir.chdir("#{fixtures_path}") end after do File.delete(File.expand_path("out.tex")) Dir.chdir("../..") end #...
github
benjamintanweihao/code_rippa
https://github.com/benjamintanweihao/code_rippa
test/test_private_methods.rb
Ruby
mit
46
master
3,436
require 'minitest/autorun' require 'code_rippa' describe CodeRippa do def fixtures_path File.expand_path("../fixtures", __FILE__) end it "should return a heading color for every syntax file" do Uv.themes.each do |theme| assert_equal 6, CodeRippa.heading_color(theme).length end end ...
github
metaskills/named_seeds
https://github.com/metaskills/named_seeds
Rakefile
Ruby
mit
46
master
309
#!/usr/bin/env rake require "bundler/gem_tasks" require 'rake/testtask' desc 'Test the NamedSeeds gem.' Rake::TestTask.new do |t| t.libs = ['lib','test'] t.test_files = Dir.glob("test/**/*_test.rb").sort t.verbose = true end task :default do exec 'appraisal update' exec 'appraisal rake test' end
github
metaskills/named_seeds
https://github.com/metaskills/named_seeds
Appraisals
Ruby
mit
46
master
212
appraise 'rails40' do gem 'rails', '~> 4.0.0' end appraise 'rails41' do gem 'rails', '~> 4.1.0' end appraise 'rails42' do gem 'rails', '~> 4.2.0' end appraise 'rails50' do gem 'rails', '~> 5.0.0' end
github
metaskills/named_seeds
https://github.com/metaskills/named_seeds
named_seeds.gemspec
Ruby
mit
46
master
1,063
# -*- encoding: utf-8 -*- $:.push File.expand_path("../lib", __FILE__) require "named_seeds/version" Gem::Specification.new do |spec| spec.name = "named_seeds" spec.version = NamedSeeds.version_string spec.authors = ["Ken Collins"] spec.email = ["ken@metaskills.net"] spec.summary...
github
metaskills/named_seeds
https://github.com/metaskills/named_seeds
lib/named_seeds.rb
Ruby
mit
46
master
355
require 'rails' require 'active_record' require 'named_seeds/version' require 'named_seeds/railtie' require 'named_seeds/uuid' require 'named_seeds/dsl' require 'named_seeds/identity' require 'named_seeds/rails' module NamedSeeds extend DSL def self.load_seed Railtie.load_seed end def self.reset_cache ...
github
metaskills/named_seeds
https://github.com/metaskills/named_seeds
lib/named_seeds/identity.rb
Ruby
mit
46
master
1,699
require 'active_record/fixtures' module NamedSeeds class FixtureClassNotFound < ActiveRecord::FixtureClassNotFound end class Identity @@all_cached = Hash.new class << self def reset_cache @@all_cached.clear end def named(name, options={}) @@all_cached[name] ||= new...
github
metaskills/named_seeds
https://github.com/metaskills/named_seeds
lib/named_seeds/dsl.rb
Ruby
mit
46
master
534
require 'zlib' module NamedSeeds module DSL MAX_ID = 2 ** 30 - 1 # Copy of ActiveRecord::Fixtures.identify method. # Returns a consistent, platform-independent identifier for +label+. # Integer identifiers are values less than 2^30. # UUIDs are RFC 4122 version 5 SHA-1 hashes. # def ide...
github
metaskills/named_seeds
https://github.com/metaskills/named_seeds
lib/named_seeds/railtie.rb
Ruby
mit
46
master
1,176
require 'active_record/tasks/database_tasks' module NamedSeeds class Railtie < Rails::Railtie config.named_seeds = ActiveSupport::OrderedOptions.new config.named_seeds.load_app_seed_file = true config.named_seeds.custom_seed_file = nil config.named_seeds.engines_with_load_seed = [] co...
github
metaskills/named_seeds
https://github.com/metaskills/named_seeds
lib/named_seeds/rails.rb
Ruby
mit
46
master
766
require 'active_support/concern' require 'active_support/test_case' module NamedSeeds module TestHelper extend ActiveSupport::Concern def after_teardown super NamedSeeds.reset_cache end module ClassMethods def named_seeds(*names) options = names.extract_options! ...
github
metaskills/named_seeds
https://github.com/metaskills/named_seeds
lib/named_seeds/version.rb
Ruby
mit
46
master
278
module NamedSeeds module VERSION MAJOR = 2 MINOR = 2 TINY = 1 PRE = nil STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".") end def self.version Gem::Version.new VERSION::STRING end def self.version_string VERSION::STRING end end
github
metaskills/named_seeds
https://github.com/metaskills/named_seeds
lib/named_seeds/uuid.rb
Ruby
mit
46
master
511
require 'securerandom' module NamedSeeds # Copy of ActiveSupport's Digest::UUID extension for v5 UUIDs. # Needed to maintain backward compatibility with Rails 4.0 and 4.1. # def self.uuid_v5(name) hash = Digest::SHA1.new hash.update("k\xA7\xB8\x12\x9D\xAD\x11\xD1\x80\xB4\x00\xC0O\xD40\xC8") hash.u...
github
metaskills/named_seeds
https://github.com/metaskills/named_seeds
test/test_helper.rb
Ruby
mit
46
master
1,276
require 'rubygems' require 'bundler' ; Bundler.require :development, :test require 'named_seeds' require 'support/active_record' require 'active_support/test_case' require 'active_support/testing/autorun' ActiveSupport.test_order = :random if ActiveSupport.respond_to?(:test_order) module NamedSeeds class TestCase <...
github
metaskills/named_seeds
https://github.com/metaskills/named_seeds
test/support/active_record.rb
Ruby
mit
46
master
1,318
require 'active_record/base' TESTING_RAILS_40 = Gem::Dependency.new('rails', '~> 4.0.0') =~ Gem::Dependency.new('rails', Rails::VERSION::STRING) TESTING_RAILS_41 = Gem::Dependency.new('rails', '~> 4.1.0') =~ Gem::Dependency.new('rails', Rails::VERSION::STRING) TESTING_RAILS_42 = Gem::Dependency.new('rails', '~> 4.2.0'...
github
metaskills/named_seeds
https://github.com/metaskills/named_seeds
test/cases/identify_test.rb
Ruby
mit
46
master
507
require 'test_helper' class IdentifyTest < NamedSeeds::TestCase def test_works_on_strings assert_equal id('foo'), id('foo') assert_not_equal id('FOO'), id('foo') end def test_works_on_symbols assert_equal id('foo'), id(:foo) end def test_identifies_consistently assert_equal 207281424, ...
github
metaskills/named_seeds
https://github.com/metaskills/named_seeds
test/cases/dsl_test.rb
Ruby
mit
46
master
234
require 'test_helper' class DslTest < NamedSeeds::TestCase module T ; extend NamedSeeds::DSL ; end def test_includes_all_methods assert_equal 207281424, T.identify(:ruby) assert_equal 207281424, T.id(:ruby) end end
github
metaskills/named_seeds
https://github.com/metaskills/named_seeds
test/cases/named_seeds_test.rb
Ruby
mit
46
master
2,134
require 'test_helper' class NamedSeedsTest < NamedSeeds::TestCase named_seeds :users named_seeds :posts named_seeds :states, identities: {virginia: 'VA', washington: 'WA'} named_seeds :enterprise_objects named_seeds :natural_id_states, identities: :natural, class: State named_seeds :classy_users, class: ...
github
vinnicc/dota
https://github.com/vinnicc/dota
Guardfile
Ruby
mit
46
master
212
guard :rspec, cmd: "bundle exec rspec --fail-fast" do watch(%r{^spec/.+_spec\.rb$}) watch(%r{^lib/(.+)\.rb$}) { "spec" } # or { |m| "spec/#{m[1]}_spec.rb" } watch("spec/spec_helper.rb") { "spec" } end
github
vinnicc/dota
https://github.com/vinnicc/dota
dota.gemspec
Ruby
mit
46
master
1,362
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'dota/version' Gem::Specification.new do |spec| spec.name = "dota" spec.version = Dota::VERSION spec.authors = ["Vinni Carlo Caños"] spec.email = ["vinnicc@gma...
github
vinnicc/dota
https://github.com/vinnicc/dota
spec/dota_spec.rb
Ruby
mit
46
master
7,535
RSpec.describe Dota do describe "configuration" do it "accepts an api key" do api_key = SecureRandom.hex Dota.configure do |config| config.api_key = api_key end expect(Dota.configuration.api_key).to eq api_key end it "accepts an api version" do expect(Dota.configura...
github
vinnicc/dota
https://github.com/vinnicc/dota
spec/spec_helper.rb
Ruby
mit
46
master
659
require "codeclimate-test-reporter" CodeClimate::TestReporter.start require 'dotenv' Dotenv.load ".env.test" Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f } require 'dota' module SpecHelper def test_client return if @client @client = Dota::API::Client.new @client.configure do ...
github
vinnicc/dota
https://github.com/vinnicc/dota
spec/support/vcr.rb
Ruby
mit
46
master
428
require 'vcr' VCR.configure do |c| c.ignore_hosts "codeclimate.com" c.allow_http_connections_when_no_cassette = false c.hook_into :faraday c.cassette_library_dir = File.join(File.dirname(__FILE__), "..", "fixtures", "vcr_cassettes") c.configure_rspec_metadata! c.filter_sensitive_data("<STEAM_API_KEY>") { E...
github
vinnicc/dota
https://github.com/vinnicc/dota
spec/dota/api/friend_spec.rb
Ruby
mit
46
master
408
RSpec.describe Dota::API::Friend do let(:friend) do VCR.use_cassette("GetFriendList") do test_client.friends(sample_user_id).first end end specify "#id" do expect(friend.id).to eq 76561197992246166 end specify "#relationship" do expect(friend.relationship).to eq "friend" end speci...
github
vinnicc/dota
https://github.com/vinnicc/dota
spec/dota/api/scheduled_match_spec.rb
Ruby
mit
46
master
898
RSpec.describe Dota::API::ScheduledMatch do let(:scheduled_match) do VCR.use_cassette("GetScheduledLeagueGames") do test_client.scheduled_matches.first end end specify "#league_id" do expect(scheduled_match.league_id).to eq 2057 end specify "#game_id" do expect(scheduled_match.game_id)...
github
vinnicc/dota
https://github.com/vinnicc/dota
spec/dota/api/team_spec.rb
Ruby
mit
46
master
1,144
RSpec.describe Dota::API::Team do let(:team) do VCR.use_cassette("GetTeamInfoByTeamID") do test_client.teams(sample_team_id) end end specify "#id" do expect(team.id).to eq sample_team_id end specify "#name" do expect(team.name).to eq "Newbee" end specify "#tag" do expect(team....
github
vinnicc/dota
https://github.com/vinnicc/dota
spec/dota/api/league_spec.rb
Ruby
mit
46
master
642
RSpec.describe Dota::API::League do let(:league) do VCR.use_cassette("GetLeagueListing") do test_client.leagues.first end end specify "#id" do expect(league.id).to eq 1212 end specify "#name" do expect(league.name).to eq "Dota 2 Just For Fun" end specify "#description" do expe...
github
vinnicc/dota
https://github.com/vinnicc/dota
spec/dota/api/item_spec.rb
Ruby
mit
46
master
723
RSpec.describe Dota::API::Item do let(:item) { described_class.new(1) } specify ".all" do items = described_class.all expect(items.first).to be_a described_class expect(items.count).to eq 282 end specify "#id" do expect(item.id).to eq 1 end specify "#name" do expect(item.name).to eq "...
github
vinnicc/dota
https://github.com/vinnicc/dota
spec/dota/api/missing_hero_spec.rb
Ruby
mit
46
master
322
RSpec.describe Dota::API::MissingHero do let(:hero) { described_class.new(nil) } specify "#id" do expect(hero.id).to eq nil end specify "#name" do expect(hero.name).to eq nil end specify "#image_url" do expect(hero.image_url).to eq nil expect(hero.image_url(:something)).to eq nil end en...
github
vinnicc/dota
https://github.com/vinnicc/dota
spec/dota/api/hero_spec.rb
Ruby
mit
46
master
706
RSpec.describe Dota::API::Hero do let(:hero) { described_class.new(69) } specify ".all" do heroes = described_class.all expect(heroes.first).to be_a described_class expect(heroes.count).to eq 115 end specify ".find" do expect(described_class.find(69)).to be_a Dota::API::Hero expect(describ...
github
vinnicc/dota
https://github.com/vinnicc/dota
spec/dota/api/ability_spec.rb
Ruby
mit
46
master
924
RSpec.describe Dota::API::Ability do let(:ability) { described_class.new(5003) } specify ".all" do abilities = described_class.all expect(abilities.first).to be_a described_class expect(abilities.count).to eq 1077 end specify "#id" do expect(ability.id).to eq 5003 end describe "#name" do ...
github
vinnicc/dota
https://github.com/vinnicc/dota
spec/dota/api/live_match_spec.rb
Ruby
mit
46
master
1,748
RSpec.describe Dota::API::LiveMatch do let(:live_match) do VCR.use_cassette("GetLiveLeagueGames") do test_client.live_matches.first end end specify "#id" do expect(live_match.id).to eq 1080324763 end specify "#lobby_id" do expect(live_match.lobby_id).to eq 23791470898109516 end sp...
github
vinnicc/dota
https://github.com/vinnicc/dota
spec/dota/api/match_spec.rb
Ruby
mit
46
master
1,661
RSpec.describe Dota::API::Match do let(:match) do VCR.use_cassette("GetMatchDetails") do test_client.matches(sample_match_id) end end specify "#id" do expect(match.id).to eq sample_match_id end specify "#league_id" do expect(match.league_id).to eq 2129 end specify "#type" do e...
github
vinnicc/dota
https://github.com/vinnicc/dota
spec/dota/api/match/side_spec.rb
Ruby
mit
46
master
3,558
RSpec.describe Dota::API::Match::Side do let(:match) do VCR.use_cassette("GetMatchDetails") do test_client.matches(sample_match_id) end end let(:radiant) { match.radiant } let(:dire) { match.dire } specify "#id" do expect(radiant.id).to eq 111474 expect(dire.id).to eq 2085365 end s...
github
vinnicc/dota
https://github.com/vinnicc/dota
spec/dota/api/match/ability_upgrade_spec.rb
Ruby
mit
46
master
517
RSpec.describe Dota::API::Match::AbilityUpgrade do let(:ability_upgrade) do VCR.use_cassette("GetMatchDetails") do test_client .matches(sample_match_id) .radiant .players .first .ability_upgrades .last end end specify "#ability" do expect(ability_...
github
vinnicc/dota
https://github.com/vinnicc/dota
spec/dota/api/match/unit_spec.rb
Ruby
mit
46
master
489
RSpec.describe Dota::API::Match::Unit do let(:additional_unit) do VCR.use_cassette("GetMatchDetails") do test_client .matches(sample_match_id) .radiant .players.last .additional_units.first end end let(:item) { additional_unit.items.first } specify "#name" do e...
github
vinnicc/dota
https://github.com/vinnicc/dota
spec/dota/api/match/draft_spec.rb
Ruby
mit
46
master
466
RSpec.describe Dota::API::Match::Draft do let(:draft) do VCR.use_cassette("GetMatchDetails") do test_client .matches(sample_match_id) .drafts .last end end specify "#pick?" do expect(draft.pick?).to eq true end specify "#team" do expect(draft.team).to eq :dire ...
github
vinnicc/dota
https://github.com/vinnicc/dota
spec/dota/api/match/player_spec.rb
Ruby
mit
46
master
1,847
RSpec.describe Dota::API::Match::Player do let(:match) do VCR.use_cassette("GetMatchDetails") do test_client.matches(sample_match_id) end end let(:player) { match.radiant.players.last } specify "#id" do expect(player.id).to eq 76482434 end specify "#hero" do expect(Dota::API::Hero).t...
github
vinnicc/dota
https://github.com/vinnicc/dota
spec/dota/api/cosmetic/rarity_spec.rb
Ruby
mit
46
master
388
RSpec.describe Dota::API::Cosmetic::Rarity do let(:rarity) do VCR.use_cassette("GetRarities") do test_client.cosmetic_rarities.last end end specify("#id") { expect(rarity.id).to eq 7 } specify("#order") { expect(rarity.order).to eq 6 } specify("#color") { expect(rarity.color).to eq "#e4ae39"...
github
vinnicc/dota
https://github.com/vinnicc/dota
spec/dota/api/live_match/side_spec.rb
Ruby
mit
46
master
3,670
RSpec.describe Dota::API::LiveMatch::Side do let(:live_match) do VCR.use_cassette("GetLiveLeagueGames") do test_client.live_matches.first end end let(:radiant) { live_match.radiant } let(:dire) { live_match.dire } specify "#id" do expect(radiant.id).to eq 1677303 expect(dire.id).to eq 1...
github
vinnicc/dota
https://github.com/vinnicc/dota
spec/dota/api/live_match/player_spec.rb
Ruby
mit
46
master
1,910
RSpec.describe Dota::API::LiveMatch::Player do let(:live_match) do VCR.use_cassette("GetLiveLeagueGames") do test_client.live_matches.first end end let(:player) do live_match.radiant.players.at(3) end specify "#id" do expect(player.id).to eq 34145091 end specify "#name" do expe...
github
vinnicc/dota
https://github.com/vinnicc/dota
lib/dota.rb
Ruby
mit
46
master
1,174
require 'yaml' require 'facets/string/titlecase' require 'dota/configuration' require 'dota/version' require 'dota/utils/mapped' require 'dota/utils/inspectable' require 'dota/api/entity' require 'dota/api/basic_match' require 'dota/api/basic_player' require 'dota/api/basic_side' require 'dota/api/client' require '...
github
vinnicc/dota
https://github.com/vinnicc/dota
lib/dota/configuration.rb
Ruby
mit
46
master
232
module Dota class Configuration DEFAULT_API_VERSION = "v1" OPTIONS = [:api_key, :api_version].freeze attr_accessor :api_key, :api_version def initialize @api_version = DEFAULT_API_VERSION end end end
github
vinnicc/dota
https://github.com/vinnicc/dota
lib/dota/utils/inspectable.rb
Ruby
mit
46
master
841
module Dota module Utilities # # When an exception is raised, in some cases `#inspect` is called on a huge # object graph to generate the message `"undefined method '...' for # <Dota::API::Match:0x...>"`. This can take several seconds, since # `Object#inspect` descends recursively into each instan...
github
vinnicc/dota
https://github.com/vinnicc/dota
lib/dota/utils/mapped.rb
Ruby
mit
46
master
602
module Dota module Utilities module Mapped def self.included(base) base.extend ClassMethods base.class_eval do def mapping self.class.mapping end end end module ClassMethods def mapping @mapping ||= begin fil...
github
vinnicc/dota
https://github.com/vinnicc/dota
lib/dota/api/basic_player.rb
Ruby
mit
46
master
945
module Dota module API class BasicPlayer < Entity include Utilities::Inspectable TYPES = { 0 => :radiant, 1 => :dire, 2 => :broadcaster, 4 => :unassigned } STATUS = { 0 => :played, 1 => :left_safe, 2 => :disconnected, 3 => :...
github
vinnicc/dota
https://github.com/vinnicc/dota
lib/dota/api/ability.rb
Ruby
mit
46
master
634
module Dota module API class Ability include Utilities::Mapped attr_reader :id, :name, :full_name alias_method :full_name, :name def initialize(id) @id = id @internal_name = mapping[id][0] @name = mapping[id][1] || @internal_name end def image_url(ty...
github
vinnicc/dota
https://github.com/vinnicc/dota
lib/dota/api/match.rb
Ruby
mit
46
master
1,824
module Dota module API class Match < BasicMatch def duration raw["duration"] end def league_id raw["leagueid"] end def mode MODES[raw["game_mode"]] end def mode_id raw["game_mode"] end def type TYPES[raw["lobby_type"...
github
vinnicc/dota
https://github.com/vinnicc/dota
lib/dota/api/item.rb
Ruby
mit
46
master
568
module Dota module API class Item include Utilities::Mapped attr_reader :id, :name def initialize(id) @id = id @internal_name = mapping[id][0] @name = mapping[id][1] end # Possible values for type: # :lg - 85x64 PNG image # :eg - 27x20 PNG image...
github
vinnicc/dota
https://github.com/vinnicc/dota
lib/dota/api/league.rb
Ruby
mit
46
master
430
module Dota module API class League < Entity TIERS = { 1 => "Amateur", 2 => "Professional", 3 => "Premier" } def id raw["leagueid"] end def name raw["name"] end def description raw["description"] end def url ...
github
vinnicc/dota
https://github.com/vinnicc/dota
lib/dota/api/live_match.rb
Ruby
mit
46
master
1,449
module Dota module API class LiveMatch < BasicMatch def duration raw_scoreboard["duration"] end def league_id raw["league_id"] end def league_tier League::TIERS[raw["league_tier"]] end def lobby_id raw["lobby_id"] end def sp...
github
vinnicc/dota
https://github.com/vinnicc/dota
lib/dota/api/team.rb
Ruby
mit
46
master
790
module Dota module API class Team < Entity def id raw["team_id"] end def name raw["name"] end def tag raw["tag"] end def country_code raw["country_code"] end def rating raw["rating"] end def url ...
github
vinnicc/dota
https://github.com/vinnicc/dota
lib/dota/api/client.rb
Ruby
mit
46
master
4,464
require 'faraday' require 'faraday_middleware' module Dota module API class Client def configuration @configuration ||= Configuration.new end def configure yield configuration end def heroes(id = nil) id ? Hero.find(id) : Hero.all end def items...
github
vinnicc/dota
https://github.com/vinnicc/dota
lib/dota/api/hero.rb
Ruby
mit
46
master
857
module Dota module API class Hero include Utilities::Mapped attr_reader :id, :name def self.find(id) hero = mapping[id] hero ? new(id) : Dota::API::MissingHero.new(id) end def initialize(id) @id = id @internal_name = mapping[id][0] @name = m...
github
vinnicc/dota
https://github.com/vinnicc/dota
lib/dota/api/basic_side.rb
Ruby
mit
46
master
970
module Dota module API class BasicSide < Entity TOWERS = [ :ancient_top, :ancient_bottom, :bottom_tier_3, :bottom_tier_2, :bottom_tier_1, :middle_tier_3, :middle_tier_2, :middle_tier_1, :top_tier_3, :top_tier_2, :top_tie...
github
vinnicc/dota
https://github.com/vinnicc/dota
lib/dota/api/scheduled_match.rb
Ruby
mit
46
master
519
module Dota module API class ScheduledMatch < Entity def league_id raw["league_id"] end def game_id raw["game_id"] end def teams raw["teams"].map do |raw_team| raw_team["name"] = raw_team.delete("team_name") Team.new(raw_team) end...
github
vinnicc/dota
https://github.com/vinnicc/dota
lib/dota/api/basic_match.rb
Ruby
mit
46
master
1,276
module Dota module API class BasicMatch < Entity include Utilities::Inspectable TYPES = { -1 => "Invalid", 0 => "Public Matchmaking", 1 => "Practice", 2 => "Tournament", 3 => "Tutorial", 4 => "Co-op with Bots", 5 => "Team Match", 6 => "S...
github
vinnicc/dota
https://github.com/vinnicc/dota
lib/dota/api/friend.rb
Ruby
mit
46
master
252
module Dota module API class Friend < Entity def id raw["steamid"].to_i end def relationship raw["relationship"] end def friended_at Time.at(raw["friend_since"]) end end end end
github
vinnicc/dota
https://github.com/vinnicc/dota
lib/dota/api/match/unit.rb
Ruby
mit
46
master
226
module Dota module API class Match class Unit attr_reader :name, :items def initialize(name, items) @name = name.titlecase @items = items end end end end end
github
vinnicc/dota
https://github.com/vinnicc/dota
lib/dota/api/match/draft.rb
Ruby
mit
46
master
350
module Dota module API class Match class Draft < Entity def order raw["order"] + 1 end def pick? raw["is_pick"] end def team raw["team"] == 0 ? :radiant : :dire end def hero Hero.new(raw["hero_id"]) en...
github
vinnicc/dota
https://github.com/vinnicc/dota
lib/dota/api/match/ability_upgrade.rb
Ruby
mit
46
master
291
module Dota module API class Match class AbilityUpgrade attr_reader :ability, :level, :time def initialize(raw) @ability = Ability.new(raw["ability"]) @level = raw["level"] @time = raw["time"] end end end end end
github
vinnicc/dota
https://github.com/vinnicc/dota
lib/dota/api/match/player.rb
Ruby
mit
46
master
1,312
module Dota module API class Match class Player < BasicPlayer # See https://wiki.teamfortress.com/wiki/WebAPI/GetMatchHistory#Player_Slot SLOT_GAP = 128 def slot slot = raw["player_slot"] slot -= SLOT_GAP if slot >= SLOT_GAP slot + 1 end ...
github
vinnicc/dota
https://github.com/vinnicc/dota
lib/dota/api/match/side.rb
Ruby
mit
46
master
652
module Dota module API class Match class Side < BasicSide def name raw["name"] end def logo_id raw["logo"] end def complete? raw["team_complete"] == 1 end def tower_status format_status raw["tower_status"], :t...
github
vinnicc/dota
https://github.com/vinnicc/dota
lib/dota/api/cosmetic/rarity.rb
Ruby
mit
46
master
317
module Dota module API class Cosmetic class Rarity < Entity def id raw["id"] end def order raw["order"] end def color raw["color"] end def name raw["localized_name"] end end end end end
github
vinnicc/dota
https://github.com/vinnicc/dota
lib/dota/api/live_match/player.rb
Ruby
mit
46
master
767
module Dota module API class LiveMatch class Player < BasicPlayer def slot raw["player_slot"] end def name raw["name"] end def deaths raw["death"] end def ultimate_state raw["ultimate_state"] end ...
github
vinnicc/dota
https://github.com/vinnicc/dota
lib/dota/api/live_match/side.rb
Ruby
mit
46
master
714
module Dota module API class LiveMatch class Side < BasicSide def name raw["team_name"] end def logo_id raw["team_logo"] end def complete? raw["complete"] end def tower_status format_status raw["tower_state"],...
github
wegowise/polymorpheus
https://github.com/wegowise/polymorpheus
Appraisals
Ruby
mit
46
master
335
appraise '5.2' do gem 'activerecord', '~> 5.2.0' gem 'mysql2', '~> 0.4.0' end appraise '6.0' do gem 'activerecord', '~> 6.0.3.3' gem 'mysql2', '~> 0.4.0' end appraise '6.1' do gem 'activerecord', '~> 6.1.2.1' gem 'mysql2', '~> 0.5.3' end appraise '7.0' do gem 'activerecord', '~> 7.0.0' gem 'mysql2', ...