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 | hiptest/hiptest-publisher | https://github.com/hiptest/hiptest-publisher | spec/indexers/library_actionword_indexer_spec.rb | Ruby | mit | 49 | master | 2,212 | require_relative '../spec_helper'
require_relative '../../lib/hiptest-publisher/indexers/library_actionword_indexer'
describe Hiptest::LibraryActionwordIndexer do
shared_examples "an index query" do
include HelperFactories
let(:first_actionword_uid) {'12345678-1234-1234-1234-123456789012'}
let(:first_aw... |
github | hiptest/hiptest-publisher | https://github.com/hiptest/hiptest-publisher | spec/indexers/actionword_indexer_spec.rb | Ruby | mit | 49 | master | 2,174 | require_relative '../spec_helper'
require_relative '../../lib/hiptest-publisher/indexers/actionword_indexer'
describe Hiptest::ActionwordIndexer do
shared_examples "an index query" do
include HelperFactories
let(:first_actionword_uid) {'12345678-1234-1234-1234-123456789012'}
let(:first_aw) {
make_... |
github | hiptest/hiptest-publisher | https://github.com/hiptest/hiptest-publisher | spec/node_modifiers/gherkin_adder_spec.rb | Ruby | mit | 49 | master | 29,068 | require_relative "../spec_helper"
require_relative "../../lib/hiptest-publisher/node_modifiers/gherkin_adder"
describe Hiptest::NodeModifiers::GherkinAdder do
include HelperFactories
let(:actionword_name) { "Hello \"name\"" }
let(:actionword) {
make_actionword(actionword_name, parameters: [
make_param... |
github | hiptest/hiptest-publisher | https://github.com/hiptest/hiptest-publisher | spec/node_modifiers/actionword_uniq_renamer_spec.rb | Ruby | mit | 49 | master | 2,204 | require_relative '../spec_helper'
require_relative '../../lib/hiptest-publisher/node_modifiers/actionword_uniq_renamer'
describe Hiptest::NodeModifiers::ActionwordUniqRenamer do
include HelperFactories
context 'find_uniq_name' do
let(:subject) { Hiptest::NodeModifiers::ActionwordUniqRenamer.new(nil) }
it... |
github | hiptest/hiptest-publisher | https://github.com/hiptest/hiptest-publisher | spec/node_modifiers/call_arguments_adder_spec.rb | Ruby | mit | 49 | master | 4,104 | require_relative '../spec_helper'
require_relative '../../lib/hiptest-publisher/node_modifiers/call_arguments_adder'
describe Hiptest::NodeModifiers::DefaultArgumentAdder do
include HelperFactories
before(:each) do
Hiptest::NodeModifiers::DefaultArgumentAdder.add(project)
end
def get_all_arguments_for_ca... |
github | hiptest/hiptest-publisher | https://github.com/hiptest/hiptest-publisher | spec/node_modifiers/datatable_fixer_spec.rb | Ruby | mit | 49 | master | 4,820 | require_relative "../spec_helper"
require_relative "../../lib/hiptest-publisher/node_modifiers/datatable_fixer"
describe Hiptest::NodeModifiers::DatatableFixer do
include HelperFactories
let(:scenario) {
make_scenario("Incomplete datatable",
folder: nil,
parameters: [
make_parameter("first... |
github | hiptest/hiptest-publisher | https://github.com/hiptest/hiptest-publisher | spec/node_modifiers/parameter_type_adder_spec.rb | Ruby | mit | 49 | master | 14,872 | require 'colorize'
require_relative '../spec_helper'
require_relative '../../lib/hiptest-publisher/nodes'
require_relative '../../lib/hiptest-publisher/node_modifiers/parameter_type_adder'
describe Hiptest::NodeModifiers::ParameterTypeAdder do
include HelperFactories
describe '.add' do
it 'adds parameter ty... |
github | hiptest/hiptest-publisher | https://github.com/hiptest/hiptest-publisher | spec/node_modifiers/items_orderer_spec.rb | Ruby | mit | 49 | master | 3,144 | require_relative "../spec_helper"
require_relative "../../lib/hiptest-publisher/node_modifiers/items_orderer"
describe Hiptest::NodeModifiers::ItemsOrderer do
context 'orders items inside folders based on' do
let(:project) {
p = Hiptest::Nodes::Project.new(
'My project',
'',
Hiptest... |
github | hiptest/hiptest-publisher | https://github.com/hiptest/hiptest-publisher | samples/expected_output/Hiptest publisher-rspec/project_spec.rb | Ruby | mit | 49 | master | 395 | # encoding: UTF-8
require 'spec_helper'
require_relative 'actionwords'
describe 'Hiptest publisher' do
include Actionwords
it "A scenario in a subfolder" do
# TODO: Implement action: "Some actions to do"
raise NotImplementedError
end
it "show help" do
start_publisher({help: true})
# TODO: Imp... |
github | hiptest/hiptest-publisher | https://github.com/hiptest/hiptest-publisher | samples/expected_output/Hiptest publisher-rspec/actionwords.rb | Ruby | mit | 49 | master | 789 | # encoding: UTF-8
module Actionwords
def parameters_and_assignements(no_default, default_integer = 1, default_string = 'My string', default_list = [])
# Tags: parameters parameters:defaulted assignements
nil_var = nil
float_var = (3.14 - default_integer)
list_var = [nil_var, [float_var]]
dict_var... |
github | hiptest/hiptest-publisher | https://github.com/hiptest/hiptest-publisher | samples/generated/actionwords.rb | Ruby | mit | 49 | master | 724 | # encoding: UTF-8
module Actionwords
def start_publisher(options = {})
# TODO: Implement action: "start publisher with options #{options}"
raise NotImplementedError
end
def parameters_and_assignements(no_default, default_integer = 1, default_string = 'My string', default_list = [])
# Tags: parameters... |
github | hiptest/hiptest-publisher | https://github.com/hiptest/hiptest-publisher | samples/generated/project_spec.rb | Ruby | mit | 49 | master | 249 | # encoding: UTF-8
require 'spec_helper'
require_relative 'actionwords'
describe 'HiptestPublisher' do
include Actionwords
it 'show_help' do
start_publisher(options = {help: true})
# TODO: Implement result: "help is displayed"
end
end |
github | hiptest/hiptest-publisher | https://github.com/hiptest/hiptest-publisher | lib/hiptest-publisher.rb | Ruby | mit | 49 | master | 8,218 | require 'colorize'
require 'json'
require 'yaml'
require 'hiptest-publisher/node_modifiers/add_all'
require 'hiptest-publisher/cli_options_checker'
require 'hiptest-publisher/client'
require 'hiptest-publisher/formatters/diff_displayer'
require 'hiptest-publisher/formatters/reporter'
require 'hiptest-publisher/file_wr... |
github | hiptest/hiptest-publisher | https://github.com/hiptest/hiptest-publisher | lib/hiptest-publisher/nodes_walker.rb | Ruby | mit | 49 | master | 745 | module Hiptest
module Nodes
class Walker
def walk_node(node)
walk_children(node)
node.each {|item| walk_node(item)} if node.is_a? Array
call_node_walker(node)
end
private
def walk_children(node)
return unless node.is_a? Hiptest::Nodes::Node
node.... |
github | hiptest/hiptest-publisher | https://github.com/hiptest/hiptest-publisher | lib/hiptest-publisher/signature_differ.rb | Ruby | mit | 49 | master | 3,086 | module Hiptest
class SignatureDiffer
def self.diff(old, current, library_name: nil)
SignatureDiffer.new(old, current).compute_diff(library_name)
end
def initialize(old, current)
@old = old
@current = current
end
def compute_diff(library_name = nil)
if library_name.nil?
... |
github | hiptest/hiptest-publisher | https://github.com/hiptest/hiptest-publisher | lib/hiptest-publisher/nodes.rb | Ruby | mit | 49 | master | 14,374 | require 'set'
require 'hiptest-publisher/string'
require 'hiptest-publisher/utils'
require 'hiptest-publisher/renderer'
module Hiptest
module Nodes
class Node
attr_reader :children, :parent
attr_writer :parent
def pretty_print_instance_variables
super - [:@parent] # do not overload pr... |
github | hiptest/hiptest-publisher | https://github.com/hiptest/hiptest-publisher | lib/hiptest-publisher/file_writer.rb | Ruby | mit | 49 | master | 573 | require 'fileutils'
module Hiptest
class FileWriter
def initialize(reporter)
@reporter = reporter
end
def write_to_file(path, message)
@reporter.with_status_message "#{message}: #{path}" do
mkdirs_for(path)
content = yield
File.open(path, 'w') do |file|
fil... |
github | hiptest/hiptest-publisher | https://github.com/hiptest/hiptest-publisher | lib/hiptest-publisher/project_grapher.rb | Ruby | mit | 49 | master | 2,224 | require 'hiptest-publisher/nodes'
module Hiptest
# Builds a graph based on calls and computes
# longest path from the root.
class ProjectGrapher
attr_reader :graph, :distance_index
def self.distances_index(project)
instance = ProjectGrapher.new(project)
instance.compute_graph
instance... |
github | hiptest/hiptest-publisher | https://github.com/hiptest/hiptest-publisher | lib/hiptest-publisher/render_context_maker.rb | Ruby | mit | 49 | master | 5,608 | module Hiptest
module RenderContextMaker
def walk_item(item)
{
has_description?: !item.children[:description].nil? && !item.children[:description].empty?,
has_parameters?: !item.children[:parameters].empty?,
has_tags?: !item.children[:tags].empty?,
has_step?: has_step?(item),... |
github | hiptest/hiptest-publisher | https://github.com/hiptest/hiptest-publisher | lib/hiptest-publisher/string.rb | Ruby | mit | 49 | master | 1,536 | require 'i18n'
require_relative 'utils'
class String
def literate
I18n.enforce_available_locales = false
I18n.transliterate(self)
end
def normalize(keep_dashes=false, keep_spaces=false)
literated = self.literate
literated.strip!
if keep_spaces
literated.gsub!(/\s+/, ' ')
litera... |
github | hiptest/hiptest-publisher | https://github.com/hiptest/hiptest-publisher | lib/hiptest-publisher/client.rb | Ruby | mit | 49 | master | 9,671 | require 'erb'
require 'i18n'
require 'json'
require 'net/http'
require 'uri'
require_relative 'export_cache'
require_relative 'formatters/reporter'
module Hiptest
class ClientError < StandardError
end
class RedirectionError < StandardError
attr_reader :redirect
def initialize(msg, redirect)
@re... |
github | hiptest/hiptest-publisher | https://github.com/hiptest/hiptest-publisher | lib/hiptest-publisher/cli_options_checker.rb | Ruby | mit | 49 | master | 8,637 | require 'i18n'
require 'pathname'
require 'hiptest-publisher/utils'
module Hiptest
class CliOptionError < StandardError
end
class CliOptionsChecker
attr_reader :reporter, :cli_options
def initialize(cli_options, reporter)
@cli_options = cli_options
@reporter = reporter
end
def chec... |
github | hiptest/hiptest-publisher | https://github.com/hiptest/hiptest-publisher | lib/hiptest-publisher/version_checker.rb | Ruby | mit | 49 | master | 979 | require 'hiptest-publisher/formatters/reporter'
require 'hiptest-publisher/utils'
module Hiptest
class VersionChecker
attr_reader :reporter
def self.check_version(reporter: nil)
reporter ||= Reporter.new
VersionChecker.new(reporter).check_version
end
def initialize(reporter)
@rep... |
github | hiptest/hiptest-publisher | https://github.com/hiptest/hiptest-publisher | lib/hiptest-publisher/utils.rb | Ruby | mit | 49 | master | 764 | require 'colorize'
require 'io/console'
require 'openssl'
require 'net/http/post/multipart'
require 'pathname'
def hiptest_publisher_path
Gem.loaded_specs['hiptest-publisher'].full_gem_path
rescue
'.'
end
def hiptest_publisher_version
Gem.loaded_specs['hiptest-publisher'].version.to_s
rescue
version_file = "... |
github | hiptest/hiptest-publisher | https://github.com/hiptest/hiptest-publisher | lib/hiptest-publisher/options_parser.rb | Ruby | mit | 49 | master | 28,507 | require 'i18n'
require 'optparse'
require 'parseconfig'
require 'ostruct'
require 'digest/md5'
require 'pathname'
require 'ruby-handlebars/escapers/dummy_escaper'
require 'hiptest-publisher/formatters/console_formatter'
require 'hiptest-publisher/renderer_addons'
require 'hiptest-publisher/utils'
require 'hiptest-publ... |
github | hiptest/hiptest-publisher | https://github.com/hiptest/hiptest-publisher | lib/hiptest-publisher/renderer.rb | Ruby | mit | 49 | master | 1,446 | require 'ruby-handlebars'
require 'hiptest-publisher/nodes_walker'
require 'hiptest-publisher/render_context_maker'
module Hiptest
class Renderer < Hiptest::Nodes::Walker
attr_reader :rendered
include RenderContextMaker
def self.render(node, context)
renderer = self.new(context)
context.ren... |
github | hiptest/hiptest-publisher | https://github.com/hiptest/hiptest-publisher | lib/hiptest-publisher/export_cache.rb | Ruby | mit | 49 | master | 2,086 | require 'i18n'
require_relative 'formatters/reporter'
require_relative 'file_writer'
module Hiptest
class ExportCache
def initialize(cache_dir, cache_duration, reporter: nil)
@cache_dir = cache_dir
@cache_duration = cache_duration
@reporter = reporter || Reporter.new
clear_cache
en... |
github | hiptest/hiptest-publisher | https://github.com/hiptest/hiptest-publisher | lib/hiptest-publisher/xml_parser.rb | Ruby | mit | 49 | master | 12,273 | require 'nokogiri'
require 'colorize'
require_relative 'nodes'
require_relative 'utils'
require_relative 'formatters/reporter'
module Hiptest
class XMLParser
attr_reader :project
def initialize(source, reporter = nil)
@source = source
@xml = Nokogiri::XML(source)
@reporter = reporter || N... |
github | hiptest/hiptest-publisher | https://github.com/hiptest/hiptest-publisher | lib/hiptest-publisher/renderer_addons.rb | Ruby | mit | 49 | master | 244 | require 'hiptest-publisher/renderer_addons/behave_addon'
require 'hiptest-publisher/renderer_addons/gherkin_addon'
require 'hiptest-publisher/renderer_addons/groovy_spock_addon'
require 'hiptest-publisher/renderer_addons/robot_framework_addon' |
github | hiptest/hiptest-publisher | https://github.com/hiptest/hiptest-publisher | lib/hiptest-publisher/handlebars_helper.rb | Ruby | mit | 49 | master | 8,938 | module Hiptest
class HandlebarsHelper
def self.register_helpers(handlebars, context)
instance = Hiptest::HandlebarsHelper.new(handlebars, context)
instance.register_string_helpers
instance.register_custom_helpers
end
def initialize(handlebars, context)
@handlebars = handlebars
... |
github | hiptest/hiptest-publisher | https://github.com/hiptest/hiptest-publisher | lib/hiptest-publisher/signature_exporter.rb | Ruby | mit | 49 | master | 1,573 | require 'yaml'
require 'digest/md5'
module Hiptest
class SignatureExporter
def self.export_actionwords(project, export_nodes = false)
exporter = SignatureExporter.new
[
exporter.export_actionwords(project.children[:actionwords], export_nodes),
exporter.export_libraries(project.childr... |
github | hiptest/hiptest-publisher | https://github.com/hiptest/hiptest-publisher | lib/hiptest-publisher/node_modifiers/datatable_fixer.rb | Ruby | mit | 49 | master | 957 | require 'hiptest-publisher/nodes_walker'
module Hiptest
module NodeModifiers
class DatatableFixer < Nodes::Walker
def self.add(project)
self.new.walk_node(project)
end
def walk_scenario(scenario)
return if scenario.children[:datatable].nil?
@argument_names = scenario.c... |
github | hiptest/hiptest-publisher | https://github.com/hiptest/hiptest-publisher | lib/hiptest-publisher/node_modifiers/parent_adder.rb | Ruby | mit | 49 | master | 341 | require 'hiptest-publisher/nodes_walker'
module Hiptest
module NodeModifiers
class ParentAdder
def self.add(project)
self.new.process(project)
end
def process(node)
node.each_direct_children do |child|
child.parent ||= node
process(child)
end
e... |
github | hiptest/hiptest-publisher | https://github.com/hiptest/hiptest-publisher | lib/hiptest-publisher/node_modifiers/actionword_uniq_renamer.rb | Ruby | mit | 49 | master | 1,023 | module Hiptest
module NodeModifiers
class ActionwordUniqRenamer
def self.add(project)
self.new(project).make_uniq_names
end
def initialize(project)
@project = project
end
def make_uniq_names
@project.children[:libraries].children[:libraries].each do |library... |
github | hiptest/hiptest-publisher | https://github.com/hiptest/hiptest-publisher | lib/hiptest-publisher/node_modifiers/gherkin_adder.rb | Ruby | mit | 49 | master | 8,492 | require 'hiptest-publisher/indexers/actionword_indexer'
require 'hiptest-publisher/indexers/library_actionword_indexer'
require 'hiptest-publisher/nodes'
module Hiptest
module NodeModifiers
class GherkinAdder
def self.add(project)
self.new(project).update_calls
end
def initialize(proje... |
github | hiptest/hiptest-publisher | https://github.com/hiptest/hiptest-publisher | lib/hiptest-publisher/node_modifiers/add_all.rb | Ruby | mit | 49 | master | 815 | require 'hiptest-publisher/node_modifiers/actionword_uniq_renamer'
require 'hiptest-publisher/node_modifiers/call_arguments_adder'
require 'hiptest-publisher/node_modifiers/datatable_fixer'
require 'hiptest-publisher/node_modifiers/gherkin_adder'
require 'hiptest-publisher/node_modifiers/items_orderer'
require 'hiptest... |
github | hiptest/hiptest-publisher | https://github.com/hiptest/hiptest-publisher | lib/hiptest-publisher/node_modifiers/parameter_type_adder.rb | Ruby | mit | 49 | master | 4,610 | require 'hiptest-publisher/nodes_walker'
require 'hiptest-publisher/project_grapher'
module Hiptest
module NodeModifiers
class ParameterTypeAdder
attr_reader :call_types
def self.add(project)
self.new.process(project)
end
def initialize
@call_types = CallTypes.new
... |
github | hiptest/hiptest-publisher | https://github.com/hiptest/hiptest-publisher | lib/hiptest-publisher/node_modifiers/call_arguments_adder.rb | Ruby | mit | 49 | master | 1,314 | require 'hiptest-publisher/indexers/actionword_indexer'
require 'hiptest-publisher/indexers/library_actionword_indexer'
require 'hiptest-publisher/nodes'
module Hiptest
module NodeModifiers
class DefaultArgumentAdder
def self.add(project)
self.new(project).update_calls
end
def initiali... |
github | hiptest/hiptest-publisher | https://github.com/hiptest/hiptest-publisher | lib/hiptest-publisher/node_modifiers/items_orderer.rb | Ruby | mit | 49 | master | 963 | require 'hiptest-publisher/nodes'
module Hiptest
module NodeModifiers
class ItemsOrderer
def self.add(project, order)
self.new(project).order_items(order)
end
def initialize(project)
@project = project
end
def order_items(order)
if (order == 'order')
... |
github | hiptest/hiptest-publisher | https://github.com/hiptest/hiptest-publisher | lib/hiptest-publisher/indexers/actionword_indexer.rb | Ruby | mit | 49 | master | 693 | module Hiptest
class ActionwordIndexer
def initialize(project)
@project = project
@indexed = {}
index_actionwords
end
def index_actionwords
@project.each_sub_nodes(Hiptest::Nodes::Actionword) do |aw|
aw_name = aw.children[:name]
indexed_parameters = {}
aw.... |
github | hiptest/hiptest-publisher | https://github.com/hiptest/hiptest-publisher | lib/hiptest-publisher/indexers/library_actionword_indexer.rb | Ruby | mit | 49 | master | 723 | module Hiptest
class LibraryActionwordIndexer
def initialize(project)
@project = project
@indexed = {}
index_library_actionwords
end
def index_library_actionwords
@project.each_sub_nodes(Hiptest::Nodes::LibraryActionword) do |aw|
aw_name = aw.children[:name]
indexe... |
github | hiptest/hiptest-publisher | https://github.com/hiptest/hiptest-publisher | lib/hiptest-publisher/renderer_addons/gherkin_addon.rb | Ruby | mit | 49 | master | 1,564 | require 'hiptest-publisher/nodes'
module Hiptest
module GherkinAddon
def walk_call(call)
if call.free_text_arg
@rendered_children[:free_text_arg] = rendered_freetext_arg(call)
end
if call.datatable_arg
@rendered_children[:datatable_arg] = rendered_datatable_arg(call)
end
... |
github | hiptest/hiptest-publisher | https://github.com/hiptest/hiptest-publisher | lib/hiptest-publisher/renderer_addons/groovy_spock_addon.rb | Ruby | mit | 49 | master | 979 | require 'hiptest-publisher/nodes'
module Hiptest
module GroovySpockAddon
def walk_call(call)
base = super(call)
use_annotation(call, base)
end
private
def use_annotation(call, base)
base[:use_expect_annotation] = needs_fixing?(call)
base[:use_main_annotation?] = !(call.child... |
github | hiptest/hiptest-publisher | https://github.com/hiptest/hiptest-publisher | lib/hiptest-publisher/renderer_addons/robot_framework_addon.rb | Ruby | mit | 49 | master | 1,333 | require 'hiptest-publisher/nodes'
module Hiptest
module RobotFrameworkAddon
def walk_folder(folder)
walk_scenario_container(folder)
super(folder)
end
def walk_scenarios(scenarios)
walk_scenario_container(scenarios)
super(scenarios)
end
private
def walk_scenario_cont... |
github | hiptest/hiptest-publisher | https://github.com/hiptest/hiptest-publisher | lib/hiptest-publisher/renderer_addons/behave_addon.rb | Ruby | mit | 49 | master | 508 | require 'hiptest-publisher/nodes'
module Hiptest
module BehaveAddon
def walk_actionwords(aws)
base = super(aws)
sorted_aws = aws.children[:actionwords]
.sort_by {|aw|
pattern = aw.children.fetch(:gherkin_pattern, "")
[pattern.length, pattern]
}.reverse
@rend... |
github | hiptest/hiptest-publisher | https://github.com/hiptest/hiptest-publisher | lib/hiptest-publisher/formatters/diff_displayer.rb | Ruby | mit | 49 | master | 5,216 | require 'i18n'
module Hiptest
class DiffDisplayer
def initialize(diff, cli_options, language_config, file_writer)
@diff = diff
@cli_options = cli_options
@language_config = language_config
@file_writer = file_writer
end
def display
return export_as_json if @cli_options.acti... |
github | hiptest/hiptest-publisher | https://github.com/hiptest/hiptest-publisher | lib/hiptest-publisher/formatters/reporter.rb | Ruby | mit | 49 | master | 1,463 | class Reporter
def initialize(listeners = nil)
@listeners = listeners || []
end
def add_listener(listener)
@listeners << listener
end
def dump_error(error, message = nil)
notify(:dump_error, error, message)
end
def show_error(message)
notify(:show_error, message)
end
def show_failu... |
github | hiptest/hiptest-publisher | https://github.com/hiptest/hiptest-publisher | lib/hiptest-publisher/formatters/console_formatter.rb | Ruby | mit | 49 | master | 2,416 | require 'i18n'
require 'hiptest-publisher/utils'
class ConsoleFormatter
attr_reader :verbose
def initialize(verbose, color: nil)
@verbose = verbose
@color = color.nil? ? tty? : color
@immediate_verbose = true
@verbose_messages = []
end
def dump_error(error, message = nil)
return unless v... |
github | mycolorway/tao_on_rails | https://github.com/mycolorway/tao_on_rails | tao_on_rails.gemspec | Ruby | mit | 49 | master | 909 | # coding: utf-8
$:.push File.expand_path("../lib", __FILE__)
require "tao_on_rails/version"
Gem::Specification.new do |spec|
spec.name = "tao_on_rails"
spec.version = TaoOnRails::VERSION
spec.authors = ["Siyuan Liu", "Terry Tai"]
spec.email = ["farthinker@mycolorway.com", "t@mycol... |
github | mycolorway/tao_on_rails | https://github.com/mycolorway/tao_on_rails | Rakefile | Ruby | mit | 49 | master | 209 | require 'bundler/setup'
require "bundler/gem_tasks"
require "rake/testtask"
Rake::TestTask.new(:test) do |t|
t.libs << "test"
t.libs << "lib"
t.pattern = 'test/**/*_test.rb'
end
task :default => :test |
github | mycolorway/tao_on_rails | https://github.com/mycolorway/tao_on_rails | test/base_component_test.rb | Ruby | mit | 49 | master | 2,744 | require 'test_helper'
module TaoOnRails
class BaseComponentTest < ::ActionView::TestCase
class PostComponent < BaseComponent
end
#initialize
test "it should set he view, options, and template_path" do
pc = PostComponent.new(view, { display: 'disable' })
assert_equal view, pc.view
... |
github | mycolorway/tao_on_rails | https://github.com/mycolorway/tao_on_rails | test/test_helper.rb | Ruby | mit | 49 | master | 339 | # Configure Rails Environment
ENV['RAILS_ENV'] = 'test'
require File.expand_path('../../test/dummy/config/environment.rb', __FILE__)
require 'rails/test_help'
require 'mocha/mini_test'
# Filter out Minitest backtrace while allowing backtrace from other libraries
# to be shown.
Minitest.backtrace_filter = Minitest::B... |
github | mycolorway/tao_on_rails | https://github.com/mycolorway/tao_on_rails | test/tao_test.rb | Ruby | mit | 49 | master | 254 | require 'test_helper'
class TaoOnRails::Test < ActiveSupport::TestCase
test 'version number' do
assert TaoOnRails::VERSION
end
test 'TaoOnRails::Engine inherits from Rails::Engine' do
assert TaoOnRails::Engine < Rails::Engine
end
end |
github | mycolorway/tao_on_rails | https://github.com/mycolorway/tao_on_rails | test/action_view/helpers_test.rb | Ruby | mit | 49 | master | 752 | require 'test_helper'
module TaoOnRails
module ActionView
class HelpersTest < ::ActionView::TestCase
# #page_id
test "when @page_id set, page_id should be set to @page_id" do
view.instance_variable_set(:@page_id, 'home')
assert_equal 'home', view.page_id
end
test "when @... |
github | mycolorway/tao_on_rails | https://github.com/mycolorway/tao_on_rails | test/integration/component_test.rb | Ruby | mit | 49 | master | 1,324 | require 'test_helper'
class ComponentTest < ActionDispatch::IntegrationTest
test "article component should be render correctly" do
get "/posts"
assert_response :success
assert response.body.include?('<article>')
assert response.body.include?('<h1>Hello</h1>')
assert response.body.include?('<p>... |
github | mycolorway/tao_on_rails | https://github.com/mycolorway/tao_on_rails | test/dummy/app/components/posts/article_component.rb | Ruby | mit | 49 | master | 204 | module Posts
class ArticleComponent < TaoOnRails::BaseComponent
attr_reader :post
def initialize view, options
super view, options
@post = @options.delete(:post)
end
end
end |
github | mycolorway/tao_on_rails | https://github.com/mycolorway/tao_on_rails | test/dummy/app/controllers/posts_controller.rb | Ruby | mit | 49 | master | 332 | class PostsController < ApplicationController
def show
@post = posts[params[:id].to_i - 1]
end
def index
@posts = posts
end
private
def posts
@posts ||= [OpenStruct.new({ title: 'Hello', content: 'You can call me God' }),
OpenStruct.new({ title: 'Hola', content: 'CarpeDiem' })... |
github | mycolorway/tao_on_rails | https://github.com/mycolorway/tao_on_rails | test/dummy/config/application.rb | Ruby | mit | 49 | master | 918 | require_relative 'boot'
require "rails"
# Pick the frameworks you want:
require "active_model/railtie"
require "active_job/railtie"
# require "active_record/railtie"
# require "active_storage/engine"
require "action_controller/railtie"
# require "action_mailer/railtie"
require "action_view/railtie"
# require "action_c... |
github | mycolorway/tao_on_rails | https://github.com/mycolorway/tao_on_rails | test/dummy/config/routes.rb | Ruby | mit | 49 | master | 217 | Rails.application.routes.draw do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
resources :posts, only: [:show, :index]
resources :authors, only: [:show]
end |
github | mycolorway/tao_on_rails | https://github.com/mycolorway/tao_on_rails | test/dummy/config/environments/production.rb | Ruby | mit | 49 | master | 2,852 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web serve... |
github | mycolorway/tao_on_rails | https://github.com/mycolorway/tao_on_rails | test/dummy/config/environments/development.rb | Ruby | mit | 49 | master | 1,398 | 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 | mycolorway/tao_on_rails | https://github.com/mycolorway/tao_on_rails | lib/tao_on_rails/engine.rb | Ruby | mit | 49 | master | 354 | module TaoOnRails
class Engine < Rails::Engine
config.eager_load_paths += Dir["#{config.root}/lib"]
initializer "tao_on_rails" do
::ActiveSupport.on_load :action_view do
include ::TaoOnRails::ActionView::Helpers
load_tao_components ::TaoOnRails::Engine.root
define_component_hel... |
github | mycolorway/tao_on_rails | https://github.com/mycolorway/tao_on_rails | lib/tao_on_rails/base_component.rb | Ruby | mit | 49 | master | 3,111 | module TaoOnRails
class BaseComponent
attr_reader :options, :view
delegate :component_name, :tag_prefix, :template_paths, :template_name, to: :class
def initialize view, options = {}
@view = view
@options = merge_options default_options, options
template_paths.unshift(@options.delete(... |
github | mycolorway/tao_on_rails | https://github.com/mycolorway/tao_on_rails | lib/tao_on_rails/action_view/helpers.rb | Ruby | mit | 49 | master | 1,141 | module TaoOnRails
module ActionView
module Helpers
extend ActiveSupport::Concern
def page_id
return @page_id if defined?(@page_id)
controller_names = controller_path.split('/')
[controller_names, action_name].compact.flatten.join('_').dasherize
end
class_methods d... |
github | mbogh/fastlane-plugin-teams | https://github.com/mbogh/fastlane-plugin-teams | fastlane-plugin-teams.gemspec | Ruby | mit | 49 | master | 999 | # coding: utf-8
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'fastlane/plugin/teams/version'
Gem::Specification.new do |spec|
spec.name = 'fastlane-plugin-teams'
spec.version = Fastlane::Teams::VERSION
spec.author = %q{Morten Bøg... |
github | mbogh/fastlane-plugin-teams | https://github.com/mbogh/fastlane-plugin-teams | lib/fastlane/plugin/teams.rb | Ruby | mit | 49 | master | 457 | require 'fastlane/plugin/teams/version'
module Fastlane
module Teams
# Return all .rb files inside the "actions" and "helper" directory
def self.all_classes
Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))]
end
end
end
# By default we want to import all available actions ... |
github | mbogh/fastlane-plugin-teams | https://github.com/mbogh/fastlane-plugin-teams | lib/fastlane/plugin/teams/helper/teams_helper.rb | Ruby | mit | 49 | master | 296 | module Fastlane
module Helper
class TeamsHelper
# class methods that you define here become available in your action
# as `Helper::TeamsHelper.your_method`
#
def self.show_message
UI.message("Hello from the teams plugin helper!")
end
end
end
end |
github | mbogh/fastlane-plugin-teams | https://github.com/mbogh/fastlane-plugin-teams | lib/fastlane/plugin/teams/actions/teams_action.rb | Ruby | mit | 49 | master | 3,510 | module Fastlane
module Actions
class TeamsAction < Action
def self.run(params)
require 'net/http'
require 'uri'
payload = {
"@type" => "MessageCard",
"@context" => "http://schema.org/extensions",
"themeColor" => params[:theme_color],
"title" ... |
github | mbogh/fastlane-plugin-teams | https://github.com/mbogh/fastlane-plugin-teams | spec/spec_helper.rb | Ruby | mit | 49 | master | 378 | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
# This module is only used to check the environment is currently a testing env
module SpecHelper
end
require 'fastlane' # to import the Action super class
require 'fastlane/plugin/teams' # import the actual plugin
Fastlane.load_actions # load other actions (... |
github | mbogh/fastlane-plugin-teams | https://github.com/mbogh/fastlane-plugin-teams | spec/teams_action_spec.rb | Ruby | mit | 49 | master | 243 | describe Fastlane::Actions::TeamsAction do
describe '#run' do
it 'prints a message' do
expect(Fastlane::UI).to receive(:message).with("The teams plugin is working!")
Fastlane::Actions::TeamsAction.run(nil)
end
end
end |
github | rickr/trumpify | https://github.com/rickr/trumpify | trumpify.gemspec | Ruby | mit | 49 | master | 879 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
Gem::Specification.new do |spec|
spec.name = 'trumpify'
spec.version = '0.1.0'
spec.authors = ['RickR']
spec.email = ['rick@rudelinux.org']
spec.summary = %q{... |
github | rickr/trumpify | https://github.com/rickr/trumpify | test/trumpy_test.rb | Ruby | mit | 49 | master | 1,277 | require 'test_helper'
class TrumpifyTest < Minitest::Test
def test_the_truth
assert liberals == false
assert president?
end
def test_it_works_with_chains
assert_equal %w(damn liberals), 'damn liberals'.make_split_great_again
end
def test_it_works_with_arguments
assert_equal %w(h a i r p i e... |
github | rickr/trumpify | https://github.com/rickr/trumpify | lib/trumpify.rb | Ruby | mit | 49 | master | 721 | module Trumpify
module ObjectMixin
def liberals
!true
end
def president?
true
end
def method_missing(methId, *args, &block)
method_name = methId.id2name
# Bail out if called by someone who doesn't support freedom
super unless m = method_name.match(/make_(.*)_great_... |
github | mirego/emojimmy | https://github.com/mirego/emojimmy | emojimmy.gemspec | Ruby | bsd-3-clause | 49 | master | 1,169 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'emojimmy/version'
Gem::Specification.new do |spec|
spec.name = 'emojimmy'
spec.version = Emojimmy::VERSION
spec.authors = ['Rémi Prévost']
spec.email = ['rpre... |
github | mirego/emojimmy | https://github.com/mirego/emojimmy | Rakefile | Ruby | bsd-3-clause | 49 | master | 391 | require 'bundler'
require 'rake'
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
task default: :spec
desc 'Run all specs'
RSpec::Core::RakeTask.new(:spec) do |task|
task.pattern = 'spec/**/*_spec.rb'
end
desc 'Start an IRB session with the gem'
task :console do
$:.unshift File.expand_path('..', __FILE... |
github | mirego/emojimmy | https://github.com/mirego/emojimmy | spec/emojimmy_spec.rb | Ruby | bsd-3-clause | 49 | master | 3,881 | # encoding: utf-8
require 'spec_helper'
describe Emojimmy do
describe :token_to_emoji do
let(:stored_text) { 'Hello :grin::grin: you :smiling_imp: :frog:!' }
let(:returned_text) { 'Hello 😁😁 you 😈 🐸!' }
subject { Emojimmy.token_to_emoji(stored_text) }
it { should eql returned_text }
end
desc... |
github | mirego/emojimmy | https://github.com/mirego/emojimmy | spec/spec_helper.rb | Ruby | bsd-3-clause | 49 | master | 509 | $:.unshift File.expand_path('../lib', __FILE__)
require 'rspec'
require 'rspec/its'
require 'sqlite3'
require 'emojimmy'
# Require our macros and extensions
Dir[File.expand_path('../../spec/support/macros/**/*.rb', __FILE__)].map(&method(:require))
RSpec.configure do |config|
# Include our macros
config.include ... |
github | mirego/emojimmy | https://github.com/mirego/emojimmy | spec/emojimmy/mixin_spec.rb | Ruby | bsd-3-clause | 49 | master | 2,435 | # encoding: utf-8
require 'spec_helper'
describe Emojimmy::Mixin do
describe :inject_methods do
before do
run_migration do
create_table(:comments, force: true) do |t|
t.text :body
end
end
end
context 'with invalid options for `in`' do
before do
spawn_e... |
github | mirego/emojimmy | https://github.com/mirego/emojimmy | spec/support/macros/database_macros.rb | Ruby | bsd-3-clause | 49 | master | 675 | module DatabaseMacros
# Run migrations in the test database
def run_migration(&block)
# Create a new migration class
klass = Class.new(ActiveRecord::Migration)
# Create a new `up` that executes the argument
klass.send(:define_method, :up) { self.instance_exec(&block) }
# Create a new instance ... |
github | mirego/emojimmy | https://github.com/mirego/emojimmy | spec/support/macros/model_macros.rb | Ruby | bsd-3-clause | 49 | master | 572 | module ModelMacros
# Create a new Emojimmy-powered model
def spawn_emojimmy_model(klass_name, *args, &block)
spawn_model klass_name do
stores_emoji_characters *args
instance_exec(&block) if block
end
end
protected
# Create a new model class
def spawn_model(klass_name, parent_klass = Ac... |
github | mirego/emojimmy | https://github.com/mirego/emojimmy | spec/support/macros/database/sqlite3_adapter.rb | Ruby | bsd-3-clause | 49 | master | 331 | require_relative 'database_adapter'
class Sqlite3Adapter < DatabaseAdapter
def database_configuration
{
adapter: 'sqlite3',
database: ':memory:'
}
end
def reset_database!
ActiveRecord::Base.connection.execute("select 'drop table ' || name || ';' from sqlite_master where type = 'table';")... |
github | mirego/emojimmy | https://github.com/mirego/emojimmy | lib/emojimmy.rb | Ruby | bsd-3-clause | 49 | master | 976 | # encoding: utf-8
require 'emojimmy/version'
# Dependencies
require 'rumoji'
require 'active_record'
# Modules
require 'emojimmy/mixin'
require 'emojimmy/extensions'
module Emojimmy
# Loop through all emoji and replace them with
# their matching token
def self.emoji_to_token(content)
return content unless ... |
github | mirego/emojimmy | https://github.com/mirego/emojimmy | lib/emojimmy/mixin.rb | Ruby | bsd-3-clause | 49 | master | 758 | module Emojimmy
module Mixin
def self.inject_methods(model, attributes)
attributes.each do |attribute|
model.class_eval <<-RUBY, __FILE__, __LINE__ + 1
# Before saving the record, convert the attribute value
before_save do
unless respond_to?("#{attribute}=")
... |
github | rajasegar/codeshift | https://github.com/rajasegar/codeshift | codeshift.gemspec | Ruby | mit | 49 | master | 1,390 | lib = File.expand_path("lib", __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "codeshift/version"
Gem::Specification.new do |spec|
spec.name = "codeshift"
spec.version = Codeshift::VERSION
spec.authors = ["Rajasegar Chandran"]
spec.email = ["rajasegar.c@gma... |
github | rajasegar/codeshift | https://github.com/rajasegar/codeshift | spec/spec_helper.rb | Ruby | mit | 49 | master | 432 | # frozen_string_literal: true
require 'bundler/setup'
require 'codeshift'
require 'coveralls'
Coveralls.wear!
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = '.rspec_status'
# Disable RSpec exposing methods globally on `Module` an... |
github | rajasegar/codeshift | https://github.com/rajasegar/codeshift | spec/codeshift_spec.rb | Ruby | mit | 49 | master | 417 | RSpec.describe Codeshift do
it "has a version number" do
expect(Codeshift::VERSION).not_to be nil
end
it "does apply the transform" do
input = File.read('./spec/fixtures/input.rb')
transform = File.read('./spec/fixtures/transform.rb')
output = File.read('./spec/fixtures/output.rb')
result = C... |
github | rajasegar/codeshift | https://github.com/rajasegar/codeshift | lib/codeshift/cli.rb | Ruby | mit | 49 | master | 1,519 | # frozen_string_literal: true
require 'optparse'
require 'codeshift/options'
require 'codeshift/transformer'
require 'codeshift/version'
require 'open-uri'
module CodeShift
# Cli Class
class CLI
def initialize
@options = Codeshift::Options.new
OptionParser.new do |opts|
opts.banner = 'Usag... |
github | rajasegar/codeshift | https://github.com/rajasegar/codeshift | lib/codeshift/transformer.rb | Ruby | mit | 49 | master | 638 | # frozen_string_literal: true
require 'parser/current'
module Codeshift
# Transformer Class
class Transformer
def initialize(code, transform)
@code = code
@transform = transform
end
def transform
eval(@transform)
buffer = Parser::Source::Buffer.new('(example)')
b... |
github | rajasegar/codeshift | https://github.com/rajasegar/codeshift | lib/codeshift/options.rb | Ruby | mit | 49 | master | 219 | # frozen_string_literal: true
module Codeshift
class Options
attr_accessor :file_path
attr_accessor :transform
def initialize
@file_path = nil
@transform = './transform.rb'
end
end
end |
github | bdougie/variables-in-markdown | https://github.com/bdougie/variables-in-markdown | action.rb | Ruby | mit | 49 | master | 1,072 | require "octokit"
require "json"
require "marky_markdown"
# Each Action has an event passed to it.
event = JSON.parse(File.read(ENV['GITHUB_EVENT_PATH']))
safeword = "MARKYMARKED"
# puts event
puts "-------------------------------------------------"
# Exit Neutral if this is not a newly "opened" issue
exit(78) if ev... |
github | fnando/normalize_attributes | https://github.com/fnando/normalize_attributes | normalize_attributes.gemspec | Ruby | mit | 49 | main | 1,240 | # frozen_string_literal: true
require "./lib/normalize_attributes/version"
Gem::Specification.new do |s|
s.name = "normalize_attributes"
s.version = NormalizeAttributes::Version::STRING
s.platform = Gem::Platform::RUBY
s.authors = ["Nando Vieira"]
s.email = ["fnando.vieira@gmail.com"... |
github | fnando/normalize_attributes | https://github.com/fnando/normalize_attributes | lib/normalize_attributes.rb | Ruby | mit | 49 | main | 297 | # frozen_string_literal: true
require "active_record"
ActiveSupport.on_load(:active_record) do
require "active_support/core_ext/string/filters"
require "normalize_attributes/version"
require "normalize_attributes/callbacks"
ActiveRecord::Base.include NormalizeAttributes::Callbacks
end |
github | fnando/normalize_attributes | https://github.com/fnando/normalize_attributes | lib/normalize_attributes/callbacks.rb | Ruby | mit | 49 | main | 2,451 | # frozen_string_literal: true
module NormalizeAttributes
def self.retrieve_value(record, attribute, raw)
before_type_cast_method = "#{attribute}_before_type_cast"
if raw && record.respond_to?(before_type_cast_method)
record.send(before_type_cast_method)
else
record.send(attribute)
end
... |
github | fnando/normalize_attributes | https://github.com/fnando/normalize_attributes | test/test_helper.rb | Ruby | mit | 49 | main | 418 | # frozen_string_literal: true
require "simplecov"
SimpleCov.start
require "bundler/setup"
require "normalize_attributes"
require "minitest/utils"
require "minitest/autorun"
ActiveRecord::Base.belongs_to_required_by_default = true
ActiveRecord::Base.establish_connection adapter: "sqlite3", database: ":memory:"
# Lo... |
github | fnando/normalize_attributes | https://github.com/fnando/normalize_attributes | test/schema.rb | Ruby | mit | 49 | main | 291 | # frozen_string_literal: true
ActiveRecord::Schema.define(version: 0) do
create_table :users do |t|
t.string :email, :username
t.text :preferences
t.integer :age, null: false, default: 0
end
create_table :tokens do |t|
t.string :name
t.references :user
end
end |
github | fnando/normalize_attributes | https://github.com/fnando/normalize_attributes | test/normalize_attributes_test.rb | Ruby | mit | 49 | main | 3,700 | # frozen_string_literal: true
require "test_helper"
class NormalizeAttributesTest < Minitest::Test
setup do
User.normalize_options = {}
end
test "respond to aliases" do
assert User.respond_to?(:normalize)
assert User.respond_to?(:normalize_attr)
assert User.respond_to?(:normalize_attrs)
ass... |
github | fnando/normalize_attributes | https://github.com/fnando/normalize_attributes | test/support/user.rb | Ruby | mit | 49 | main | 280 | # frozen_string_literal: true
class User < ActiveRecord::Base
has_many :tokens
serialize :preferences
attr_accessor :nickname
def normalize_username(username)
username.downcase
end
private def private_normalize_username(username)
username.upcase
end
end |
github | janlelis/fancy_irb | https://github.com/janlelis/fancy_irb | Rakefile | Ruby | mit | 49 | main | 706 | require 'rubygems'
require 'rake'
require 'fileutils'
def gemspec
@gemspec ||= eval(File.read('fancy_irb.gemspec'), binding, 'fancy_irb.gemspec')
end
desc "Build the gem"
task :gem => :gemspec do
sh "gem build fancy_irb.gemspec"
FileUtils.mkdir_p 'pkg'
FileUtils.mv "#{gemspec.name}-#{gemspec.version}.gem", 'p... |
github | janlelis/fancy_irb | https://github.com/janlelis/fancy_irb | fancy_irb.gemspec | Ruby | mit | 49 | main | 1,335 | # -*- encoding: utf-8 -*-
require File.dirname(__FILE__) + "/lib/fancy_irb/version"
Gem::Specification.new do |s|
s.name = "fancy_irb"
s.version = FancyIrb::VERSION
s.authors = ["Jan Lelis"]
s.email = ["hi@ruby.consulting"]
s.homepage = "https://github.com/janlelis/fancy_irb"
s.sum... |
github | janlelis/fancy_irb | https://github.com/janlelis/fancy_irb | lib/fancy_irb.rb | Ruby | mit | 49 | main | 1,344 | require_relative 'fancy_irb/version'
require 'stringio'
require 'paint'
require 'unicode/display_width'
require_relative 'fancy_irb/terminal_info'
require_relative 'fancy_irb/size_detector'
require_relative 'fancy_irb/error_capturer'
require_relative 'fancy_irb/implementation'
module FancyIrb
DEFAULT_OPTIONS = {
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.