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 | chrismo/tablesmith | https://github.com/chrismo/tablesmith | lib/tablesmith/html_formatter.rb | Ruby | mit | 92 | master | 1,126 | # frozen_string_literal: true
class HtmlFormatter
attr_reader :indent
def initialize(table)
@table = table
@indent = ' '
end
def to_html
@lines = []
@lines << '<table>'
append_table_head
append_table_body
@lines << '</table>'
@lines.join("\n") + "\n"
end
private
def... |
github | chrismo/tablesmith | https://github.com/chrismo/tablesmith | spec/active_record_table_spec.rb | Ruby | mit | 92 | master | 12,404 | # frozen_string_literal: true
require 'spec_helper'
# rubocop:disable Rails/SkipsModelValidations
describe 'ActiveRecordSource' do
it 'outputs text table of multiple ActiveRecords' do
a = Person.new.tap { |c| c.first_name = 'A' }
b = Person.new.tap { |c| c.first_name = 'B' }
expected = <<~TABLE
+-... |
github | chrismo/tablesmith | https://github.com/chrismo/tablesmith | spec/array_table_spec.rb | Ruby | mit | 92 | master | 1,566 | # frozen_string_literal: true
require 'spec_helper'
describe 'Array Source' do
it 'just works in a console' do
expected = <<~TABLE
+---+---+---+
| a | b | c |
+---+---+---+
| d | e | f |
+---+---+---+
TABLE
[%w[a b c], %w[d e f]].to_table.to_s.should == expected
end
de... |
github | chrismo/tablesmith | https://github.com/chrismo/tablesmith | spec/fixtures.rb | Ruby | mit | 92 | master | 1,620 | # frozen_string_literal: true
require 'active_record'
ActiveRecord::Base.establish_connection adapter: 'sqlite3', database: ':memory:'
class Person < ActiveRecord::Base
serialize :custom_attributes
connection.create_table table_name, force: true do |t|
t.string :first_name
t.string :last_name
t.inte... |
github | chrismo/tablesmith | https://github.com/chrismo/tablesmith | spec/hash_table_spec.rb | Ruby | mit | 92 | master | 706 | # frozen_string_literal: true
require 'spec_helper'
describe 'Hash Source' do
it 'just works in a console' do
expected = <<~TABLE
+---+---+---+
| a | b | c |
+---+---+---+
| 1 | 2 | 3 |
+---+---+---+
TABLE
{a: 1, b: 2, c: 3}.to_table.text_table.to_s.should == expected
end... |
github | chrismo/tablesmith | https://github.com/chrismo/tablesmith | spec/table_spec.rb | Ruby | mit | 92 | master | 1,997 | # frozen_string_literal: true
require 'spec_helper'
include Tablesmith # rubocop:disable Style/MixinUsage:
describe Table do
it 'should delegate to the internal array' do
b = Table.new
b.length.should == 0
b << 1
b << 'a'
b[0].should == 1
b[1].should == 'a'
b.class.should == Table
end... |
github | chrismo/tablesmith | https://github.com/chrismo/tablesmith | spec/hash_rows_table_spec.rb | Ruby | mit | 92 | master | 2,101 | # frozen_string_literal: true
require 'spec_helper'
describe 'HashRowsSource' do
it 'outputs text table of simple hash row with default columns' do
expected = <<~TABLE
+---+---+
| a | b |
+---+---+
| 1 | 2 |
+---+---+
TABLE
[{ a: 1, b: 2 }].to_table.to_s.should == expected
... |
github | chrismo/tablesmith | https://github.com/chrismo/tablesmith | spec/spec_helper.rb | Ruby | mit | 92 | master | 201 | # frozen_string_literal: true
require File.expand_path('../lib/tablesmith', __dir__)
require File.expand_path('fixtures', __dir__)
RSpec.configuration.expect_with(:rspec) { |c| c.syntax = :should } |
github | fabiosoft/FNReactionsView | https://github.com/fabiosoft/FNReactionsView | Podfile | Ruby | mit | 92 | master | 296 | # Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'FNLiveReactions' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for FNLiveReactions
pod 'SnapKit', '~> 3.2.0'
end |
github | d2fn/shades-rb | https://github.com/d2fn/shades-rb | shades.gemspec | Ruby | mit | 92 | master | 943 | Gem::Specification.new do |s|
s.name = 'shades'
s.version = '0.17'
s.summary = "Get a new perspective on your data. In-memory data cubing of event data for Ruby."
s.description = <<-EOF
Shades computes data cubes for you from events composed of dimensions and measures.
EOF
s.files = `git ls-files`.spl... |
github | d2fn/shades-rb | https://github.com/d2fn/shades-rb | lib/shades/streamparser.rb | Ruby | mit | 92 | master | 915 | module Shades
# parse a stream of events with whitespace delimited fields preceeded by metadata headers
class StreamParser
def initialize(&receiver)
@dimensions = nil
@measures = nil
@receiver = receiver
end
def <<(line)
line.strip!
if !@metadata.nil?
event = @met... |
github | d2fn/shades-rb | https://github.com/d2fn/shades-rb | lib/shades/queryparser.rb | Ruby | mit | 92 | master | 2,350 | require "treetop"
module Shades
module QueryGrammar
class QueryNode < Treetop::Runtime::SyntaxNode
def rollup_nodes
rollup_list.to_a
end
def categorization_nodes
categorization_list.to_a
end
def sorting_nodes
if optional_sorting.respond_to?(:sorting_list)
... |
github | d2fn/shades-rb | https://github.com/d2fn/shades-rb | lib/shades/model.rb | Ruby | mit | 92 | master | 1,432 | module Shades
class Metadata
attr_accessor :dimensions
attr_accessor :measures
def initialize(dimensions, measures)
@dimensions = dimensions
@measures = measures
end
# parse an event line that adheres to this metadat
def parse_event(line, sep)
values = line.split(sep)
... |
github | d2fn/shades-rb | https://github.com/d2fn/shades-rb | lib/shades/histo.rb | Ruby | mit | 92 | master | 2,972 | # Histogram utilities
module Shades
# streaming histograms:
# Ruby port of the Clojure library from BigML: https://github.com/bigmlcom/histogram
class DynamicHistogram
def initialize(max_size)
@res = StreamReservoir.new(max_size)
end
def add(f)
@res.add(StreamBin.new(1, f))
@res.c... |
github | d2fn/shades-rb | https://github.com/d2fn/shades-rb | lib/shades/cube.rb | Ruby | mit | 92 | master | 5,201 | module Shades
class Query
def initialize(opts)
dimensions = []
@dcs = opts[:categorizations].map do |d|
dimensions.push(d)
DimensionComputer.new(d, d)
end unless opts[:categorizations].nil?
@mrs = opts[:rollups].map do |r|
MeasureRollup.new(r[:measure], r[:measure]... |
github | d2fn/shades-rb | https://github.com/d2fn/shades-rb | lib/shades/stats.rb | Ruby | mit | 92 | master | 1,600 | module Stats
SUM = lambda { Sum.new(0.0) }
MEAN = lambda { Mean.new(0.0) }
MIN = lambda { Min.new(Float::MAX) }
MAX = lambda { Max.new(Float::MIN) }
class StatsType
def self.get(name)
if name.eql?("sum")
SUM
elsif name.eql?("mean")
MEAN
elsif name.eql?("min")
... |
github | d2fn/shades-rb | https://github.com/d2fn/shades-rb | lib/shades/formatter.rb | Ruby | mit | 92 | master | 1,578 | module Shades
class Formatter
def initialize(spacer = " ")
@spacer = spacer
end
def text(out, events)
if events.empty?
return
end
metadata = events[0].metadata
lines = []
out.puts "# dimensions: %s" % (metadata.dimensions.join(@spacer))
out.puts "# measure... |
github | d2fn/shades-rb | https://github.com/d2fn/shades-rb | spec/queryparser_spec.rb | Ruby | mit | 92 | master | 1,799 | require 'spec_helper'
require 'ostruct'
module Shades
describe QueryParser do
it "parses rollups out of the query expression" do
query = QueryParser.parse("sum(amount) by transactionid", OpenStruct)
expect(query.rollups.length).to eq(1)
expect(query.rollups[0][:measure]).to eq("amount")
... |
github | d2fn/shades-rb | https://github.com/d2fn/shades-rb | spec/spec_helper.rb | Ruby | mit | 92 | master | 217 | require 'shades'
RSpec.configure do |config|
config.treat_symbols_as_metadata_keys_with_true_values = true
config.run_all_when_everything_filtered = true
config.filter_run :focus
config.order = 'random'
end |
github | ernestas-poskus/ansible-prometheus | https://github.com/ernestas-poskus/ansible-prometheus | parse_config.rb | Ruby | bsd-3-clause | 92 | master | 5,915 | input = <<eos
--config.file="prometheus.yml"
Prometheus configuration file path.
--web.listen-address="0.0.0.0:9090"
Address to listen on for UI, API, and
telemetry.
--web.config.file="" [EXPERIMENTAL] Path to configuration file that
can enable TLS or authentication.
--web.read-timeout=5m Maximum duration be... |
github | ernestas-poskus/ansible-prometheus | https://github.com/ernestas-poskus/ansible-prometheus | node_exporter_parse_config.rb | Ruby | bsd-3-clause | 92 | master | 10,093 | input = <<eos
--collector.bcache.priorityStats
Expose expensive priority stats.
--collector.cpu.info Enables metric cpu_info
--collector.cpu.info.flags-include=COLLECTOR.CPU.INFO.FLAGS-INCLUDE
Filter the `flags` field in cpuInfo with a value that must be a regular expression
--collector.cpu.info.bugs-include=COLL... |
github | ernestas-poskus/ansible-prometheus | https://github.com/ernestas-poskus/ansible-prometheus | prometheus_parse_config.rb | Ruby | bsd-3-clause | 92 | master | 937 | input = <<eos
eos
PREFIX = 'prometheus'
puts '############################################################'
puts '# Auto generated'
puts '############################################################'
buffer = []
flags = []
input.each_line do |line|
line = line.chomp
next if line.empty?
if line.start_with?('--')... |
github | chrisvfritz/language_filter | https://github.com/chrisvfritz/language_filter | Rakefile | Ruby | mit | 92 | master | 228 | #!/usr/bin/env rake
require "bundler/gem_tasks"
require 'rake/testtask'
Rake::TestTask.new do |t|
t.libs << 'lib'
t.test_files = FileList['test/lib/language_filter/*_test.rb']
t.verbose = true
end
task :default => :test |
github | chrisvfritz/language_filter | https://github.com/chrisvfritz/language_filter | language_filter.gemspec | Ruby | mit | 92 | master | 1,021 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'language_filter/version'
Gem::Specification.new do |spec|
spec.name = "language_filter"
spec.version = LanguageFilter::VERSION
spec.authors = ["Chris Fritz"]
spec.ema... |
github | chrisvfritz/language_filter | https://github.com/chrisvfritz/language_filter | lib/language_filter.rb | Ruby | mit | 92 | master | 12,691 | # encoding: utf-8
require 'pathname'
require 'language_filter/error'
require 'language_filter/version'
module LanguageFilter
class Filter
attr_accessor :matchlist, :exceptionlist, :replacement, :creative_letters
attr_reader :creative_matchlist
CREATIVE_BEG_REGEX = '(?<=\\s|\\A|_|\\-|\\.)'
CREATIVE_... |
github | chrisvfritz/language_filter | https://github.com/chrisvfritz/language_filter | test/test_helper.rb | Ruby | mit | 92 | master | 4,697 | require 'minitest/autorun'
require 'minitest/pride'
require File.expand_path('../../lib/language_filter.rb', __FILE__)
def valid_non_empty_list?(list)
list.must_be_kind_of Array
list.wont_be_empty
list.each {|list_item| list_item.must_be_kind_of String}
end
def test_against_word_lists
word_lists = [
{ # T... |
github | chrisvfritz/language_filter | https://github.com/chrisvfritz/language_filter | test/lib/language_filter/methods_test.rb | Ruby | mit | 92 | master | 2,508 | require_relative '../../test_helper'
describe LanguageFilter do
it "must be successfully created with correct defaults" do
filter = LanguageFilter::Filter.new
filter.must_be_kind_of LanguageFilter::Filter
valid_non_empty_list? filter.matchlist
filter.exceptionlist.must_be_kind_of Array
filter.ex... |
github | drugpl/bbq | https://github.com/drugpl/bbq | bbq-devise/bbq-devise.gemspec | Ruby | mit | 92 | master | 1,043 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'bbq/devise/version'
Gem::Specification.new do |spec|
spec.name = "bbq-devise"
spec.version = Bbq::Devise::VERSION
spec.authors = ["Paweł Pacana"]
spec.email =... |
github | drugpl/bbq | https://github.com/drugpl/bbq | bbq-devise/lib/bbq/devise.rb | Ruby | mit | 92 | master | 1,635 | require "bbq/devise/version"
require "securerandom"
module Bbq
module Devise
attr_accessor :devise_authentication_key, :email, :password, :scope
def self.included(klass)
require 'bbq/rails/routes'
klass.send(:include, Bbq::Rails::Routes)
end
def initialize_devise
@devise_initializ... |
github | drugpl/bbq | https://github.com/drugpl/bbq | bbq-devise/test/test_helper.rb | Ruby | mit | 92 | master | 468 | require 'minitest/autorun'
ENV["RAILS_ENV"] = "test"
require File.expand_path("../dummy/config/environment.rb", __FILE__)
require "rails/test_help"
ActiveRecord::Base.configurations = YAML.load(File.read(File.expand_path("../dummy/config/database.yml", __FILE__)))
ActiveRecord::Base.establish_connection("test")
Acti... |
github | drugpl/bbq | https://github.com/drugpl/bbq | bbq-devise/test/bbq_devise_test.rb | Ruby | mit | 92 | master | 686 | require 'test_helper'
require 'bbq/core/test_user'
require 'bbq/devise'
class DeviseTestUser < Bbq::Core::TestUser
include Bbq::Devise
end
class BbqDeviseTest < Minitest::Unit::TestCase
def test_user_register
user = DeviseTestUser.new
user.register
assert user.see?("dummy")
User.find_by_email(us... |
github | drugpl/bbq | https://github.com/drugpl/bbq | bbq-devise/test/dummy/app/models/user.rb | Ruby | mit | 92 | master | 225 | class User < ActiveRecord::Base
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
attr_accessible :email, :password, :password_confirmation, :remember_me
end |
github | drugpl/bbq | https://github.com/drugpl/bbq | bbq-devise/test/dummy/config/routes.rb | Ruby | mit | 92 | master | 226 | Dummy::Application.routes.draw do
devise_for :users
root :to => "home#index"
get "/miracle" => "home#miracle"
get "/ponycorns" => "home#ponycorns"
get "/rainbow" => "home#rainbow"
get "/uh_oh" => "home#uh_oh"
end |
github | drugpl/bbq | https://github.com/drugpl/bbq | bbq-devise/test/dummy/config/application.rb | Ruby | mit | 92 | master | 409 | require File.expand_path('../boot', __FILE__)
require "active_model/railtie"
require "active_record/railtie"
require "action_controller/railtie"
require "action_view/railtie"
require "action_mailer/railtie"
require "devise"
module Dummy
class Application < Rails::Application
config.encoding = "utf-8"
confi... |
github | drugpl/bbq | https://github.com/drugpl/bbq | bbq-devise/test/dummy/config/initializers/secret_token.rb | Ruby | mit | 92 | master | 496 | # Be sure to restart your server when you modify this file.
# Your secret key for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attac... |
github | drugpl/bbq | https://github.com/drugpl/bbq | bbq-devise/test/dummy/config/initializers/devise.rb | Ruby | mit | 92 | master | 9,147 | require 'devise/version'
# Use this hook to configure devise mailer, warden hooks and so forth. The first
# four configuration values can also be set straight in your models.
Devise.setup do |config|
config.secret_key = 'a4afae774b0c49455776c2fd27d0e0f632c4553436dffc00d6d5a90fc56ab437a938277fa36ef991c37033d28465598e... |
github | drugpl/bbq | https://github.com/drugpl/bbq | bbq-devise/test/dummy/db/schema.rb | Ruby | mit | 92 | master | 861 | ActiveRecord::Schema.define(:version => 20110521153145) do
create_table "users", :force => true do |t|
t.string "email", :default => "", :null => false
t.string "encrypted_password", :limit => 128, :default => "", :null => false
t.string "reset_password_token"
... |
github | drugpl/bbq | https://github.com/drugpl/bbq | bbq-rspec/bbq-rspec.gemspec | Ruby | mit | 92 | master | 906 | # coding: utf-8
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "bbq/rspec/version"
Gem::Specification.new do |spec|
spec.name = "bbq-rspec"
spec.version = Bbq::RSpec::VERSION
spec.authors = ["DRUG - Dolnośląska Grupa Użytkowników Ru... |
github | drugpl/bbq | https://github.com/drugpl/bbq | bbq-rspec/spec/test_user_matchers_spec.rb | Ruby | mit | 92 | master | 609 | require 'spec_helper'
class TestUserWithMatchers < Bbq::Core::TestUser
def ensure_no_red_ponycorns
expect(self).to have_no_content('Red')
end
def ensure_pink_ponycorns
expect(self).to see('Pink').within('#unicorns')
end
end
describe 'TestUser matchers' do
specify 'capybara matcher' do
user = T... |
github | drugpl/bbq | https://github.com/drugpl/bbq | bbq-rspec/spec/rspec_matchers_spec.rb | Ruby | mit | 92 | master | 901 | require 'spec_helper'
describe 'RSpec matchers' do
specify 'see given string' do
user = Bbq::Core::TestUser.new
user.visit('/test_page')
expect { expect(user).to see('Pink') }.to_not raise_error
end
specify 'unable to see given string' do
user = Bbq::Core::TestUser.new
user.visit('/test_pa... |
github | drugpl/bbq | https://github.com/drugpl/bbq | bbq-rspec/spec/spec_helper.rb | Ruby | mit | 92 | master | 507 | require 'bbq/rspec'
require 'rack/builder'
Bbq::Core.app = Rack::Builder.new do
map '/test_page' do
html_page = <<-EOP
<!DOCTYPE html>
<html>
<head>
<title>Ponycorns</title>
</head>
<body>
<ul id="unicorns">
<li>Pink</li>
</ul>
... |
github | drugpl/bbq | https://github.com/drugpl/bbq | bbq-rspec/lib/bbq/rspec.rb | Ruby | mit | 92 | master | 1,126 | require "bbq/core"
require "bbq/core/test_user"
require "bbq/rspec/version"
require "bbq/rspec/matchers"
require "rspec/core"
require "capybara/rspec/matchers"
module Bbq
module RSpec
module Feature
def self.included(base)
base.metadata[:type] = :acceptance
base.metadata[:caller] = caller... |
github | drugpl/bbq | https://github.com/drugpl/bbq | bbq-rspec/lib/bbq/rspec/matchers/see.rb | Ruby | mit | 92 | master | 1,635 | module Bbq
module RSpec
module Matchers
module See
class Matcher
attr_reader :text, :scope
def initialize(text)
@text = text
@scope = nil
end
def description
if scope
"see #{text} within #{scope}"
... |
github | drugpl/bbq | https://github.com/drugpl/bbq | bbq-core/bbq-core.gemspec | Ruby | mit | 92 | master | 988 | # -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require "bbq/core/version"
Gem::Specification.new do |s|
s.name = "bbq-core"
s.version = Bbq::Core::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ["DRUG - Dolnośląska Grupa Użytkowników Ruby"]
s.email = ["bb... |
github | drugpl/bbq | https://github.com/drugpl/bbq | bbq-core/test/util_test.rb | Ruby | mit | 92 | master | 684 | require 'test_helper'
require 'bbq/core/util'
class User
module Commenter
end
end
module Commenter
end
class UtilTest < Minitest::Test
def test_find_module_in_object_namespace
assert_commenter(User.new, User::Commenter)
end
def test_find_module_in_class_namespace
assert_commenter(User, User::Comm... |
github | drugpl/bbq | https://github.com/drugpl/bbq | bbq-core/test/session_pool_test.rb | Ruby | mit | 92 | master | 1,139 | require 'test_helper'
require 'bbq/core/test_user'
class SessionPoolTest < Minitest::Test
def setup
Bbq::Core::Session.instance_variable_set(:@pool, nil)
end
def test_reuses_sessions
pool = Bbq::Core::Session::Pool.new
user1 = Bbq::Core::TestUser.new(:pool => pool).tap { |u| u.page }
pool.rele... |
github | drugpl/bbq | https://github.com/drugpl/bbq | bbq-core/test/test_user_test.rb | Ruby | mit | 92 | master | 2,402 | require 'test_helper'
require 'bbq/core/test_user'
def text(output)
end
def html(output)
->{ ['200', {'Content-Type' => 'text/html'}, [output]] }
end
TestApp = Rack::Builder.new do
map '/' do
run ->(env) { ['200', {'Content-Type' => 'text/plain'}, ['BBQ']] }
end
map '/miracle' do
run ->(env) { ['20... |
github | drugpl/bbq | https://github.com/drugpl/bbq | bbq-core/test/test_client_test.rb | Ruby | mit | 92 | master | 889 | require 'test_helper'
require 'bbq/core/test_client'
class TestClientTest < Minitest::Test
def test_rack_test_to_env_headers_for_empty_hash
test_client = Bbq::Core::TestClient::RackTest.new(:app)
assert_equal({}, test_client.to_env_headers({}))
end
def test_rack_test_to_env_headers_for_content_type_or_... |
github | drugpl/bbq | https://github.com/drugpl/bbq | bbq-core/lib/tasks/bbq.rake | Ruby | mit | 92 | master | 412 | require 'rake/testtask'
Rake::TestTask.new("test:acceptance") do |t|
t.libs << 'test'
t.pattern = 'test/acceptance/**/*_test.rb'
t.verbose = false
end if File.exists?('test/acceptance')
begin
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new('spec:acceptance') do |spec|
spec.pattern = FileList['s... |
github | drugpl/bbq | https://github.com/drugpl/bbq | bbq-core/lib/bbq/core/session.rb | Ruby | mit | 92 | master | 1,193 | require 'bbq/core'
module Bbq
module Core
module Session
extend self
def next(options = {})
driver = options.delete(:driver)
pool = options.delete(:pool)
if pool
pool.next(driver)
else
create(driver)
end
end
def create(drive... |
github | drugpl/bbq | https://github.com/drugpl/bbq | bbq-core/lib/bbq/core/test_user.rb | Ruby | mit | 92 | master | 804 | require 'bbq/core/session'
require 'bbq/core/roles'
require 'bbq/core/test_user/capybara_dsl'
require 'bbq/core/test_user/eyes'
require 'bbq/core/test_user/within'
module Bbq
module Core
class TestUser
include Bbq::Core::TestUser::CapybaraDsl
include Bbq::Core::TestUser::Eyes
include Bbq::Core:... |
github | drugpl/bbq | https://github.com/drugpl/bbq | bbq-core/lib/bbq/core/roles.rb | Ruby | mit | 92 | master | 257 | require 'bbq/core/util'
module Bbq
module Core
module Roles
def roles(*names)
names.each do |name|
module_obj = Bbq::Core::Util.find_module(name, self)
self.extend(module_obj)
end
end
end
end
end |
github | drugpl/bbq | https://github.com/drugpl/bbq | bbq-core/lib/bbq/core/test_client.rb | Ruby | mit | 92 | master | 2,363 | require 'bbq/core/roles'
module Bbq
module Core
class TestClient
class UnsupportedMethodError < StandardError; end
include Bbq::Core::Roles
def initialize(options = {})
@options = options
end
HTTP_METHODS = %w(get post put delete head options patch)
HTTP_METHODS.ea... |
github | drugpl/bbq | https://github.com/drugpl/bbq | bbq-core/lib/bbq/core/util.rb | Ruby | mit | 92 | master | 464 | require 'active_support/core_ext/string/inflections'
module Bbq
module Core
class Util
def self.find_module(name, scope = nil)
namespace = case scope
when String, Symbol
"::#{scope.to_s.camelize}"
when Class
"::#{scope.name}"
when NilClass
nil
... |
github | drugpl/bbq | https://github.com/drugpl/bbq | bbq-core/lib/bbq/core/test_user/within.rb | Ruby | mit | 92 | master | 865 | require 'active_support/core_ext/array/extract_options'
module Bbq
module Core
class TestUser
module Within
METHODS_USING_WITHIN = [
:see?, :not_see?,
:attach_file, :check, :choose, :click_link_or_button, :click_button,
:click_link, :click_on, :fill_in, :select, :unche... |
github | drugpl/bbq | https://github.com/drugpl/bbq | bbq-core/lib/bbq/core/test_user/capybara_dsl.rb | Ruby | mit | 92 | master | 358 | require 'capybara/dsl'
module Bbq
module Core
class TestUser
module CapybaraDsl
::Capybara::Session::DSL_METHODS.each do |method|
class_eval <<-RUBY, __FILE__, __LINE__+1
def #{method}(*args, &block)
page.#{method}(*args, &block)
end
RUBY
... |
github | drugpl/bbq | https://github.com/drugpl/bbq | bbq-core/lib/bbq/core/test_user/eyes.rb | Ruby | mit | 92 | master | 266 | module Bbq
module Core
class TestUser
module Eyes
def see?(*args)
args.all? { |arg| has_content?(arg) }
end
def not_see?(*args)
args.all? { |arg| has_no_content?(arg) }
end
end
end
end
end |
github | drugpl/bbq | https://github.com/drugpl/bbq | bbq/Rakefile | Ruby | mit | 92 | master | 481 | #!/usr/bin/env rake
begin
require 'bundler/setup'
rescue LoadError
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
end
Bundler::GemHelper.install_tasks
require 'rake/testtask'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.libs << 'test'
t.pattern = 'test/unit/*_test.rb' # D... |
github | drugpl/bbq | https://github.com/drugpl/bbq | bbq/bbq.gemspec | Ruby | mit | 92 | master | 1,091 | # -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require "bbq/version"
Gem::Specification.new do |s|
s.name = "bbq"
s.version = Bbq::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ["DRUG - Dolnośląska Grupa Użytkowników Ruby"]
s.email = ["bbq@drug.org.pl"]
... |
github | drugpl/bbq | https://github.com/drugpl/bbq | bbq/lib/bbq/test_unit.rb | Ruby | mit | 92 | master | 707 | require 'bbq/core/session'
require 'test/unit'
require 'test/unit/assertions'
require 'active_support/test_case'
module Bbq
class TestCase < ActiveSupport::TestCase
class << self
alias :scenario :test
alias :background :setup
end
alias :background :setup
teardown do
Bbq::Core::Ses... |
github | drugpl/bbq | https://github.com/drugpl/bbq | bbq-rails/bbq-rails.gemspec | Ruby | mit | 92 | master | 946 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'bbq/rails/version'
Gem::Specification.new do |spec|
spec.name = "bbq-rails"
spec.version = Bbq::Rails::VERSION
spec.authors = ["DRUG - Dolnośląska Grupa Użytkowników Ru... |
github | drugpl/bbq | https://github.com/drugpl/bbq | bbq-rails/lib/bbq/rails/railtie.rb | Ruby | mit | 92 | master | 582 | require 'rails/railtie'
require 'rails/generators'
require 'bbq/core'
module Bbq
module Rails
class Railtie < ::Rails::Railtie
initializer "bqq.set_app" do
Bbq::Core.app = ::Rails.application
end
rake_tasks do
load File.expand_path(File.join(File.dirname(__FILE__), '../../task... |
github | drugpl/bbq | https://github.com/drugpl/bbq | bbq-rails/lib/bbq/rails/routes.rb | Ruby | mit | 92 | master | 372 | module Bbq
module Rails
module Routes
def self.included(klass)
klass.send(:include, ::ActionDispatch::Routing::UrlFor)
klass.send(:include, ::Rails.application.routes.url_helpers)
unless ::Rails.version < "3.1"
klass.send(:include, ::ActionDispatch::Routing::RouteSet::Moun... |
github | drugpl/bbq | https://github.com/drugpl/bbq | bbq-rails/lib/generators/test_unit/bbq_test_generator.rb | Ruby | mit | 92 | master | 285 | module TestUnit
class BbqTestGenerator < Rails::Generators::NamedBase
source_root File.expand_path(File.join(File.dirname(__FILE__), '../test_unit/templates'))
def create_test
template "bbq_test_case.rb", "test/acceptance/#{name.underscore}_test.rb"
end
end
end |
github | drugpl/bbq | https://github.com/drugpl/bbq | bbq-rails/lib/generators/test_unit/bbq_install_generator.rb | Ruby | mit | 92 | master | 454 | module TestUnit
class BbqInstallGenerator < Rails::Generators::Base
source_root File.expand_path(File.join(File.dirname(__FILE__), '../test_unit/templates'))
def create_directory
empty_directory "test/acceptance"
end
def generate_test_user
empty_directory "test/support"
template "t... |
github | drugpl/bbq | https://github.com/drugpl/bbq | bbq-rails/lib/generators/rspec/bbq_install_generator.rb | Ruby | mit | 92 | master | 447 | module Rspec
class BbqInstallGenerator < Rails::Generators::Base
source_root File.expand_path(File.join(File.dirname(__FILE__), '../rspec/templates'))
def create_directory
empty_directory "spec/acceptance"
end
def generate_test_user
empty_directory "spec/support"
template "test_use... |
github | drugpl/bbq | https://github.com/drugpl/bbq | bbq-rails/lib/generators/rspec/bbq_test_generator.rb | Ruby | mit | 92 | master | 273 | module Rspec
class BbqTestGenerator < Rails::Generators::NamedBase
source_root File.expand_path(File.join(File.dirname(__FILE__), '../rspec/templates'))
def create_test
template "bbq_spec.rb", "spec/acceptance/#{name.underscore}_spec.rb"
end
end
end |
github | drugpl/bbq | https://github.com/drugpl/bbq | bbq-rails/test/rails_integration_test.rb | Ruby | mit | 92 | master | 227 | require 'test_helper'
require 'bbq/core/test_user'
class RailsIntegration < Minitest::Test
def test_rails_integration
user = Bbq::Core::TestUser.new
user.visit('/')
assert user.has_content?('dummy')
end
end |
github | drugpl/bbq | https://github.com/drugpl/bbq | bbq-rails/test/test_user_routes_test.rb | Ruby | mit | 92 | master | 404 | require 'test_helper'
require 'bbq/core/test_user'
require 'bbq/rails/routes'
class TestUserRoutesTest < Minitest::Test
class TestUserWithRoutes < Bbq::Core::TestUser
include ::Bbq::Rails::Routes
def visit_test_page
visit(root_url)
end
end
def test_routes_integration
user = TestUserWithRo... |
github | drugpl/bbq | https://github.com/drugpl/bbq | bbq-rails/test/bbq_install_generator_test.rb | Ruby | mit | 92 | master | 949 | require "test_helper"
require "rails/generators/test_case"
require "generators/bbq/install_generator"
class BbqInstallGeneratorTest < Rails::Generators::TestCase
destination File.expand_path(File.join(File.dirname(__FILE__), '../tmp'))
setup :prepare_destination
tests Bbq::InstallGenerator
def test_creating_... |
github | drugpl/bbq | https://github.com/drugpl/bbq | bbq-rails/test/test_helper.rb | Ruby | mit | 92 | master | 458 | require 'minitest/autorun'
require 'bbq/rails'
require 'action_controller/railtie'
class DummyApplication < ::Rails::Application
config.eager_load = false
config.secret_token = SecureRandom.hex(30)
end
class DummyController < ActionController::Base
def index
render text: 'dummy'
end
end
DummyApplicati... |
github | drugpl/bbq | https://github.com/drugpl/bbq | bbq-rails/test/bbq_test_generator_test.rb | Ruby | mit | 92 | master | 837 | require "test_helper"
require "rails/generators/test_case"
require "generators/bbq/test_generator"
class BbqTestGeneratorTest < ::Rails::Generators::TestCase
destination File.expand_path(File.join(File.dirname(__FILE__), '../tmp'))
setup :prepare_destination
tests Bbq::TestGenerator
def test_creating_test_un... |
github | nhoizey/jekyll-cloudinary | https://github.com/nhoizey/jekyll-cloudinary | Gemfile | Ruby | mit | 92 | master | 435 | # frozen_string_literal: true
source "https://rubygems.org"
# Specify your gem's dependencies in jekyll-cloudinary.gemspec
gemspec
gem "jekyll", "~> 4.3"
gem "cloudinary", "~> 1.26"
gem "rake", "~> 13.0.6"
group :rubocop do
gem "rubocop", "~> 1.50", require: false
gem 'rubocop-minitest', require: false
gem "ru... |
github | nhoizey/jekyll-cloudinary | https://github.com/nhoizey/jekyll-cloudinary | jekyll-cloudinary.gemspec | Ruby | mit | 92 | master | 2,917 | # frozen_string_literal: true
require_relative "lib/jekyll/cloudinary/version"
Gem::Specification.new do |spec|
spec.version = Jekyll::Cloudinary::VERSION
spec.name = "jekyll-cloudinary"
spec.version = Jekyll::Cloudinary::VERSION
spec.authors = ["Nicolas Hoizey", "Mavaddat Javid"]
spec.... |
github | nhoizey/jekyll-cloudinary | https://github.com/nhoizey/jekyll-cloudinary | lib/jekyll/cloudinary.rb | Ruby | mit | 92 | master | 12,500 | # frozen_string_literal: true
module Jekyll
module Cloudinary
class CloudinaryTag < Liquid::Tag
require "fastimage"
def initialize(tag_name, markup, tokens)
@markup = markup
super
end
def render(context)
# Default settings
settings_defaults = {
... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | Gemfile | Ruby | mit | 92 | main | 1,396 | source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby "4.0.2"
gem "actionpack-action_caching"
gem "aws-sdk-s3"
gem "chronic"
gem "friendly_id"
gem "dalli"
gem "dry-initializer"
gem "geocoder"
gem "google-api-client"
gem "googleauth"
gem "grape"
gem "grape-entity"
gem "grap... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/spec_helper.rb | Ruby | mit | 92 | main | 485 | require 'simplecov'
SimpleCov.start
# Suppress constant redefinition warnings from Bundler/RubyGems
$VERBOSE = nil
Warning[:deprecated] = false if Warning.respond_to?(:[]=)
RSpec.configure do |config|
config.expect_with :rspec do |expectations|
expectations.include_chain_clauses_in_custom_matcher_descriptions =... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/rails_helper.rb | Ruby | mit | 92 | main | 953 | require "spec_helper"
ENV["RAILS_ENV"] ||= "test"
require File.expand_path("../config/environment", __dir__)
abort("Rails is running in production mode!") if Rails.env.production?
require "rspec/rails"
Dir[Rails.root.join("spec/support/**/*")].each { |f| require f }
begin
ActiveRecord::Migration.maintain_test_schema... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/features/my_tracks_spec.rb | Ruby | mit | 92 | main | 2,013 | require "rails_helper"
RSpec.describe "My Tracks", :js do
let(:user) { create(:user) }
let(:venue) { create(:venue) }
let(:show) { create(:show, venue:) }
let(:tracks) { create_list(:track, 3, show:) }
before do
tracks.each_with_index do |track, idx|
create(:like, likable: track, user:)
trac... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/features/era_shows_spec.rb | Ruby | mit | 92 | main | 1,207 | require "rails_helper"
RSpec.describe "Era Shows", :js do
let(:venue) { create(:venue) }
let(:shows) do
[
create(:show, venue:, date: "2024-01-01"),
create(:show, venue:, date: "2024-02-01"),
create(:show, venue:, date: "2024-03-01"),
create(:show, venue:, date: "2024-04-01"),
cre... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/features/venues_spec.rb | Ruby | mit | 92 | main | 1,797 | require "rails_helper"
RSpec.describe "Venues", :js do
let(:venue1) do
create(
:venue,
name: "Awesome Venue",
city: "New York",
shows_count: 15,
shows_with_audio_count: 15,
slug: "awesome-venue"
)
end
let(:venue2) do
create(
:venue,
name: "Brilliant Ven... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/features/homepage_spec.rb | Ruby | mit | 92 | main | 3,212 | require "rails_helper"
describe "Homepage", :js do
let!(:shows) do
[ 1983, most_recent_year ].each_with_object([]) do |year, shows|
(1..3).each do |day|
shows << create(:show, venue:, date: "#{year}-01-#{day}", duration: 100_000)
end
end
end
let(:venue) { create(:venue) }
let(:most_... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/features/my_shows_spec.rb | Ruby | mit | 92 | main | 1,513 | require "rails_helper"
RSpec.describe "My Shows", :js do
let(:user) { create(:user) }
let(:venue) { create(:venue) }
let(:shows) { create_list(:show, 3, venue:) }
before do
shows.each_with_index do |show, idx|
create(:like, likable: show, user:)
show.update(duration: show.duration + (idx * 10)... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/features/top_shows_spec.rb | Ruby | mit | 92 | main | 988 | require "rails_helper"
RSpec.describe "Top Shows", :js do
let!(:shows) { create_list(:show, 3) }
before do
shows.each_with_index do |show, idx|
create_list(:like, shows.size - idx, likable: show)
end
end
it "displays the list of top shows with numbering and links" do
visit "/top-shows"
... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/features/show_spec.rb | Ruby | mit | 92 | main | 2,416 | require "rails_helper"
RSpec.describe "Shows", :js do
let!(:set_1_tracks) do
create_list(:track, 2, :with_likes, show:, set: 1)
end
let!(:set_2_tracks) do
create_list(:track, 3, :with_likes, show:, set: 2)
end
let(:venue) do
create(
:venue,
slug: "madison-square-garden",
name: "... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/features/playlists_spec.rb | Ruby | mit | 92 | main | 2,579 | require "rails_helper"
RSpec.describe "Playlists", :js do
let!(:playlists) { create_list(:playlist, 3, user:) }
let(:user) { create(:user) }
before do
# Give each playlist a different number of likes (3, 2, 1)
playlists.each_with_index do |playlist, idx|
create_list(:like, playlists.size - idx, li... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/features/tags_spec.rb | Ruby | mit | 92 | main | 2,032 | require "rails_helper"
RSpec.describe "Tags", :js do
let!(:show) { create(:show, tags: [ tag1, tag2 ]) }
let!(:track) { create(:track, tags: [ tag1, tag2 ]) }
let(:group1) { "Group 1" }
let(:group2) { "Group 2" }
let(:tag1) { create(:tag, name: "Tag 1", group: group1, shows_count: 1, tracks_count: 1) }
let... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/features/top_tracks_spec.rb | Ruby | mit | 92 | main | 810 | require "rails_helper"
RSpec.describe "Top Tracks", :js do
let!(:tracks) { create_list(:track, 3) }
before do
tracks.each_with_index do |track, idx|
create_list(:like, tracks.size - idx, likable: track)
end
end
it "displays the list of top tracks with numbering and links" do
visit "/top-tra... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/features/songs_spec.rb | Ruby | mit | 92 | main | 2,234 | require "rails_helper"
RSpec.describe "Songs", :js do
let(:cover_song) do
song = create(
:song,
title: "Cover Song",
original: false,
tracks_count: 5,
tracks_with_audio_count: 5,
slug: "cover-song"
)
# Create actual tracks with shows that have audio
5.times do |i|
... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/features/feeds_spec.rb | Ruby | mit | 92 | main | 312 | require "rails_helper"
describe "RSS Feed" do
let!(:announcements) { create_list(:announcement, 2) }
it "click My Shows, display/sorting of shows" do
visit rss_feed_path
expect(page).to have_content(announcements.first.title)
expect(page).to have_content(announcements.second.title)
end
end |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/features/auth/password_reset_spec.rb | Ruby | mit | 92 | main | 1,144 | require "rails_helper"
require "capybara/email/rspec"
describe "Reset Password", :js do
let(:password) { "Tr3yIsj3dI" }
let(:new_password) { "Tr3yIsj3dI2" }
let(:user) { create(:user, password:, password_confirmation: password) }
it "user enters email, receives message, and changes password" do
visit "/lo... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/features/auth/user_spec.rb | Ruby | mit | 92 | main | 1,586 | require "rails_helper"
describe "User Registration", :js do
let(:password) { "Tr3yIsj3dI" }
let(:email) { "email@example.com" }
let(:username) { "harryhood" }
context "with valid data" do
it "user signs up" do
visit '/'
# save_and_open_page
click_on("LOGIN")
click_on("Sign Up")
... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/features/auth/user_sessions_spec.rb | Ruby | mit | 92 | main | 1,075 | require "rails_helper"
describe "User Sessions", :js do
let(:username) { "harryhood420" }
let(:email) { "email@example.com" }
let(:password) { "Tr3yIsj3dI" }
before do
create(
:user,
username:,
email:,
password:,
password_confirmation: password
)
end
context "with va... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/services/track_slug_generator_spec.rb | Ruby | mit | 92 | main | 1,799 | require 'rails_helper'
RSpec.describe TrackSlugGenerator do
subject(:service) { described_class.new(track) }
let(:show) { create(:show) }
let(:track) { build(:track, show:, title:) }
let(:title) { "I Didn't Know" }
context 'when title is not a specific long name' do
before do
create(:track, show:... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/services/track_inserter_spec.rb | Ruby | mit | 92 | main | 2,112 | require 'rails_helper'
RSpec.describe TrackInserter do
subject(:service) { described_class.new(opts) }
let(:opts) do
{
date:,
position: 2,
file:,
title:,
song_id:,
set: 1,
is_sbd: true
}
end
let(:date) { show.date }
let(:file) { Rails.root.join('public/place... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/services/user_jwt_service_spec.rb | Ruby | mit | 92 | main | 945 | require "rails_helper"
require "jwt"
RSpec.describe UserJwtService do
let(:user) { create(:user) }
let(:secret_key) { Rails.application.secret_key_base }
let(:service) { described_class.call(user) }
describe "#call" do
it "returns a JWT token" do
token = service
decoded_token = JWT.decode(toke... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/services/bustout_tag_service_spec.rb | Ruby | mit | 92 | main | 2,567 | require "rails_helper"
RSpec.describe BustoutTagService do
subject(:service) { described_class.call(show) }
let!(:venue) { create(:venue, name: "Madison Square Garden") }
let!(:show) { create(:show, date: "2023-01-01", venue:) }
let!(:song) { create(:song, title: "Tweezer") }
let!(:bustout_tag) { create(:ta... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/services/chronological_track_navigator_spec.rb | Ruby | mit | 92 | main | 3,973 | require "rails_helper"
RSpec.describe ChronologicalTrackNavigator do
let!(:show1) { create(:show, date: "2020-01-01") }
let!(:show2) { create(:show, date: "2020-01-02") }
let!(:show3) { create(:show, date: "2020-01-03") }
let!(:track1_1) { create(:track, show: show1, position: 1, set: "1", audio_status: "comp... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/services/performance_analysis_service_spec.rb | Ruby | mit | 92 | main | 12,998 | require "rails_helper"
RSpec.describe PerformanceAnalysisService do
let!(:venue) { create(:venue, state: "NY", country: "USA") }
let!(:venue2) { create(:venue, state: "CA", country: "USA") }
let!(:tour) { create(:tour, name: "Summer 1997", starts_on: "1997-06-01", ends_on: "1997-08-31") }
let!(:tour2) { create... |
github | jcraigk/phishin | https://github.com/jcraigk/phishin | spec/services/search_service_spec.rb | Ruby | mit | 92 | main | 4,772 | require 'rails_helper'
RSpec.describe SearchService do
subject(:service) { described_class.new(term:, scope:) }
let(:term) { nil }
let(:scope) { "all" }
shared_examples 'expected results' do
it 'returns expected results' do
expect(service.call.as_json).to eq(expected_results.as_json)
end
end
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.