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
plehoux/heybill
https://github.com/plehoux/heybill
lib/heybill/fetch.rb
Ruby
mit
49
master
631
module Heybill class Fetch < Thor Heybill::Provider.all.each do |provider| desc "fetch #{provider.name}", "Fetch bills from #{provider.name}" option :from, required: true, desc: "e.g. 'june 2012'" option :to, required: true, desc: "e.g. 'june 2013'" option :save_to, ...
github
plehoux/heybill
https://github.com/plehoux/heybill
lib/heybill/utils.rb
Ruby
mit
49
master
755
module Heybill module Utils module_function def camelize(word, first_letter_in_uppercase = true) if first_letter_in_uppercase word.to_s.gsub(/\/(.?)/) { "::" + $1.upcase }.gsub(/(^|_)(.)/) { $2.upcase } else word.first + camelize(word)[1..-1] end end def underscore(ca...
github
plehoux/heybill
https://github.com/plehoux/heybill
lib/heybill/provider.rb
Ruby
mit
49
master
3,055
require 'ostruct' require 'chronic' require 'open-uri' require 'pathname' require 'capybara' require 'capybara/dsl' require 'capybara/poltergeist' Capybara.run_server = false Capybara.register_driver :poltergeist do |app| Capybara::Poltergeist::Driver.new(app, js_errors: false, phantomjs_logger: File::NULL ...
github
plehoux/heybill
https://github.com/plehoux/heybill
lib/heybill/cli.rb
Ruby
mit
49
master
352
require 'heybill/fetch' module Heybill class CLI < Thor desc 'fetch [PROVIDER] ...ARGS', 'Fetch bill(s) from provider' subcommand 'fetch', Heybill::Fetch desc 'providers', 'List all providers' def providers Heybill::Provider.all.each do |provider| say Heybill::Utils.humanize provider.n...
github
plehoux/heybill
https://github.com/plehoux/heybill
lib/heybill/providers/webfaction.rb
Ruby
mit
49
master
1,141
module Heybill module Providers class Webfaction < Heybill::Provider ask :username ask :password log_in do login_url = 'https://my.webfaction.com/' visit login_url fill_in 'id_username', with: @username fill_in 'id_password', with: @password click_button ...
github
plehoux/heybill
https://github.com/plehoux/heybill
lib/heybill/providers/github.rb
Ruby
mit
49
master
974
module Heybill module Providers class Github < Heybill::Provider ask :username ask :password log_in do login_url = 'https://github.com/login' visit login_url fill_in 'login_field', with: @username fill_in 'password', with: @password click_button 'Sign in'...
github
plehoux/heybill
https://github.com/plehoux/heybill
lib/heybill/providers/videotron_business.rb
Ruby
mit
49
master
978
module Heybill module Providers class VideotronBusiness < Heybill::Provider ask :username ask :password log_in do login_url = 'https://www.videotron.com/client/affaires/dashboard.do?locale=en' visit login_url fill_in 'monCodeUtilEC', with: @username fill_in 'pswM...
github
plehoux/heybill
https://github.com/plehoux/heybill
lib/heybill/providers/telus_mobility.rb
Ruby
mit
49
master
884
module Heybill module Providers class TelusMobility < Heybill::Provider ask :email ask :password log_in do login_url = 'https://mobility.telus.com/sso/UI/Login?realm=telus&service=telusmobility&locale=en' visit login_url fill_in 'IDToken1', with: @email fill_in '...
github
plehoux/heybill
https://github.com/plehoux/heybill
lib/heybill/providers/aws.rb
Ruby
mit
49
master
1,608
module Heybill module Providers class Aws < Heybill::Provider USERAGENT = {"User-Agent" => "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.57 Safari/537.36" } BASEURL = 'https://portal.aws.amazon.com/gp/aws' ask :email ask :password log...
github
plehoux/heybill
https://github.com/plehoux/heybill
lib/heybill/providers/pingdom.rb
Ruby
mit
49
master
1,486
module Heybill module Providers class Pingdom < Heybill::Provider ask :email ask :password log_in do login_url = 'https://my.pingdom.com/' visit login_url fill_in 'email', with: @email fill_in 'password', with: @password click_button 'Log In' !pag...
github
plehoux/heybill
https://github.com/plehoux/heybill
lib/heybill/providers/heroku.rb
Ruby
mit
49
master
814
module Heybill module Providers class Heroku < Heybill::Provider ask :email ask :password log_in do login_url = 'https://id.heroku.com/login' visit login_url fill_in 'email', with: @email fill_in 'password', with: @password click_button 'Log In' c...
github
plehoux/heybill
https://github.com/plehoux/heybill
lib/heybill/providers/hetzner.rb
Ruby
mit
49
master
1,368
module Heybill module Providers class Hetzner < Heybill::Provider ask :username ask :password log_in do visit 'https://robot.your-server.de/login' fill_in 'user', with: @username fill_in 'password', with: @password find('.submit_row input[type=submit]').click ...
github
beerlington/render_csv
https://github.com/beerlington/render_csv
render_csv.gemspec
Ruby
mit
49
master
872
# -*- encoding: utf-8 -*- require File.expand_path('../lib/render_csv/version', __FILE__) Gem::Specification.new do |gem| gem.authors = ["Peter Brown"] gem.email = ["github@lette.us"] gem.description = "Adds a custom CSV renderer to Rails applications" gem.summary = "Adds a custom CSV ren...
github
beerlington/render_csv
https://github.com/beerlington/render_csv
lib/render_csv.rb
Ruby
mit
49
master
536
module RenderCsv class RenderCsvRailtie < ::Rails::Railtie config.after_initialize do require 'render_csv/csv_renderable' require 'action_controller/metal/renderers' ActionController.add_renderer :csv do |csv, options| filename = options[:filename] || options[:template] csv.exte...
github
beerlington/render_csv
https://github.com/beerlington/render_csv
lib/render_csv/csv_renderable.rb
Ruby
mit
49
master
905
require 'csv' module RenderCsv module CsvRenderable # Converts an array to CSV formatted string # Options include: # :only => [:col1, :col2] # Specify which columns to include # :except => [:col1, :col2] # Specify which columns to exclude # :add_methods => [:method1, :method2] # Include addtional...
github
beerlington/render_csv
https://github.com/beerlington/render_csv
spec/spec_helper.rb
Ruby
mit
49
master
876
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $LOAD_PATH.unshift(File.dirname(__FILE__)) require 'rails/all' require 'rspec/rails' require 'render_csv/csv_renderable' # Requires supporting files with custom matchers and macros, etc, # in ./support/ and its subdirectories. Dir["#{File.dirname(__FI...
github
beerlington/render_csv
https://github.com/beerlington/render_csv
spec/lib/csv_renderable_spec.rb
Ruby
mit
49
master
2,296
require './spec/spec_helper' describe RenderCsv::CsvRenderable do let(:csv_renderable_array) { array.extend RenderCsv::CsvRenderable } context 'object is an array' do context 'array is empty' do let(:array) { Array.new } it 'returns an empty string' do expect(csv_renderable_array.to_csv)...
github
ponomarevlm/Apns4r
https://github.com/ponomarevlm/Apns4r
lib/feedbackreader.rb
Ruby
mit
49
master
421
module APNs4r class FeedbackReader < ApnsConnection attr_accessor :host, :port def initialize host = OPTIONS[:apns4r_feedback_host], port = OPTIONS[:apns4r_feedback_port] @host, @port = host, port end def read @ssl ||= connect records ||= [] while record = @@ssl.read(38) ...
github
ponomarevlm/Apns4r
https://github.com/ponomarevlm/Apns4r
lib/config.rb
Ruby
mit
49
master
513
OPTIONS = if defined?(Rails.env) raw_config = File.read(Rails.root.join("config", "apns4r.yml") parsed_config = ERB.new(raw_config).result YAML.load(parsed_config)[Rails.env].symbolize_keys else require 'erb' raw_config = File.read(File.expand_path(File.dirname(__FILE__)) + "/../apns4r.yml") ...
github
ponomarevlm/Apns4r
https://github.com/ponomarevlm/Apns4r
lib/apncore.rb
Ruby
mit
49
master
2,425
$KCODE='u' and require 'jcode' if RUBY_VERSION =~ /1.8/ require 'json' class Hash MAX_PAYLOAD_LEN = 256 # Converts hash into JSON String. # When payload is too long but can be chopped, tries to cut self.[:aps][:alert]. # If payload still don't fit Apple's restrictions, returns nil # # @return [String, nil...
github
ponomarevlm/Apns4r
https://github.com/ponomarevlm/Apns4r
lib/apnsconnection.rb
Ruby
mit
49
master
710
module APNs4r require 'socket' require 'openssl' class ApnsConnection protected def connect host, port, overrides = {} ctx = OpenSSL::SSL::SSLContext.new() ctx.cert = OpenSSL::X509::Certificate.new(File::read(overrides[:apns4r_cert_file] || OPTIONS[:apns4r_cert_file])) ctx.key = Open...
github
ponomarevlm/Apns4r
https://github.com/ponomarevlm/Apns4r
lib/sender.rb
Ruby
mit
49
master
1,801
module APNs4r class Sender < ApnsConnection attr_accessor :host, :port # Creates new {Sender} object with given host and port # # Accepts params in 2 ways, either as 2 strings : # @param [String] host default to APNs sandbox # @param [Fixnum] port don't think it can change, just in case ...
github
ponomarevlm/Apns4r
https://github.com/ponomarevlm/Apns4r
bin/sendserver.rb
Ruby
mit
49
master
1,509
#!/usr/bin/env ruby #add script's dir to require path $: << File.expand_path(File.dirname(__FILE__))+'/../' ['eventmachine', 'logger', 'lib/apns4r'].each{|lib| require lib} $logger = Logger.new("#{File.expand_path(File.dirname(__FILE__))}/../log/sendserver.log", 10, 1024000) # properly close all connections and soket...
github
vasilakisfil/api_bomb
https://github.com/vasilakisfil/api_bomb
api_bomb.gemspec
Ruby
mit
49
master
1,175
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'api_bomb/version' Gem::Specification.new do |spec| spec.name = "api_bomb" spec.version = ApiBomb::VERSION spec.authors = ["Filippos Vasilakis"] spec.email = [...
github
vasilakisfil/api_bomb
https://github.com/vasilakisfil/api_bomb
lib/api_bomb.rb
Ruby
mit
49
master
2,718
require_relative "api_bomb/version" require "benchmark" require 'celluloid/current' require 'http' require 'pickup' require 'pry' require 'descriptive_statistics' require 'descriptive_statistics/safe' require 'forwardable' require_relative 'api_bomb/lambda_hash' require_relative 'api_bomb/strategy' require_relative 'a...
github
vasilakisfil/api_bomb
https://github.com/vasilakisfil/api_bomb
lib/api_bomb/fighter.rb
Ruby
mit
49
master
583
class ApiBomb::Fighter include Celluloid attr_reader :paths, :options, :base_url def initialize(paths: nil, base_url: nil, options: {}) @base_url = base_url @options = options @paths = paths end def fire route = @paths.pick url = URI::join(base_url, route.path) response = nil h...
github
vasilakisfil/api_bomb
https://github.com/vasilakisfil/api_bomb
lib/api_bomb/signaler.rb
Ruby
mit
49
master
712
class ApiBomb::Signaler attr_reader :hold_times, :statuses def initialize @statuses = [] @hold_times = [] end def report(fighter) @statuses << fighter.value.response.status @hold_times << fighter.value.hold_time end def fighters_lost hold_times.count end def mean_hold_time ho...
github
vasilakisfil/api_bomb
https://github.com/vasilakisfil/api_bomb
lib/api_bomb/path.rb
Ruby
mit
49
master
2,083
module ApiBomb::Path class Sequence include Enumerable extend Forwardable def_delegators :@paths, :each, :<< attr_reader :paths def initialize(paths) @paths = paths end def pick return paths.sample end end class Single HTTP_METHODS = [:get, :post, :put, :patch, :...
github
vasilakisfil/api_bomb
https://github.com/vasilakisfil/api_bomb
lib/api_bomb/commander.rb
Ruby
mit
49
master
2,292
class ApiBomb::Commander include ApiBomb::Strategy::Naive attr_reader :army, :fronts, :duration, :signaler, :logger, :requests def initialize(army:, fronts: 1, duration: 10, logger: Logger.new(STDOUT), requests: nil) @duration = duration @army = army @fighters = [] @statuses = [] @hold_times...
github
vasilakisfil/api_bomb
https://github.com/vasilakisfil/api_bomb
lib/api_bomb/strategy.rb
Ruby
mit
49
master
651
module ApiBomb::Strategy module Naive def attack if requests attack_in_requests else attack_in_time end end def attack_in_time fronts.times do |i| @fighters << @army.send_fighter end while (@fighters.length > 0) do signaler.report(@figh...
github
vasilakisfil/api_bomb
https://github.com/vasilakisfil/api_bomb
lib/api_bomb/army.rb
Ruby
mit
49
master
208
class ApiBomb::Army attr_reader :fighters def initialize(fighters:) @fighters = fighters end def send_fighter @fighters.future.fire end alias_method :send_new_fighter, :send_fighter end
github
vasilakisfil/api_bomb
https://github.com/vasilakisfil/api_bomb
lib/api_bomb/lambda_hash.rb
Ruby
mit
49
master
823
#values can respond to call making them dynamic class ApiBomb::LambdaHash < SimpleDelegator def self.hasharize(hash) hash_call = self.new(hash) h = {} hash_call.each do |v, k| h[v] = hash_call[v] if h[v].is_a? self h[v] = self.hasharize(h[v]) end end return h end de...
github
linjunpop/riif
https://github.com/linjunpop/riif
riif.gemspec
Ruby
mit
49
master
1,164
# -*- encoding: utf-8 -*- lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'riif/version' Gem::Specification.new do |gem| gem.name = "riif" gem.version = Riif::VERSION gem.authors = ["Jun Lin"] gem.email = ["linjunpop@gmail....
github
linjunpop/riif
https://github.com/linjunpop/riif
lib/riif/railtie.rb
Ruby
mit
49
master
423
require 'rails' module Riif class Railtie < ::Rails::Railtie initializer 'riif' do ::ActiveSupport.on_load(:action_view) do unless ::Mime::Type.lookup_by_extension(:iif) ::Mime::Type.register "application/qbooks", :iif, %w(application/qbookspro text/iif) end r...
github
linjunpop/riif
https://github.com/linjunpop/riif
lib/riif/iif.rb
Ruby
mit
49
master
1,328
require 'csv' require 'riif/dsl/base' require 'riif/dsl/accnt' require 'riif/dsl/bud' require 'riif/dsl/ctype' require 'riif/dsl/cust' require 'riif/dsl/emp' require 'riif/dsl/invitem' require 'riif/dsl/invmemo' require 'riif/dsl/klass' require 'riif/dsl/othername' require 'riif/dsl/paymeth' require 'riif/dsl/shipmet...
github
linjunpop/riif
https://github.com/linjunpop/riif
lib/riif/dsl/vend.rb
Ruby
mit
49
master
588
module Riif::DSL class Vend < Base HEADER_COLUMNS = [ :name, :printas, :addr1, :addr2, :addr3, :addr4, :addr5, :vtype, :cont1, :phone1, :phone2, :faxnum, :note, :taxid, :limit, :terms, :notepad, :salutation...
github
linjunpop/riif
https://github.com/linjunpop/riif
lib/riif/dsl/bud.rb
Ruby
mit
49
master
212
module Riif::DSL class Bud < Base HEADER_COLUMNS = [ :accnt, :period, :amount, :startdate, :class, :customer ] START_COLUMN = 'BUD' END_COLUMN = '' end end
github
linjunpop/riif
https://github.com/linjunpop/riif
lib/riif/dsl/emp.rb
Ruby
mit
49
master
476
module Riif::DSL class Emp < Base HEADER_COLUMNS = [ :name, :init, :addr1, :addr2, :addr3, :addr4, :addr5, :ssno, :phone1, :phone2, :notepad, :firstname, :midinit, :lastname, :salutation, :custfld1, :custfld2, ...
github
linjunpop/riif
https://github.com/linjunpop/riif
lib/riif/dsl/spl.rb
Ruby
mit
49
master
401
module Riif::DSL class Spl < Base HEADER_COLUMNS = [ :splid, :trnstype, :date, :accnt, :name, :class, :amount, :docnum, :memo, :clear, :qnty, :price, :invitem, :paymeth, :taxable, :reimbexp, :extra ] STAR...
github
linjunpop/riif
https://github.com/linjunpop/riif
lib/riif/dsl/base.rb
Ruby
mit
49
master
1,155
module Riif::DSL class Base def initialize @rows = [] @current_row = [] end def build(&block) if block_given? if block.arity == 1 yield(self) else instance_eval(&block) end end output end def row(&block) @current_ro...
github
linjunpop/riif
https://github.com/linjunpop/riif
lib/riif/dsl/othername.rb
Ruby
mit
49
master
397
module Riif::DSL class Othername < Base HEADER_COLUMNS = [ :name, :baddr1, :baddr2, :baddr3, :baddr4, :baddr5, :phone1, :phone2, :faxnum, :cont1, :notepad, :salutation, :companyname, :firstname, :midinit, :lastname, ...
github
linjunpop/riif
https://github.com/linjunpop/riif
lib/riif/dsl/cust.rb
Ruby
mit
49
master
800
module Riif::DSL class Cust < Base HEADER_COLUMNS = [ :name, :baddr1, :baddr2, :baddr3, :baddr4, :baddr5, :saddr1, :saddr2, :saddr3, :saddr4, :saddr5, :phone1, :phone2, :faxnum, :cont1, :cont2, :ctype, :ter...
github
linjunpop/riif
https://github.com/linjunpop/riif
lib/riif/dsl/timerhdr.rb
Ruby
mit
49
master
240
module Riif::DSL class Timerhdr < Base HEADER_COLUMNS = [ :ver, :rel, :companyname, :importedbefore, :fromtimer, :companycreatetime ] START_COLUMN = 'TIMERHDR' END_COLUMN = '' end end
github
linjunpop/riif
https://github.com/linjunpop/riif
lib/riif/dsl/timeact.rb
Ruby
mit
49
master
256
module Riif::DSL class Timeact < Base HEADER_COLUMNS = [ :date, :job, :emp, :item, :pitem, :duration, :proj, :note, :billingstatus ] START_COLUMN = 'TIMEACT' END_COLUMN = '' end end
github
linjunpop/riif
https://github.com/linjunpop/riif
lib/riif/dsl/accnt.rb
Ruby
mit
49
master
225
module Riif::DSL class Accnt < Base HEADER_COLUMNS = [ :name, :accnttype, :obamount, :desc, :scd, :accnum, :extra ] START_COLUMN = 'ACCNT' END_COLUMN = '' end end
github
linjunpop/riif
https://github.com/linjunpop/riif
lib/riif/dsl/trns.rb
Ruby
mit
49
master
921
module Riif::DSL class Trns < Base HEADER_COLUMNS = [ :trnsid, :trnstype, :date, :accnt, :name, :class, :amount, :docnum, :memo, :clear, :toprint, :addr1, :addr2, :addr3, :addr4, :addr5, :saddr1, :saddr2, ...
github
linjunpop/riif
https://github.com/linjunpop/riif
lib/riif/dsl/invitem.rb
Ruby
mit
49
master
527
module Riif::DSL class Invitem < Base HEADER_COLUMNS = [ :name, :invitemtype, :desc, :purchasedesc, :accnt, :assetaccnt, :cogsaccnt, :price, :cost, :taxable, :paymeth, :taxvend, :taxdist, :toprint, :prefvend, :reorderp...
github
linjunpop/riif
https://github.com/linjunpop/riif
lib/riif/dsl/terms.rb
Ruby
mit
49
master
204
module Riif::DSL class Terms < Base HEADER_COLUMNS = [ :name, :duedays, :discper, :discdays, :termstype, ] START_COLUMN = 'TERMS' END_COLUMN = '' end end
github
linjunpop/riif
https://github.com/linjunpop/riif
lib/riif/rails/renderer.rb
Ruby
mit
49
master
356
module Riif module Rails class Renderer ActionController::Renderers.add :iif do |iif_string, options| filename = options[:filename] || options[:template] send_data( iif_string, filename: "#{filename}.iif", type: Mime[:iif], disposition: 'attachment' ...
github
linjunpop/riif
https://github.com/linjunpop/riif
lib/riif/rails/template_handler.rb
Ruby
mit
49
master
408
module Riif module Rails class TemplateHandler cattr_accessor :default_format self.default_format = Mime[:iif] def self.call(template, source = nil) source ||= template.source <<-RUBY iif = ::Riif::IIF.new #{source} iif.output RUBY ...
github
linjunpop/riif
https://github.com/linjunpop/riif
spec/spec_helper.rb
Ruby
mit
49
master
510
require 'bundler' Bundler.require(:development) require 'coveralls' Coveralls.wear! require 'riif' # This line has to before require 'rspec/rails' Combustion.initialize! :action_controller, :action_view require 'rspec/rails' RSpec.configure do |config| config.expect_with(:rspec) { |c| c.syntax = :should } conf...
github
linjunpop/riif
https://github.com/linjunpop/riif
spec/riif/iif_spec.rb
Ruby
mit
49
master
1,099
require 'spec_helper' describe Riif::IIF do context 'mixed document' do let(:expected) { File.read('spec/fixtures/mixed.iif') } let(:mixed) { Riif::IIF.new do cust do row do name 'Batman' baddr1 'Amoy' end end bud do row d...
github
linjunpop/riif
https://github.com/linjunpop/riif
spec/riif/dsl/vtype_spec.rb
Ruby
mit
49
master
301
require 'spec_helper' describe Riif::DSL::Vtype do let(:expected) { File.read('spec/fixtures/vtype.iif') } let(:vtype) { Riif::IIF.new do vtype do row do name 'vtype 1' end end end } subject { vtype } its(:output) { should eq expected } end
github
linjunpop/riif
https://github.com/linjunpop/riif
spec/riif/dsl/accnt_spec.rb
Ruby
mit
49
master
347
require 'spec_helper' describe Riif::DSL::Accnt do let(:expected) { File.read('spec/fixtures/accnt.iif') } let(:accnt) { Riif::IIF.new do accnt do row do name 'Jun Lin' accnttype 'AR' accnum 47 end end end } subject { accnt } its(:output) ...
github
linjunpop/riif
https://github.com/linjunpop/riif
spec/riif/dsl/vend_spec.rb
Ruby
mit
49
master
347
require 'spec_helper' describe Riif::DSL::Vend do let(:expected) { File.read('spec/fixtures/vend.iif') } let(:vend) { Riif::IIF.new do vend do row do name 'Jun Lin' phone1 '12312323242' _1099 'Y' end end end } subject { vend } its(:output) ...
github
linjunpop/riif
https://github.com/linjunpop/riif
spec/riif/dsl/timeact_spec.rb
Ruby
mit
49
master
639
require 'spec_helper' describe Riif::DSL::Timeact do let(:expected) { File.read('spec/fixtures/timeact.iif') } let(:timeact) { Riif::IIF.new do timerhdr do row do ver 8 rel 0 companyname 'Import Test Company' importedbefore 'N' fromtimer 'Y' companycre...
github
linjunpop/riif
https://github.com/linjunpop/riif
spec/riif/dsl/terms_spec.rb
Ruby
mit
49
master
387
require 'spec_helper' describe Riif::DSL::Terms do let(:expected) { File.read('spec/fixtures/terms.iif') } let(:terms) { Riif::IIF.new do terms do row do name 'terms 1' duedays 10 discper 0.3 discdays 1 termstype 0 end end end ...
github
linjunpop/riif
https://github.com/linjunpop/riif
spec/riif/dsl/klass_spec.rb
Ruby
mit
49
master
298
require 'spec_helper' describe Riif::DSL::Klass do let(:expected) { File.read('spec/fixtures/klass.iif') } let(:klass) { Riif::IIF.new do klass do row do name 'Foo' end end end } subject { klass } its(:output) { should eq expected } end
github
linjunpop/riif
https://github.com/linjunpop/riif
spec/riif/dsl/ctype_spec.rb
Ruby
mit
49
master
297
require 'spec_helper' describe Riif::DSL::Ctype do let(:expected) { File.read('spec/fixtures/ctype.iif') } let(:ctype) { Riif::IIF.new do ctype do row do name 'Bar' end end end } subject { ctype } its(:output) { should eq expected } end
github
linjunpop/riif
https://github.com/linjunpop/riif
spec/riif/dsl/trns_spec.rb
Ruby
mit
49
master
2,254
require 'spec_helper' describe Riif::DSL::Trns do subject { trns } let(:expected) { File.read('spec/fixtures/trns.iif') } let(:trns) do Riif::IIF.new do trns do row do trnsid 123 trnstype 'INVOICE' date '8/31/1988' accnt 'Accounts Receivable' ...
github
linjunpop/riif
https://github.com/linjunpop/riif
spec/riif/dsl/invmemo_spec.rb
Ruby
mit
49
master
313
require 'spec_helper' describe Riif::DSL::Invmemo do let(:expected) { File.read('spec/fixtures/invmemo.iif') } let(:invmemo) { Riif::IIF.new do invmemo do row do name 'invmemo 1' end end end } subject { invmemo } its(:output) { should eq expected } end
github
linjunpop/riif
https://github.com/linjunpop/riif
spec/riif/dsl/invitem_spec.rb
Ruby
mit
49
master
368
require 'spec_helper' describe Riif::DSL::Invitem do let(:expected) { File.read('spec/fixtures/invitem.iif') } let(:invitem) { Riif::IIF.new do invitem do row do name 'invitem 1' invitemtype 'INVENTORY' dep_type 1 end end end } subject { invit...
github
linjunpop/riif
https://github.com/linjunpop/riif
spec/riif/dsl/bud_spec.rb
Ruby
mit
49
master
462
require 'spec_helper' class Invoice attr_accessor :name def initialize(n) @name = n end end describe Riif::DSL::Bud do let(:expected) { File.read('spec/fixtures/bud.iif') } let(:bud) { Riif::IIF.new do bud do row do accnt 'Accounts Receivable' period 'MONTH' ...
github
linjunpop/riif
https://github.com/linjunpop/riif
spec/riif/dsl/paymeth_spec.rb
Ruby
mit
49
master
313
require 'spec_helper' describe Riif::DSL::Paymeth do let(:expected) { File.read('spec/fixtures/paymeth.iif') } let(:paymeth) { Riif::IIF.new do paymeth do row do name 'paymeth 1' end end end } subject { paymeth } its(:output) { should eq expected } end
github
linjunpop/riif
https://github.com/linjunpop/riif
spec/riif/dsl/shipmeth_spec.rb
Ruby
mit
49
master
319
require 'spec_helper' describe Riif::DSL::Shipmeth do let(:expected) { File.read('spec/fixtures/shipmeth.iif') } let(:shipmeth) { Riif::IIF.new do shipmeth do row do name 'shipmeth 1' end end end } subject { shipmeth } its(:output) { should eq expected } end
github
linjunpop/riif
https://github.com/linjunpop/riif
spec/riif/dsl/emp_spec.rb
Ruby
mit
49
master
391
require 'spec_helper' describe Riif::DSL::Emp do let(:expected) { File.read('spec/fixtures/emp.iif') } let(:emp) { Riif::IIF.new do emp do row do name 'Alfred' init 'Master' addr1 'Backer' addr2 '37' salutation 'Doctor' end end ...
github
linjunpop/riif
https://github.com/linjunpop/riif
spec/riif/dsl/othername_spec.rb
Ruby
mit
49
master
392
require 'spec_helper' describe Riif::DSL::Othername do let(:expected) { File.read('spec/fixtures/othername.iif') } let(:othername) { Riif::IIF.new do othername do row do name 'Alfred' baddr1 'Backer' baddr2 '37' faxnum '123' end end end ...
github
linjunpop/riif
https://github.com/linjunpop/riif
spec/riif/dsl/cust_spec.rb
Ruby
mit
49
master
327
require 'spec_helper' describe Riif::DSL::Cust do let(:expected) { File.read('spec/fixtures/cust.iif') } let(:cust) { Riif::IIF.new do cust do row do name 'Jun Lin' phone1 '12312323242' end end end } subject { cust } its(:output) { should eq expected...
github
linjunpop/riif
https://github.com/linjunpop/riif
spec/controllers/invoices_controller_spec.rb
Ruby
mit
49
master
574
require 'spec_helper' describe InvoicesController do render_views let(:expected) { File.read('spec/fixtures/rails/invoices.iif') } describe '#index' do before do get :index, format: 'iif' end it 'respond with rendered iif' do response.body.should eq expected end it 'respond w...
github
linjunpop/riif
https://github.com/linjunpop/riif
spec/internal/app/controllers/invoices_controller.rb
Ruby
mit
49
master
228
class InvoicesController < ActionController::Base def index respond_to do |format| format.iif { render iif: render_to_string(locals: {awesome: "Bender"}), filename: 'batman' } end end end
github
ankane/plu
https://github.com/ankane/plu
plu.gemspec
Ruby
mit
49
master
489
require_relative "lib/plu/version" Gem::Specification.new do |spec| spec.name = "plu" spec.version = PLU::VERSION spec.summary = "Price look-up codes made easy" spec.homepage = "https://github.com/ankane/plu" spec.license = "MIT" spec.author = "Andrew Kane" spec.em...
github
ankane/plu
https://github.com/ankane/plu
Rakefile
Ruby
mit
49
master
995
require "bundler/gem_tasks" require "rake/testtask" Rake::TestTask.new do |t| t.pattern = "test/**/*_test.rb" end task default: :test task :update, [:file] do |t, args| require "csv" require "json" codes = {} CSV.foreach(args.file, headers: true) do |row| size = row["SIZE"].strip =~ /all.+sizes/i ? ni...
github
ankane/plu
https://github.com/ankane/plu
test/plu_test.rb
Ruby
mit
49
master
856
require_relative "test_helper" class PLUTest < Minitest::Test def test_plu plu = PLU.new(4011) assert_equal true, plu.valid? assert_equal false, plu.organic? assert_equal false, plu.retailer_assigned? end def test_organic assert_equal true, PLU.new(94011).organic? end def test_invalid ...
github
ankane/plu
https://github.com/ankane/plu
lib/plu.rb
Ruby
mit
49
master
550
# stdlib require "json" # modules require_relative "plu/version" class PLU def initialize(number) @number = number.to_s end def valid? /\A[89]?[34]\d{3}\z/.match?(@number) end def name self.class.all[base] end def organic? modifier == "9" end def retailer_assigned? name.to_s....
github
rubocop/rubocop-capybara
https://github.com/rubocop/rubocop-capybara
Gemfile
Ruby
mit
49
main
407
# frozen_string_literal: true source 'https://rubygems.org' gemspec gem 'bump' gem 'danger' gem 'irb' # undeclared dependency of yard gem 'rack' gem 'rake' gem 'rspec', '~> 3.11' gem 'rubocop-performance', '~> 1.24' gem 'rubocop-rake', '~> 0.7' gem 'rubocop-rspec', '~> 3.5' gem 'simplecov', '>= 0.19' gem 'yard' loc...
github
rubocop/rubocop-capybara
https://github.com/rubocop/rubocop-capybara
Dangerfile
Ruby
mit
49
main
294
# frozen_string_literal: true diff = git.diff_for_file('config/default.yml') if diff && diff.patch =~ /^\+\s*Enabled: true$/ warn(<<~MESSAGE) There is a cop that became `Enabled: true` due to this pull request. Please review the diff and make sure there are no issues. MESSAGE end
github
rubocop/rubocop-capybara
https://github.com/rubocop/rubocop-capybara
Rakefile
Ruby
mit
49
main
2,721
# frozen_string_literal: true require 'open3' require 'bundler' require 'bundler/gem_tasks' begin Bundler.setup(:default, :development) rescue Bundler::BundlerError => e warn e.message warn 'Run `bundle install` to install missing gems' exit e.status_code end require 'rspec/core/rake_task' require 'rubocop/...
github
rubocop/rubocop-capybara
https://github.com/rubocop/rubocop-capybara
rubocop-capybara.gemspec
Ruby
mit
49
main
1,243
# frozen_string_literal: true $LOAD_PATH.unshift File.expand_path('lib', __dir__) require 'rubocop/capybara/version' Gem::Specification.new do |spec| spec.name = 'rubocop-capybara' spec.summary = 'Code style checking for Capybara test files' spec.description = <<~DESCRIPTION Code style checking for Capybara...
github
rubocop/rubocop-capybara
https://github.com/rubocop/rubocop-capybara
spec/spec_helper.rb
Ruby
mit
49
main
1,211
# frozen_string_literal: true require 'rubocop' require 'rubocop/rspec/support' # `expect_offense` etc require 'simplecov' unless ENV['NO_COVERAGE'] module SpecHelper ROOT = Pathname.new(__dir__).parent.freeze end spec_helper_glob = '{support,shared,../lib/rubocop/capybara/shared_contexts}/*.rb' Dir .glob(Fil...
github
rubocop/rubocop-capybara
https://github.com/rubocop/rubocop-capybara
spec/project/default_config_spec.rb
Ruby
mit
49
main
3,448
# frozen_string_literal: true RSpec.describe 'config/default.yml' do subject(:default_config) do RuboCop::ConfigLoader.load_file('config/default.yml') end let(:namespaces) do { 'capybara' => 'Capybara', 'rspec' => 'Capybara/RSpec' } end let(:cop_names) do glob = SpecHelper::R...
github
rubocop/rubocop-capybara
https://github.com/rubocop/rubocop-capybara
spec/rubocop/cop/capybara/redundant_within_find_spec.rb
Ruby
mit
49
main
3,065
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Capybara::RedundantWithinFind, :config do it 'registers an offense when using `within find(...)`' do expect_offense(<<~RUBY) within find('foo.bar') do ^^^^^^^^^^^^^^^ Redundant `within find(...)` call detected. end RUBY ...
github
rubocop/rubocop-capybara
https://github.com/rubocop/rubocop-capybara
spec/rubocop/cop/capybara/specific_actions_spec.rb
Ruby
mit
49
main
8,459
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Capybara::SpecificActions do it 'does not register an offense for find and click action when ' \ 'first argument is link' do expect_no_offenses(<<~RUBY) find('a').click RUBY end it 'registers an offense when using find and click actio...
github
rubocop/rubocop-capybara
https://github.com/rubocop/rubocop-capybara
spec/rubocop/cop/capybara/specific_finders_spec.rb
Ruby
mit
49
main
9,089
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Capybara::SpecificFinders do it 'registers an offense when using `find`' do expect_offense(<<~RUBY) find('#some-id') ^^^^^^^^^^^^^^^^ Prefer `find_by_id` over `find`. RUBY expect_correction(<<~RUBY) find_by_id('some-id') RU...
github
rubocop/rubocop-capybara
https://github.com/rubocop/rubocop-capybara
spec/rubocop/cop/capybara/assert_style_spec.rb
Ruby
mit
49
main
655
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Capybara::AssertStyle do it 'registers an offense when using `assert_style`' do expect_offense(<<~RUBY) page.find(:css, '#first').assert_style(display: 'block') ^^^^^^^^^^^^ Use `assert_matches_style` instead of `ass...
github
rubocop/rubocop-capybara
https://github.com/rubocop/rubocop-capybara
spec/rubocop/cop/capybara/find_all_first_spec.rb
Ruby
mit
49
main
5,402
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Capybara::FindAllFirst, :config do it 'registers an offense when using `all` with `first`' do expect_offense(<<~RUBY) all('a').first ^^^^^^^^^^^^^^ Use `first('a')`. RUBY expect_correction(<<~RUBY) first('a') RUBY end ...
github
rubocop/rubocop-capybara
https://github.com/rubocop/rubocop-capybara
spec/rubocop/cop/capybara/click_link_or_button_style_spec.rb
Ruby
mit
49
main
1,923
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Capybara::ClickLinkOrButtonStyle do let(:cop_config) { { 'EnforcedStyle' => enforced_style } } let(:enforced_style) { 'strict' } context 'when EnforcedStyle is `strict`' do let(:enforced_style) { 'strict' } it 'registers an offense when using `...
github
rubocop/rubocop-capybara
https://github.com/rubocop/rubocop-capybara
spec/rubocop/cop/capybara/ambiguous_click_spec.rb
Ruby
mit
49
main
811
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Capybara::AmbiguousClick do it 'registers an offense when using `click_link_or_button`' do expect_offense(<<~RUBY) click_link_or_button('foo') ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use `click_link` or `click_button` instead of `click_link_or_button`. ...
github
rubocop/rubocop-capybara
https://github.com/rubocop/rubocop-capybara
spec/rubocop/cop/capybara/mixin/css_attributes_parser_spec.rb
Ruby
mit
49
main
1,146
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Capybara::CssAttributesParser do describe 'CssSelector.new.parse' do it 'returns attributes hash when specify attributes' do expect(described_class.new('a[foo-bar_baz]').parse).to eq( 'foo-bar_baz' => nil ) expect(described_clas...
github
rubocop/rubocop-capybara
https://github.com/rubocop/rubocop-capybara
spec/rubocop/cop/capybara/mixin/css_selector_spec.rb
Ruby
mit
49
main
6,097
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Capybara::CssSelector do describe 'CssSelector.id' do context 'when string whose argument begins with `#`' do it 'returns id string' do expect(described_class.id('#some-id')).to eq 'some-id' expect(described_class.id('#some-id.cls')...
github
rubocop/rubocop-capybara
https://github.com/rubocop/rubocop-capybara
spec/rubocop/cop/capybara/rspec/visibility_matcher_spec.rb
Ruby
mit
49
main
5,541
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Capybara::RSpec::VisibilityMatcher do it 'registers an offense when using `visible: true`' do expect_offense(<<~RUBY) expect(page).to have_selector('.my_element', visible: true) ^^^^^^^^^^^^^ Use `...
github
rubocop/rubocop-capybara
https://github.com/rubocop/rubocop-capybara
spec/rubocop/cop/capybara/rspec/specific_matcher_spec.rb
Ruby
mit
49
main
12,160
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Capybara::RSpec::SpecificMatcher do it 'does not register an offense for abstract matcher when ' \ 'first argument is not a replaceable element' do expect_no_offenses(<<~RUBY) expect(page).to have_selector('article') expect(page).to have...
github
rubocop/rubocop-capybara
https://github.com/rubocop/rubocop-capybara
spec/rubocop/cop/capybara/rspec/negation_matcher_after_visit_spec.rb
Ruby
mit
49
main
1,017
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Capybara::RSpec::NegationMatcherAfterVisit, :config do it 'registers an offense when using `have_no_*` after ' \ 'immediately `visit` method call' do expect_offense(<<~RUBY) visit foo_path expect(page).to have_no_link('bar...
github
rubocop/rubocop-capybara
https://github.com/rubocop/rubocop-capybara
spec/rubocop/cop/capybara/rspec/predicate_matcher_spec.rb
Ruby
mit
49
main
5,452
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Capybara::RSpec::PredicateMatcher, :config do let(:cop_config) do { 'EnforcedStyle' => enforced_style, 'Strict' => strict, 'AllowedExplicitMatchers' => allowed_explicit_matchers } end let(:allowed_explicit_matchers) { [] } co...
github
rubocop/rubocop-capybara
https://github.com/rubocop/rubocop-capybara
spec/rubocop/cop/capybara/rspec/current_path_expectation_spec.rb
Ruby
mit
49
main
8,421
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Capybara::RSpec::CurrentPathExpectation do it 'flags offenses for `expect(current_path)`' do expect_offense(<<~RUBY) expect(current_path).to eq "/callback" ^^^^^^ Do not set an RSpec expectation on `current_path` in Capybara feature specs - i...
github
rubocop/rubocop-capybara
https://github.com/rubocop/rubocop-capybara
spec/rubocop/cop/capybara/rspec/have_selector_spec.rb
Ruby
mit
49
main
3,747
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Capybara::RSpec::HaveSelector, :config do let(:cop_config) do { 'DefaultSelector' => default_selector } end let(:default_selector) { 'css' } it 'registers an offense when using `have_selector`' do expect_offense(<<~RUBY) expect(foo).to h...
github
rubocop/rubocop-capybara
https://github.com/rubocop/rubocop-capybara
spec/rubocop/cop/capybara/rspec/have_content_spec.rb
Ruby
mit
49
main
1,352
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Capybara::RSpec::HaveContent do it 'registers an offense when using `have_content`' do expect_offense(<<~RUBY) expect(page).to have_content('text') ^^^^^^^^^^^^ Prefer `have_text` over `have_content`. RUBY expect_corr...
github
rubocop/rubocop-capybara
https://github.com/rubocop/rubocop-capybara
spec/rubocop/cop/capybara/rspec/match_style_spec.rb
Ruby
mit
49
main
1,161
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Capybara::RSpec::MatchStyle do it 'registers an offense when using `has_style?`' do expect_offense(<<~RUBY) expect(page.find(:css, 'first') .has_style?(display: 'block')).to be true ^^^^^^^^^^ Use `matches_style?` instead of `has_s...
github
rubocop/rubocop-capybara
https://github.com/rubocop/rubocop-capybara
spec/rubocop/cop/capybara/rspec/negation_matcher_spec.rb
Ruby
mit
49
main
3,580
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Capybara::RSpec::NegationMatcher do let(:cop_config) { { 'EnforcedStyle' => enforced_style } } context 'with EnforcedStyle `have_no`' do let(:enforced_style) { 'have_no' } %i[selector css xpath text title current_path link button field che...
github
rubocop/rubocop-capybara
https://github.com/rubocop/rubocop-capybara
spec/rubocop/capybara/config_formatter_spec.rb
Ruby
mit
49
main
1,567
# frozen_string_literal: true require 'rubocop/capybara/config_formatter' RSpec.describe RuboCop::Capybara::ConfigFormatter do let(:config) do { 'AllCops' => { 'Setting' => 'forty two' }, 'Capybara/Foo' => { 'Config' => 2, 'Enabled' => true }, 'Capybara/Bar'...
github
rubocop/rubocop-capybara
https://github.com/rubocop/rubocop-capybara
spec/rubocop/capybara/description_extractor_spec.rb
Ruby
mit
49
main
1,519
# frozen_string_literal: true require 'yard' require 'rubocop/capybara/description_extractor' RSpec.describe RuboCop::Capybara::DescriptionExtractor do let(:yardocs) do YARD.parse_string(<<~RUBY) # This is not a cop class RuboCop::Cop::Mixin::Sneaky end # This is not a concrete cop ...