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
procore-oss/handcuffs
https://github.com/procore-oss/handcuffs
spec/handcuffs/configuration_spec.rb
Ruby
mit
92
main
200
require "rails" require "handcuffs/configuration" RSpec.describe Handcuffs do specify do expect{ described_class.configure }.to raise_error(Handcuffs::ConfigurationBlockMissingError) end end
github
procore-oss/handcuffs
https://github.com/procore-oss/handcuffs
spec/handcuffs/phases_spec.rb
Ruby
mit
92
main
700
require "handcuffs/phases" RSpec.describe Handcuffs::Phases do context 'linear order' do subject(:phases) do described_class.new(%i[a b c d]) it 'can be ordered' do expect(phases.in_order).to eq(%i[a b c d]) end it 'can find prereqs' do expect(phases.prereqs(:c)).to eq(%...
github
procore-oss/handcuffs
https://github.com/procore-oss/handcuffs
spec/handcuffs/errors/configuration_block_missing_error_spec.rb
Ruby
mit
92
main
567
require "handcuffs/errors/configuration_block_missing_error" RSpec.describe Handcuffs::ConfigurationBlockMissingError do matcher :be_caught_with do |expected_identifier| match do |actual_exception| begin raise actual_exception rescue expected_identifier => e true rescue ...
github
procore-oss/handcuffs
https://github.com/procore-oss/handcuffs
spec/dummy/Gemfile
Ruby
mit
92
main
245
source 'https://rubygems.org' gem 'appraisal' gem 'handcuffs', path: "../../" gem 'pg' gem 'rails', "~> 6.1.7" gem 'sprockets', '~> 3.7' group :test do gem 'rspec-rails' gem 'pry' gem 'pry-rails' gem 'pry-byebug' gem 'simplecov' end
github
procore-oss/handcuffs
https://github.com/procore-oss/handcuffs
spec/dummy/db/migrate/20160330002738_add_column_foo_whatzit_count.rb
Ruby
mit
92
main
208
class AddColumnFooWhatzitCount < ACTIVE_RECORD_MIGRATION_CLASS phase :pre_restart def up add_column :foo, :whatzit_count, :integer end def down remove_column :foo, :whatzit_count end end
github
procore-oss/handcuffs
https://github.com/procore-oss/handcuffs
spec/dummy/db/migrate/20160329040426_add_table_foo.rb
Ruby
mit
92
main
230
class AddTableFoo < ACTIVE_RECORD_MIGRATION_CLASS phase :pre_restart def up create_table :foo do |t| t.text :name, null: false t.timestamps null: false end end def down drop_table :foo end end
github
procore-oss/handcuffs
https://github.com/procore-oss/handcuffs
spec/dummy/db/migrate/20160329042840_add_column_foo_widget_count.rb
Ruby
mit
92
main
205
class AddColumnFooWidgetCount < ACTIVE_RECORD_MIGRATION_CLASS phase :pre_restart def up add_column :foo, :widget_count, :integer end def down remove_column :foo, :widget_count end end
github
procore-oss/handcuffs
https://github.com/procore-oss/handcuffs
spec/dummy/db/migrate/20160330003159_add_foo_whatzit_default.rb
Ruby
mit
92
main
222
class AddFooWhatzitDefault < ACTIVE_RECORD_MIGRATION_CLASS phase :post_restart def up change_column_default :foo, :whatzit_count, 0 end def down change_column_default :foo, :whatzit_count, nil end end
github
procore-oss/handcuffs
https://github.com/procore-oss/handcuffs
spec/dummy/db/migrate/20160329224617_add_index_foo_widget_count.rb
Ruby
mit
92
main
260
class AddIndexFooWidgetCount < ACTIVE_RECORD_MIGRATION_CLASS disable_ddl_transaction! phase :post_restart def up add_index :foo, :widget_count, algorithm: :concurrently end def down remove_index :foo, :widget_count end end
github
procore-oss/handcuffs
https://github.com/procore-oss/handcuffs
spec/dummy/config/application.rb
Ruby
mit
92
main
880
require File.expand_path('../boot', __FILE__) require 'logger' require 'rails/all' Bundler.require(*Rails.groups) module Dummy class Application < Rails::Application # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in config/ini...
github
procore-oss/handcuffs
https://github.com/procore-oss/handcuffs
spec/dummy/config/initializers/handcufs.rb
Ruby
mit
92
main
456
# frozen_string_literal: true Handcuffs.configure do |config| config.phases = { # Prevent running post_restart migrations if there are outstanding # pre_restart migrations post_restart: [:pre_restart], # Require pre_restarts before data_migrations, but do not enforce ordering # between data_migra...
github
procore-oss/handcuffs
https://github.com/procore-oss/handcuffs
spec/dummy/config/environments/test.rb
Ruby
mit
92
main
2,014
ACTIVE_RECORD_MIGRATION_CLASS = begin rails_version = Rails::VERSION::STRING.split(".")[0..1].join(".") eval("ActiveRecord::Migration[#{rails_version}]") end Rails.application.configure do # Settings specified here wi...
github
procore-oss/handcuffs
https://github.com/procore-oss/handcuffs
spec/dummy/config/environments/development.rb
Ruby
mit
92
main
1,606
Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart the web serv...
github
procore-oss/handcuffs
https://github.com/procore-oss/handcuffs
spec/dummy/spec/spec_helper.rb
Ruby
mit
92
main
5,316
# This file was generated by the `rspec --init` 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 it in any # file...
github
procore-oss/handcuffs
https://github.com/procore-oss/handcuffs
spec/dummy/spec/handcuffs_rake_spec.rb
Ruby
mit
92
main
6,005
# frozen_string_literal: true require_relative 'spec_helper' RSpec.describe 'handcuffs' do include_context 'rake' let!(:add_table_foo_version) { '20160329040426' } # pre_restart let!(:add_column_foo_widget_count_version) { '20160329042840' } # pre_restart let!(:add_index_foo_widget_count_version) { '201603292...
github
procore-oss/handcuffs
https://github.com/procore-oss/handcuffs
spec/dummy/spec/support/shared_contexts/rake.rb
Ruby
mit
92
main
629
# frozen_string_literal: true # https://robots.thoughtbot.com/test-rake-tasks-like-a-boss require 'rake' shared_context 'rake' do let(:rake) { Rake::Application.new } let(:task_name) { self.class.top_level_description } let(:task_path) { "../../lib/tasks/#{task_name.split(':').first}" } def loaded_files...
github
lyfeyaj/smart_sms
https://github.com/lyfeyaj/smart_sms
Rakefile
Ruby
mit
92
master
225
require 'bundler' Bundler::GemHelper.install_tasks require 'rspec/core' require 'rspec/core/rake_task' RSpec::Core::RakeTask.new(:spec) do |spec| spec.pattern = FileList['spec/**/*_spec.rb'] end task default: 'spec:all'
github
lyfeyaj/smart_sms
https://github.com/lyfeyaj/smart_sms
smart_sms.gemspec
Ruby
mit
92
master
1,418
# encoding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'smart_sms/version' Gem::Specification.new do |s| s.name = 'smart_sms' s.version = SmartSMS::VERSION s.authors = ['lyfeyaj'] s.email = ['lyfeyaj@gmail.com']...
github
lyfeyaj/smart_sms
https://github.com/lyfeyaj/smart_sms
lib/smart_sms.rb
Ruby
mit
92
master
1,051
require 'smart_sms/config' require 'smart_sms/request' require 'smart_sms/template' require 'smart_sms/helpers/fake_sms' require 'smart_sms/helpers/verification_code' require 'smart_sms/message_service' require 'smart_sms/account' unless defined? ActiveRecord begin require 'active_record' rescue LoadError; end...
github
lyfeyaj/smart_sms
https://github.com/lyfeyaj/smart_sms
lib/smart_sms/has_sms_verification.rb
Ruby
mit
92
master
4,954
# encoding: utf-8 require File.expand_path(File.join(File.dirname(__FILE__), 'model/message')) module SmartSMS # Module that will be hooked into ActiveRecord to provide magic methods # module HasSmsVerification def self.included(base) base.send :extend, ClassMethods end # Class methods that wi...
github
lyfeyaj/smart_sms
https://github.com/lyfeyaj/smart_sms
lib/smart_sms/template.rb
Ruby
mit
92
master
1,113
# encoding: utf-8 module SmartSMS # module that handle `Template` module Template module_function # 取默认模板 # Options: # # * tpl_id: 指定tpl_id时返回tpl_id对应的默认模板. 未指定时返回所有默认模板 # def find_default(tpl_id = '') Request.post 'tpl/get_default.json', tpl_id: tpl_id end # 取自定义模板 ...
github
lyfeyaj/smart_sms
https://github.com/lyfeyaj/smart_sms
lib/smart_sms/account.rb
Ruby
mit
92
master
507
# encoding: utf-8 module SmartSMS # Module that handle user information # module Account module_function # 获取用户信息 # def info Request.post 'user/get.json' end # 设置用户信息 # # * emergency_contact: 紧急联系人 # * emergency_mobile: 紧急联系人手机号 # * alarm_balance: 短信余额提醒...
github
lyfeyaj/smart_sms
https://github.com/lyfeyaj/smart_sms
lib/smart_sms/message_service.rb
Ruby
mit
92
master
3,111
module SmartSMS # Message service: methods that are used to manage messages module MessageService def self.included(base) base.send :extend, ClassMethods end # Class methods module ClassMethods DATETIME_FORMAT = '%Y-%m-%d %H:%M:%S' # 发送短信到手机, 默认使用模板发送, 提供通用接口支持 # # * ...
github
lyfeyaj/smart_sms
https://github.com/lyfeyaj/smart_sms
lib/smart_sms/config.rb
Ruby
mit
92
master
2,049
# encoding: utf-8 require 'active_support/configurable' require 'active_support/core_ext' module SmartSMS # Configures global settings for SmartSMS # SmartSMS.configure do |config| # config.api_key = 'd63124354422b046081a44466' # end def self.configure(&block) yield @config ||= SmartSMS::Configur...
github
lyfeyaj/smart_sms
https://github.com/lyfeyaj/smart_sms
lib/smart_sms/request.rb
Ruby
mit
92
master
1,083
# encoding: utf-8 require 'net/http' require 'active_support/json' module SmartSMS # Module that manage requests module Request # Method that use `Net::HTTP.post_form` to perform `POST` action # def post(api, options = {}) options[:apikey] = SmartSMS.config.api_key uri = URI.join(base_url, ...
github
lyfeyaj/smart_sms
https://github.com/lyfeyaj/smart_sms
lib/smart_sms/model/message.rb
Ruby
mit
92
master
377
module SmartSMS # Message model to store sms messages # class Message < ::ActiveRecord::Base self.table_name = 'smart_sms_messages' belongs_to :smsable, polymorphic: true attr_accessible :sid, :uid, :mobile, :send_time, :text, :code, :send_status, :report_status, :fee, :user_receive_time, :error_msg i...
github
lyfeyaj/smart_sms
https://github.com/lyfeyaj/smart_sms
lib/smart_sms/helpers/fake_sms.rb
Ruby
mit
92
master
882
# encoding: utf-8 module SmartSMS # Module that contains methods to generate fake message # module FakeSMS module_function # This will generate fake sms with all necessary attributes # # Options: # # * mobile: mobile number # * code: verification code # * company: assigne...
github
lyfeyaj/smart_sms
https://github.com/lyfeyaj/smart_sms
lib/smart_sms/helpers/verification_code.rb
Ruby
mit
92
master
1,157
require 'securerandom' module SmartSMS # This module provides some methods to generate random verification code # # Algorithm: # # * short: Generate short code with 4 numbers # * simple: Generate simple code with 6 numbers # * middle: Generate middle complex code of 6 charactors with mixed n...
github
lyfeyaj/smart_sms
https://github.com/lyfeyaj/smart_sms
lib/generators/smart_sms/install_generator.rb
Ruby
mit
92
master
1,066
require 'rails/generators' require 'rails/generators/active_record' module SmartSms class InstallGenerator < ::Rails::Generators::Base include ::Rails::Generators::Migration source_root File.expand_path(File.join(File.dirname(__FILE__), 'templates')) desc <<-EOF Generates (but does not run) a migration...
github
lyfeyaj/smart_sms
https://github.com/lyfeyaj/smart_sms
lib/generators/smart_sms/config_generator.rb
Ruby
mit
92
master
431
module SmartSms module Generators class ConfigGenerator < Rails::Generators::Base source_root File.expand_path(File.join(File.dirname(__FILE__), 'templates')) desc <<-DESC Description: Copies SmartSMS configuration file to your application's initializer directory. DESC def copy_config_file...
github
lyfeyaj/smart_sms
https://github.com/lyfeyaj/smart_sms
lib/generators/smart_sms/templates/create_smart_sms_messages.rb
Ruby
mit
92
master
530
class CreateSmartSmsMessages < ActiveRecord::Migration def change create_table :smart_sms_messages do |t| t.string :sid t.string :mobile t.datetime :send_time t.text :text t.string :code t.string :send_status t.string :report_status t.string :fee t.datetime :u...
github
lyfeyaj/smart_sms
https://github.com/lyfeyaj/smart_sms
lib/generators/smart_sms/templates/smart_sms_config.rb
Ruby
mit
92
master
420
# encoding: utf-8 SmartSMS.configure do |config| # config.api_key = nil # config.api_version = :v1 # config.template_id = '2' # config.template_value = [:code, :company] # config.page_num = 1 # config.page_size = 20 # config.company = '云片网' # config.expires_in = 1.hour # config.default_interval = 1.d...
github
lyfeyaj/smart_sms
https://github.com/lyfeyaj/smart_sms
spec/spec_helper.rb
Ruby
mit
92
master
399
# encoding: utf-8 begin require 'rails' rescue LoadError end require 'rubygems' require 'bundler/setup' # Bundler.require require 'rspec/its' require 'webmock/rspec' require 'smart_sms' require 'database_cleaner' # WebMock.allow_net_connect! if defined? Rails require 'fake_app/rails_app' require 'rspec/rai...
github
lyfeyaj/smart_sms
https://github.com/lyfeyaj/smart_sms
spec/smart_sms_spec.rb
Ruby
mit
92
master
7,591
# encoding: utf-8 require 'spec_helper' describe SmartSMS do let(:phone) { '13394738283' } let(:content) { '您的验证码是: 432432, 如果此操作与您无关, 请忽略这条短信' } describe '#deliver' do context 'template send api' do let(:url) { 'http://yunpian.com/v1/sms/tpl_send.json' } subject { SmartSMS.deliver phone, conten...
github
lyfeyaj/smart_sms
https://github.com/lyfeyaj/smart_sms
spec/template_spec.rb
Ruby
mit
92
master
4,408
# encoding: utf-8 require 'spec_helper' describe SmartSMS::Template do describe '#find_default' do let(:url) { 'http://yunpian.com/v1/tpl/get_default.json' } let(:tpl_id) { '1' } subject { SmartSMS::Template.find_default tpl_id } before do stub_request(:post, url).with( body: { ...
github
lyfeyaj/smart_sms
https://github.com/lyfeyaj/smart_sms
spec/account_spec.rb
Ruby
mit
92
master
2,171
# encoding: utf-8 require 'spec_helper' describe SmartSMS::Template do describe '#info' do let(:url) { 'http://yunpian.com/v1/user/get.json' } subject { SmartSMS::Account.info } before do stub_request(:post, url).with( body: { 'apikey' => SmartSMS.config.api_key }, ...
github
lyfeyaj/smart_sms
https://github.com/lyfeyaj/smart_sms
spec/has_sms_verificaton_spec.rb
Ruby
mit
92
master
8,447
# encoding: utf-8 require 'spec_helper' describe 'SmartSMS::HasSmsVerification' do let(:user) { User.create phone: '13764071479' } let(:account) { Account.create mobile: '13764071479' } context '#verify!' do let(:verification_code) { SmartSMS::VerificationCode.simple } describe 'Model User with default...
github
lyfeyaj/smart_sms
https://github.com/lyfeyaj/smart_sms
spec/config/config_spec.rb
Ruby
mit
92
master
4,429
# encoding: utf-8 require 'spec_helper' describe SmartSMS::Configuration do subject { SmartSMS.config } describe 'api_key' do context 'by_default' do its(:api_key) { should == 'fake_api_key' } end context 'configured via config block' do before do SmartSMS.configure { |c| c.api_ke...
github
lyfeyaj/smart_sms
https://github.com/lyfeyaj/smart_sms
spec/fake_app/rails_app.rb
Ruby
mit
92
master
641
# require 'rails/all' require 'action_controller/railtie' require 'action_view/railtie' require 'fake_app/active_record/config' if defined? ActiveRecord # Config app = Class.new(Rails::Application) app.config.secret_token = '3b7cd727ee24e8444053437c36cc66c4' app.config.session_store :cookie_store, key: '_myapp_sessio...
github
lyfeyaj/smart_sms
https://github.com/lyfeyaj/smart_sms
spec/fake_app/active_record/models.rb
Ruby
mit
92
master
1,033
# Model class User < ActiveRecord::Base has_sms_verification end # Model with customized columns class Account < ActiveRecord::Base has_sms_verification :mobile, :confirmed_at end # Migrations class CreateAllTables < ActiveRecord::Migration def self.up create_table(:users) do |t| t.string :phone ...
github
lyfeyaj/smart_sms
https://github.com/lyfeyaj/smart_sms
spec/fake_app/initializers/smart_sms.rb
Ruby
mit
92
master
408
# encoding: utf-8 SmartSMS.configure do |config| config.api_key = 'fake_api_key' config.api_version = :v1 config.template_id = '2' config.template_value = [:code, :company] config.page_num = 1 config.page_size = 20 config.company = 'Smart SMS' config.expires_in = 1.hour config.default_interval = 1.da...
github
lyfeyaj/smart_sms
https://github.com/lyfeyaj/smart_sms
spec/helpers/fake_sms_spec.rb
Ruby
mit
92
master
497
# encoding: utf-8 require 'spec_helper' describe SmartSMS::FakeSMS do let(:mobile) { '15338489342' } let(:code) { '12345' } let(:company) { 'Edgepeek' } let(:fake_message) { SmartSMS::FakeSMS.build_fake_sms mobile, code, company } it 'should get the right mobile and text' do Time.zone = 'Beijing' ex...
github
lyfeyaj/smart_sms
https://github.com/lyfeyaj/smart_sms
spec/helpers/verification_code_spec.rb
Ruby
mit
92
master
1,728
# encoding: utf-8 require 'spec_helper' describe SmartSMS::VerificationCode do context 'get random verification code' do it 'should return a short code' do simple_code = SmartSMS::VerificationCode.random :short expect(simple_code.length).to eq(4) expect(simple_code).to match(/[0-9]/) end ...
github
lyfeyaj/smart_sms
https://github.com/lyfeyaj/smart_sms
spec/support/database_cleaner.rb
Ruby
mit
92
master
327
DatabaseCleaner[:active_record].strategy = :transaction if defined? ActiveRecord RSpec.configure do |config| config.before :suite do DatabaseCleaner.clean_with :truncation if defined? ActiveRecord end config.before :each do DatabaseCleaner.start end config.after :each do DatabaseCleaner.clean e...
github
freerobby/sendgrid_toolkit
https://github.com/freerobby/sendgrid_toolkit
Rakefile
Ruby
mit
92
master
883
require 'rubygems' require 'bundler' 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 do |gem| # gem is a Gem::Specificat...
github
freerobby/sendgrid_toolkit
https://github.com/freerobby/sendgrid_toolkit
sendgrid_toolkit.gemspec
Ruby
mit
92
master
3,385
# Generated by jeweler # DO NOT EDIT THIS FILE DIRECTLY # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec' # -*- encoding: utf-8 -*- # stub: sendgrid_toolkit 1.4.0 ruby lib Gem::Specification.new do |s| s.name = "sendgrid_toolkit" s.version = "1.4.0" s.required_rubygems_version = Gem::Requiremen...
github
freerobby/sendgrid_toolkit
https://github.com/freerobby/sendgrid_toolkit
lib/sendgrid_toolkit.rb
Ruby
mit
92
master
987
require 'httparty' require 'sendgrid_toolkit/abstract_sendgrid_client' require 'sendgrid_toolkit/http_parser_party' require 'sendgrid_toolkit/common' require 'sendgrid_toolkit/sendgrid_error' require 'sendgrid_toolkit/statistics' require 'sendgrid_toolkit/unsubscribes' require 'sendgrid_toolkit/spam_reports' require '...
github
freerobby/sendgrid_toolkit
https://github.com/freerobby/sendgrid_toolkit
lib/sendgrid_toolkit/abstract_sendgrid_client.rb
Ruby
mit
92
master
1,607
module SendgridToolkit class AbstractSendgridClient def initialize(api_user = nil, api_key = nil) @api_user = api_user || SendgridToolkit.api_user || ENV['SMTP_USERNAME'] @api_key = api_key || SendgridToolkit.api_key || ENV['SMTP_PASSWORD'] raise SendgridToolkit::NoAPIUserSpecified if @api_use...
github
freerobby/sendgrid_toolkit
https://github.com/freerobby/sendgrid_toolkit
lib/sendgrid_toolkit/mail.rb
Ruby
mit
92
master
496
require 'json' module SendgridToolkit class Mail < AbstractSendgridClient def send_mail(options = {}) response = api_post('mail', 'send', convert_params(options)) raise(SendEmailError, "SendMail API refused to send email: #{response["errors"].inspect}") if response["message"] == "error" respons...
github
freerobby/sendgrid_toolkit
https://github.com/freerobby/sendgrid_toolkit
lib/sendgrid_toolkit/common.rb
Ruby
mit
92
master
938
module SendgridToolkit module Common def retrieve(options = {}) response = api_post(module_name, 'get', options) response end def retrieve_with_timestamps(options = {}) options.merge! :date => 1 response = retrieve options if response.is_a? Array response.each do |...
github
freerobby/sendgrid_toolkit
https://github.com/freerobby/sendgrid_toolkit
lib/sendgrid_toolkit/http_parser_party.rb
Ruby
mit
92
master
653
# Custom parser to deal with the sendgrid server returning HTML when JSON is requested. module SendgridToolkit class HTTParserParty include HTTParty # Only support Atom class Parser::OnlyJson < HTTParty::Parser SupportedFormats = { "application/json" => :json } protected # perform ato...
github
freerobby/sendgrid_toolkit
https://github.com/freerobby/sendgrid_toolkit
lib/sendgrid_toolkit/sendgrid_error.rb
Ruby
mit
92
master
556
module SendgridToolkit class AuthenticationFailed < StandardError; end class NoAPIKeySpecified < StandardError; end class NoAPIUserSpecified < StandardError; end class UnsubscribeEmailAlreadyExists < StandardError; end class UnsubscribeEmailDoesNotExist < StandardError; end class SendEmailError < StandardEr...
github
freerobby/sendgrid_toolkit
https://github.com/freerobby/sendgrid_toolkit
lib/sendgrid_toolkit/statistics.rb
Ruby
mit
92
master
1,728
module SendgridToolkit class Statistics < AbstractSendgridClient def advanced(data_type, start_date, options = {}) options.merge! :data_type => data_type options.merge! :start_date => format_date(start_date, options) response = api_post('stats', 'getAdvanced', options) response.each { |r|...
github
freerobby/sendgrid_toolkit
https://github.com/freerobby/sendgrid_toolkit
lib/sendgrid_toolkit/unsubscribes.rb
Ruby
mit
92
master
901
module SendgridToolkit class Unsubscribes < AbstractSendgridClient def add(options = {}) response = api_post('unsubscribes', 'add', options) raise UnsubscribeEmailAlreadyExists if response['message'].include?('already exists') response end def delete(options = {}) response = a...
github
freerobby/sendgrid_toolkit
https://github.com/freerobby/sendgrid_toolkit
lib/sendgrid_toolkit/newsletter/newsletter_sendgrid_client.rb
Ruby
mit
92
master
216
module SendgridToolkit class NewsletterSendgridClient < AbstractSendgridClient protected def compose_base_path(module_name, action_name) "newsletter/#{module_name}/#{action_name}" end end end
github
freerobby/sendgrid_toolkit
https://github.com/freerobby/sendgrid_toolkit
lib/sendgrid_toolkit/newsletter/list_emails.rb
Ruby
mit
92
master
892
require 'json' module SendgridToolkit class ListEmails < NewsletterSendgridClient def add(options = {}) if options[:data].kind_of?(Hash) options[:data] = options[:data].to_json elsif options[:data].kind_of?(Array) options[:data] = options[:data].map{|data| data.to_json} end ...
github
freerobby/sendgrid_toolkit
https://github.com/freerobby/sendgrid_toolkit
lib/sendgrid_toolkit/newsletter/lists.rb
Ruby
mit
92
master
446
module SendgridToolkit class Lists < NewsletterSendgridClient def add(options = {}) api_post('lists', 'add', options).parsed_response end def get(options = {}) api_post('lists', 'get', options).parsed_response end def edit(options = {}) api_post('lists', 'edit', options).parsed...
github
freerobby/sendgrid_toolkit
https://github.com/freerobby/sendgrid_toolkit
lib/sendgrid_toolkit/v3/abstract_sendgrid_client.rb
Ruby
mit
92
master
2,210
module SendgridToolkit module V3 class AbstractSendgridClient BASE_URI = 'https://api.sendgrid.com/v3/asm' def initialize(api_user = nil, api_key = nil) @api_user = api_user || SendgridToolkit.api_user || ENV['SMTP_USERNAME'] @api_key = api_key || SendgridToolkit.api_key || ENV['SMTP...
github
freerobby/sendgrid_toolkit
https://github.com/freerobby/sendgrid_toolkit
lib/sendgrid_toolkit/v3/groups.rb
Ruby
mit
92
master
790
module SendgridToolkit module V3 class Groups < SendgridToolkit::V3::AbstractSendgridClient def add(options = {}) response = api_post('groups', options) fail GroupsError if response.is_a?(Hash) && response.key?('errors') response end def get(group_id = nil) actio...
github
freerobby/sendgrid_toolkit
https://github.com/freerobby/sendgrid_toolkit
lib/sendgrid_toolkit/v3/unsubscribes.rb
Ruby
mit
92
master
886
module SendgridToolkit module V3 class Unsubscribes < SendgridToolkit::V3::AbstractSendgridClient def add(options = {}) fail NoGroupIdSpecified unless options[:group_id] response = api_post("groups/#{options[:group_id]}/suppressions", options) fail APIError if response.is_a?(Hash) &...
github
freerobby/sendgrid_toolkit
https://github.com/freerobby/sendgrid_toolkit
spec/helper.rb
Ruby
mit
92
master
393
require 'fakeweb' require 'sendgrid_toolkit' require 'rspec' require 'json' FakeWeb.allow_net_connect = false REGEX_ESCAPED_BASE_URI = "api\.sendgrid\.com/api" REGEX_ESCAPED_BASE_URI_V3 = 'api.sendgrid.com/v3/asm' def backup_env @env_backup = Hash.new ENV.keys.each {|key| @env_backup[key] = ENV[key]} end def res...
github
freerobby/sendgrid_toolkit
https://github.com/freerobby/sendgrid_toolkit
spec/webconnect/sendgrid_toolkit_spec.rb
Ruby
mit
92
master
2,186
require File.expand_path("#{File.dirname(__FILE__)}/../helper") FakeWeb.allow_net_connect = true describe SendgridToolkit do before :all do FakeWeb.clean_registry FakeWeb.allow_net_connect = true end after :all do FakeWeb.allow_net_connect = false end before do backup_env # Don't let S...
github
freerobby/sendgrid_toolkit
https://github.com/freerobby/sendgrid_toolkit
spec/lib/sendgrid_toolkit_spec.rb
Ruby
mit
92
master
590
require File.expand_path("#{File.dirname(__FILE__)}/../helper") describe SendgridToolkit do subject { described_class } describe ".base_uri" do it "returns value set by user" do subject.base_uri = "foo" subject.base_uri.should == "foo" end it "finds ENV variable" do subject.base_uri ...
github
freerobby/sendgrid_toolkit
https://github.com/freerobby/sendgrid_toolkit
spec/lib/sendgrid_toolkit/bounces_spec.rb
Ruby
mit
92
master
2,664
require File.expand_path("#{File.dirname(__FILE__)}/../../helper") describe SendgridToolkit::Bounces do before do FakeWeb.clean_registry @obj = SendgridToolkit::Bounces.new("fakeuser", "fakepass") end describe "#retrieve" do it "returns array of bounced emails" do FakeWeb.register_uri(:post, %...
github
freerobby/sendgrid_toolkit
https://github.com/freerobby/sendgrid_toolkit
spec/lib/sendgrid_toolkit/abstract_sendgrid_client_spec.rb
Ruby
mit
92
master
3,970
require File.expand_path("#{File.dirname(__FILE__)}/../../helper") describe SendgridToolkit::AbstractSendgridClient do before do backup_env end after do restore_env end describe "#api_post" do it "throws error when authentication fails" do FakeWeb.register_uri(:post, %r|https://#{REGEX_ESC...
github
freerobby/sendgrid_toolkit
https://github.com/freerobby/sendgrid_toolkit
spec/lib/sendgrid_toolkit/unsubscribes_spec.rb
Ruby
mit
92
master
2,771
require File.expand_path("#{File.dirname(__FILE__)}/../../helper") describe SendgridToolkit::Unsubscribes do before do FakeWeb.clean_registry @obj = SendgridToolkit::Unsubscribes.new("fakeuser", "fakepass") end describe "#retrieve" do it "returns array of unsubscribed email addresses" do FakeW...
github
freerobby/sendgrid_toolkit
https://github.com/freerobby/sendgrid_toolkit
spec/lib/sendgrid_toolkit/invalid_emails_spec.rb
Ruby
mit
92
master
2,606
require File.expand_path("#{File.dirname(__FILE__)}/../../helper") describe SendgridToolkit::InvalidEmails do before do FakeWeb.clean_registry @obj = SendgridToolkit::InvalidEmails.new("fakeuser", "fakepass") end describe "#retrieve" do it "returns array of invalid emails" do FakeWeb.register_...
github
freerobby/sendgrid_toolkit
https://github.com/freerobby/sendgrid_toolkit
spec/lib/sendgrid_toolkit/spam_reports_spec.rb
Ruby
mit
92
master
1,884
require File.expand_path("#{File.dirname(__FILE__)}/../../helper") describe SendgridToolkit::SpamReports do before do FakeWeb.clean_registry @obj = SendgridToolkit::SpamReports.new("fakeuser", "fakepass") end describe "#retrieve" do it "returns array of bounced emails" do FakeWeb.register_uri(...
github
freerobby/sendgrid_toolkit
https://github.com/freerobby/sendgrid_toolkit
spec/lib/sendgrid_toolkit/mail_spec.rb
Ruby
mit
92
master
1,205
require File.expand_path("#{File.dirname(__FILE__)}/../../helper") describe SendgridToolkit::Mail do before do FakeWeb.clean_registry @obj = SendgridToolkit::Mail.new("fakeuser", "fakepass") end describe "#send" do it "raises error when sendgrid returns an error" do FakeWeb.register_uri(:post,...
github
freerobby/sendgrid_toolkit
https://github.com/freerobby/sendgrid_toolkit
spec/lib/sendgrid_toolkit/statistics_spec.rb
Ruby
mit
92
master
6,827
require File.expand_path("#{File.dirname(__FILE__)}/../../helper") describe SendgridToolkit::Statistics do before do FakeWeb.clean_registry @obj = SendgridToolkit::Statistics.new("fakeuser", "fakepass") end describe "#retrieve" do it "parses daily totals" do FakeWeb.register_uri(:post, %r|http...
github
freerobby/sendgrid_toolkit
https://github.com/freerobby/sendgrid_toolkit
spec/lib/sendgrid_toolkit/blocks_spec.rb
Ruby
mit
92
master
2,649
require File.expand_path("#{File.dirname(__FILE__)}/../../helper") describe SendgridToolkit::Blocks do before do FakeWeb.clean_registry @obj = SendgridToolkit::Blocks.new("fakeuser", "fakepass") end describe "#retrieve" do it "returns array of bounced emails" do FakeWeb.register_uri(:post, %r|...
github
freerobby/sendgrid_toolkit
https://github.com/freerobby/sendgrid_toolkit
spec/lib/sendgrid_toolkit/common_spec.rb
Ruby
mit
92
master
1,153
require File.expand_path("#{File.dirname(__FILE__)}/../../helper") describe SendgridToolkit::Common do before do class FakeClass < SendgridToolkit::AbstractSendgridClient include SendgridToolkit::Common end @fake_class = FakeClass.new("fakeuser", "fakepass") end it "creates a module_name meth...
github
freerobby/sendgrid_toolkit
https://github.com/freerobby/sendgrid_toolkit
spec/lib/sendgrid_toolkit/v3/groups_spec.rb
Ruby
mit
92
master
1,321
require File.expand_path("#{File.dirname(__FILE__)}/../../../helper") describe SendgridToolkit::V3::Groups do before do FakeWeb.clean_registry api_name = ENV['TEST_SMTP_USERNAME'] || 'fakeuser' api_key = ENV['TEST_SMTP_PASSWORD'] || 'fakepass' @obj = SendgridToolkit::V3::Groups.new(api_name, api_key)...
github
freerobby/sendgrid_toolkit
https://github.com/freerobby/sendgrid_toolkit
spec/lib/sendgrid_toolkit/v3/unsubscribes_spec.rb
Ruby
mit
92
master
2,054
require File.expand_path("#{File.dirname(__FILE__)}/../../../helper") describe SendgridToolkit::V3::Unsubscribes do before do FakeWeb.clean_registry api_name = ENV['TEST_SMTP_USERNAME'] || 'fakeuser' api_key = ENV['TEST_SMTP_PASSWORD'] || 'fakepass' @obj = SendgridToolkit::V3::Unsubscribes.new(api_na...
github
freerobby/sendgrid_toolkit
https://github.com/freerobby/sendgrid_toolkit
spec/lib/sendgrid_toolkit/v3/abstract_sendgrid_client_spec.rb
Ruby
mit
92
master
4,028
require File.expand_path("#{File.dirname(__FILE__)}/../../../helper") describe SendgridToolkit::V3::AbstractSendgridClient do before do backup_env end after do restore_env end describe '#api_post' do it "throws error when authentication fails" do FakeWeb.register_uri(:post, %r|https://#{RE...
github
freerobby/sendgrid_toolkit
https://github.com/freerobby/sendgrid_toolkit
spec/lib/sendgrid_toolkit/newsletter/newsletter_sendgrid_client_spec.rb
Ruby
mit
92
master
804
require File.expand_path("#{File.dirname(__FILE__)}/../../../helper") describe SendgridToolkit::NewsletterSendgridClient do specify do SendgridToolkit::NewsletterSendgridClient. should be < SendgridToolkit::AbstractSendgridClient end describe '#api_post' do before { FakeWeb.clean_registry } ...
github
c7/hazel
https://github.com/c7/hazel
Rakefile
Ruby
mit
92
master
204
# encoding: utf-8 require "rake/testtask" require "bundler/gem_tasks" Rake::TestTask.new(:spec) do |test| test.libs << 'lib' << 'spec' test.pattern = 'spec/**/*_spec.rb' end task :default => :spec
github
c7/hazel
https://github.com/c7/hazel
hazel.gemspec
Ruby
mit
92
master
973
lib = File.expand_path('../lib/', __FILE__) $:.unshift lib unless $:.include?(lib) require 'hazel/version' Gem::Specification.new do |s| s.name = "hazel" s.version = Hazel::VERSION::STRING s.summary = "A simple Sinatra app generator." s.description = "Hazel is a generator for Sinatra apps, heav...
github
c7/hazel
https://github.com/c7/hazel
lib/hazel/cli.rb
Ruby
mit
92
master
3,806
# encoding: UTF-8 require "extensions/string" require "thor/group" module Hazel class CLI < Thor::Group include Thor::Actions desc "Creates a new Sinatra application" argument :name, :type => :string, :desc => "The name of the new application" class_option :capistrano, :type => :boolean, :desc => "...
github
c7/hazel
https://github.com/c7/hazel
lib/templates/Rakefile
Ruby
mit
92
master
470
%w{ bundler find rake/testtask}.each { |lib| require lib } task :default => :spec Rake::TestTask.new(:spec) do |t| t.test_files = FileList['spec/*_spec.rb'] end <% unless @database.empty? -%> namespace :db do desc "Run all migrations in db/migrate" task :migrate => :connect do Sequel.extension(:migration) ...
github
c7/hazel
https://github.com/c7/hazel
lib/templates/Gemfile
Ruby
mit
92
master
810
source "https://rubygems.org/" # App Stack gem "sinatra", "~> 1.4" <% unless @database.empty? -%> # Database Stack <% unless @database == 'mongo' -%> gem "sequel" <% end -%> <% if @database == "sqlite" -%> gem "sqlite3" <% elsif @database == "postgres" -%> gem "pg" <% elsif @database == "mysql" -%> gem "mysql2" <% el...
github
c7/hazel
https://github.com/c7/hazel
lib/templates/config.ru
Ruby
mit
92
master
361
# Load path and gems/bundler $LOAD_PATH << File.expand_path(File.dirname(__FILE__)) require "bundler" Bundler.require # Local config require "find" %w{config/initializers lib}.each do |load_path| Find.find(load_path) { |f| require f unless f.match(/\/\..+$/) || File.directory?(f) } end # Load app require "<...
github
c7/hazel
https://github.com/c7/hazel
lib/templates/config/initializers/database.rb
Ruby
mit
92
master
267
<% unless @database.empty? -%> require "yaml" settings = YAML::load_file("config/db.yml") <% if @database != 'mongo' -%> # Sequel Configuration require "sequel" DB = Sequel.connect(settings[ENV['RACK_ENV']]) <% else -%> # MongoDB Configuration <% end -%> <% end -%>
github
c7/hazel
https://github.com/c7/hazel
lib/templates/spec/spec_helper.rb
Ruby
mit
92
master
444
# encoding: UTF-8 require 'bundler' Bundler.setup Bundler.require ENV["RACK_ENV"] = "test" require 'minitest/pride' require 'minitest/autorun' require 'minitest/spec' require 'rack/test' <% if @redis %> require 'fakeredis' REDIS = Redis.new <% end %> require "find" %w{./config/initializers ./lib}.each do |load_pat...
github
c7/hazel
https://github.com/c7/hazel
lib/templates/spec/app_spec.rb
Ruby
mit
92
master
281
require_relative "spec_helper" require_relative "../<%= @name %>.rb" def app <%= @name.camel_case %> end describe <%= @name.camel_case %> do it "responds with a welcome message" do get '/' last_response.body.must_include 'Welcome to the Sinatra Template!' end end
github
c7/hazel
https://github.com/c7/hazel
lib/extensions/string.rb
Ruby
mit
92
master
831
module Hazel module Extensions module String def camel_case return self.gsub(/^./) { |l| l.capitalize } if !match(/[_-]/) altered_self = self.downcase.capitalize altered_self.scan(/[_-][a-zA-Z]/).each do |match| altered_self.gsub!(match, match[1].upcase) end ...
github
c7/hazel
https://github.com/c7/hazel
spec/string_extension_spec.rb
Ruby
mit
92
master
1,482
require_relative "spec_helper" require_relative "../lib/extensions/string.rb" describe String do it "should ignore an already camel cased string" do "MyApp".camel_case.must_equal "MyApp" end it "should capitalize an all lower case string" do "myapp".camel_case.must_equal "Myapp" end it "should came...
github
c7/hazel
https://github.com/c7/hazel
spec/hazel/version_spec.rb
Ruby
mit
92
master
636
require_relative "../spec_helper" require_relative "../../lib/hazel/version" describe Hazel::VERSION do subject { Hazel::VERSION } let(:major) { subject::MAJOR } let(:minor) { subject::MINOR } let(:tiny) { subject::TINY } let(:string) { subject::STRING } it "should have a major version" do ma...
github
c7/hazel
https://github.com/c7/hazel
spec/hazel/cli_spec.rb
Ruby
mit
92
master
389
require 'fakefs' require_relative "../spec_helper" require_relative "../../lib/hazel/cli" describe Hazel::VERSION do subject { Hazel::CLI } describe "source_root" do it "should return with a full path" do pwd = File.dirname(__FILE__) template_path = pwd.sub 'spec/hazel', 'lib/templates' ...
github
justinweiss/bulk_cache_fetcher
https://github.com/justinweiss/bulk_cache_fetcher
Rakefile
Ruby
mit
92
master
320
require "bundler/gem_tasks" require "rake/testtask" require "rdoc/task" task :default => :test Rake::TestTask.new do |t| t.libs << "test" t.test_files = FileList['test/*_test.rb'] end Rake::RDocTask.new do |rd| rd.main = "README.md" rd.rdoc_files.include("README.md", "lib/**/*.rb") rd.rdoc_dir = 'doc' end
github
justinweiss/bulk_cache_fetcher
https://github.com/justinweiss/bulk_cache_fetcher
bulk_cache_fetcher.gemspec
Ruby
mit
92
master
1,089
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'bulk_cache_fetcher' Gem::Specification.new do |spec| spec.name = "bulk_cache_fetcher" spec.version = BulkCacheFetcher::VERSION spec.authors = ["Justin Weiss"] spec.em...
github
justinweiss/bulk_cache_fetcher
https://github.com/justinweiss/bulk_cache_fetcher
test/bulk_cache_fetcher_test.rb
Ruby
mit
92
master
3,156
require 'test_helper' class InMemoryCache attr_accessor :cache, :options def initialize(options = {}) @cache = {} @options = {} end def read(key); cache[key]; end def write(key, value, opts = {}); options[key] = opts; cache[key] = value; end def read_multi(*keys) results = {} keys.each do...
github
justinweiss/bulk_cache_fetcher
https://github.com/justinweiss/bulk_cache_fetcher
lib/bulk_cache_fetcher.rb
Ruby
mit
92
master
4,335
# Fetches many objects from a cache in order. In the event that some # objects can't be served from the cache, you will have the # opportunity to fetch them in bulk. This allows you to preload and # cache entire object hierarchies, which works particularly well with # Rails' nested caching while avoiding the n+1 querie...
github
bsnape/rspec-terraform
https://github.com/bsnape/rspec-terraform
rspec-terraform.gemspec
Ruby
mit
92
master
981
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'rspec-terraform/version' Gem::Specification.new do |spec| spec.name = 'rspec-terraform' spec.version = RSpec::Terraform::VERSION spec.authors = ['Ben Snape'] spec.ema...
github
bsnape/rspec-terraform
https://github.com/bsnape/rspec-terraform
spec/create_a_plan_matcher_spec.rb
Ruby
mit
92
master
1,520
describe 'create a plan matcher' do it 'expects plan.tf and terraform.tfstate to exist in the root directory' do create_plan_file create_state_file expect { expect('').to create_a_plan }.not_to output.to_stderr_from_any_process delete_plan_file delete_state_file end context 'when plan.tf doe...
github
bsnape/rspec-terraform
https://github.com/bsnape/rspec-terraform
spec/require_variables_matcher_spec.rb
Ruby
mit
92
master
1,775
describe 'require variables matcher' do after(:each) do delete_variables_file end context 'when a module expects one variable' do before(:each) do variables = 'variable "foo" {}' create_variables_file variables end it 'passes the assertion when the correct variables are provided' do ...
github
bsnape/rspec-terraform
https://github.com/bsnape/rspec-terraform
lib/rspec-terraform.rb
Ruby
mit
92
master
832
require 'bundler/setup' require 'rspec/expectations' require 'open3' require 'rspec' require_relative 'rspec-terraform/version' require_relative 'rspec-terraform/matchers/create_a_plan' require_relative 'rspec-terraform/matchers/require_variables' RSpec.configure do |config| # https://github.com/hashicorp/terraform...
github
bsnape/rspec-terraform
https://github.com/bsnape/rspec-terraform
lib/rspec-terraform/matchers/require_variables.rb
Ruby
mit
92
master
758
RSpec::Matchers.define :require_variables do |expected_variables| match do |command| Open3.popen3(command) do |_stdin, _stdout, stderr, _wait_thr| @stderr = stderr.read end @missing_variables = @stderr.scan(/not set: (\w+)/).flatten @missing_variables.sort == expected_variables.sort end fa...
github
bsnape/rspec-terraform
https://github.com/bsnape/rspec-terraform
lib/rspec-terraform/matchers/create_a_plan.rb
Ruby
mit
92
master
479
RSpec::Matchers.define :create_a_plan do match do |command| Open3.popen3(command) do |_stdin, stdout, stderr, _wait_thr| @stderr = stderr.read @stdout = stdout.read end plan_file = File.exist?('plan.tf') tfstate_file = File.exist?('terraform.tfstate') plan_file && tfstate_file && ...
github
mhutter/string-similarity
https://github.com/mhutter/string-similarity
string-similarity.gemspec
Ruby
mit
92
master
1,223
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'string/similarity/version' Gem::Specification.new do |spec| spec.name = 'string-similarity' spec.version = String::Similarity::VERSION spec.authors = ['Manuel Hutter'] ...