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
instructure/ruby-saml2
https://github.com/instructure/ruby-saml2
spec/lib/saml2/endpoint/array_spec.rb
Ruby
mit
45
main
3,597
# frozen_string_literal: true module SAML2 class Endpoint describe Array do context "with no endpoints" do let(:endpoints) { described_class.new } describe "#choose_binding" do it "returns nil" do expect(endpoints.choose_binding(Bindings::HTTP_POST::URN)).to be_nil ...
github
instructure/ruby-saml2
https://github.com/instructure/ruby-saml2
spec/lib/saml2/endpoint/indexed/array_spec.rb
Ruby
mit
45
main
2,134
# frozen_string_literal: true module SAML2 class Endpoint class Indexed describe Array do context "with a later endpoint that's the default" do let(:endpoints) do described_class.new([ Indexed.new("http://example.com/post", nil, nil, Bindings:...
github
instructure/ruby-saml2
https://github.com/instructure/ruby-saml2
spec/lib/saml2/conditions/audience_restriction_spec.rb
Ruby
mit
45
main
765
# frozen_string_literal: true module SAML2 class Conditions describe AudienceRestriction do it "should be invalid" do expect(AudienceRestriction.new("expected").valid?(audience: "actual")).to be false end it "should be valid" do expect(AudienceRestriction.new("expected").valid?...
github
instructure/ruby-saml2
https://github.com/instructure/ruby-saml2
spec/lib/saml2/bindings/http_redirect_spec.rb
Ruby
mit
45
main
10,996
# frozen_string_literal: true require "openssl" module SAML2 describe Bindings::HTTPRedirect do let(:message) { instance_double(Message, destination: "http://somewhere/", to_s: "hi") } describe ".decode" do def check_error(wrapped, cause) error = nil begin yield resc...
github
benbalter/change_agent
https://github.com/benbalter/change_agent
Rakefile
Ruby
mit
45
master
346
# frozen_string_literal: true require 'rake' require 'rake/testtask' require 'bundler/gem_tasks' Rake::TestTask.new(:test) do |test| test.libs << 'lib' << 'test' test.pattern = 'test/**/test_change_agent*.rb' test.verbose = true end desc 'Open console with Change Agent loaded' task :console do exec 'pry -r ....
github
benbalter/change_agent
https://github.com/benbalter/change_agent
change_agent.gemspec
Ruby
mit
45
master
1,274
# frozen_string_literal: true lib = File.expand_path('lib', __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'change_agent/version' Gem::Specification.new do |spec| spec.name = 'change_agent' spec.version = ChangeAgent::VERSION spec.authors = ['Ben Balter'] spec.em...
github
benbalter/change_agent
https://github.com/benbalter/change_agent
test/test_change_agent_client.rb
Ruby
mit
45
master
1,880
# frozen_string_literal: true require 'helper' class TestChangeAgentClient < Minitest::Test def setup init_tempdir @client = ChangeAgent::Client.new(tempdir) end def teardown FileUtils.rm_rf tempdir end should 'set the directory on init' do assert_equal tempdir, @client.directory end ...
github
benbalter/change_agent
https://github.com/benbalter/change_agent
test/helper.rb
Ruby
mit
45
master
347
# frozen_string_literal: true require 'rubygems' require 'bundler' require 'minitest/autorun' require 'shoulda' $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) def tempdir File.expand_path './tmp', File.dirname(__FILE__) end def init_tempdir FileUtils.rm_rf tempdir FileUtils.mkdir tempdir e...
github
benbalter/change_agent
https://github.com/benbalter/change_agent
test/test_change_agent.rb
Ruby
mit
45
master
297
# frozen_string_literal: true require 'helper' class TestChangeAgent < Minitest::Test def setup init_tempdir end def teardown FileUtils.rm_rf tempdir end should 'return a ChangeAgent::Client' do assert_equal ChangeAgent::Client, ChangeAgent.init(tempdir).class end end
github
benbalter/change_agent
https://github.com/benbalter/change_agent
test/test_change_agent_sync.rb
Ruby
mit
45
master
1,928
# frozen_string_literal: true require 'helper' class TestChangeAgentSync < Minitest::Test def setup init_tempdir @client = ChangeAgent::Client.new tempdir @demo = ChangeAgent::Client.new tempdir, 'http://github.com/benbalter/change_agent_demo' end def teardown FileUtils.rm_rf tempdir end s...
github
benbalter/change_agent
https://github.com/benbalter/change_agent
test/test_change_agent_document.rb
Ruby
mit
45
master
2,416
# frozen_string_literal: true require 'helper' class TestChangeAgentDocument < Minitest::Test def setup init_tempdir @client = ChangeAgent::Client.new tempdir @document = ChangeAgent::Document.new('foo', @client) @namespaced_document = ChangeAgent::Document.new('bar/foo', @client) end def teard...
github
benbalter/change_agent
https://github.com/benbalter/change_agent
lib/change_agent.rb
Ruby
mit
45
master
365
# frozen_string_literal: true require_relative 'change_agent/version' require_relative 'change_agent/document' require_relative 'change_agent/sync' require_relative 'change_agent/client' require 'rugged' require 'pathname' require 'dotenv' module ChangeAgent def self.init(directory = nil, remote = nil) Client.n...
github
benbalter/change_agent
https://github.com/benbalter/change_agent
lib/change_agent/document.rb
Ruby
mit
45
master
1,694
# frozen_string_literal: true module ChangeAgent class Document attr_writer :contents attr_accessor :path alias key path def initialize(path, client_or_directory = nil) @path = path @client = if client_or_directory.instance_of?(ChangeAgent::Client) client_or_directory ...
github
benbalter/change_agent
https://github.com/benbalter/change_agent
lib/change_agent/sync.rb
Ruby
mit
45
master
3,247
# frozen_string_literal: true module ChangeAgent module Sync class MergeConflict < StandardError; end class MissingRemote < ArgumentError; end attr_writer :credentials DEFAULT_REMOTE = 'origin' DEFAULT_REMOTE_BRANCH = 'origin/master' DEFAULT_LOCAL_REF = 'refs/heads/master' # Default to...
github
benbalter/change_agent
https://github.com/benbalter/change_agent
lib/change_agent/client.rb
Ruby
mit
45
master
967
# frozen_string_literal: true module ChangeAgent class Client include ChangeAgent::Sync attr_accessor :directory def initialize(directory = nil, remote = nil) @directory = File.expand_path(directory || Dir.pwd) @remote = remote end def repo @repo ||= if @remote.nil? ...
github
jhass/configurate
https://github.com/jhass/configurate
configurate.gemspec
Ruby
mit
45
main
815
# frozen_string_literal: true Gem::Specification.new do |s| s.name = "configurate" s.version = "0.6.0" s.summary = "Flexbile configuration system" s.description = "Configurate is a flexible configuration system that can "\ "read settings from multiple sources at the same time."...
github
jhass/configurate
https://github.com/jhass/configurate
Guardfile
Ruby
mit
45
main
380
# frozen_string_literal: true guard :rspec, cmd: "bundle exec rspec" do watch(%r{^spec/.+_spec\.rb$}) watch(%r{^lib/(.+)\.rb$}) {|m| "spec/#{m[1]}_spec.rb" } watch(%r{^lib/configurate/(.+)\.rb$}) {|m| "spec/#{m[1]}_spec.rb" } watch("spec/spec_helper.rb") { "spec" } end guard "yard" do watch(%r{lib/.+\.rb}) ...
github
jhass/configurate
https://github.com/jhass/configurate
Gemfile
Ruby
mit
45
main
323
# frozen_string_literal: true source "https://rubygems.org" gem "coveralls", require: false, group: :coverage group :development do gem "guard-rspec" gem "guard-rubocop" gem "guard-yard" gem "rubocop", require: false end group :doc do gem "redcarpet", require: false gem "yard", require: false end gemsp...
github
jhass/configurate
https://github.com/jhass/configurate
spec/spec_helper.rb
Ruby
mit
45
main
965
# frozen_string_literal: true # This file was generated by the `rspec --init` command. Conventionally, all # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. # Require this file using `require "spec_helper"` to ensure that it is only # loaded once. # # See http://rubydoc.info/gems/rspec-core/...
github
jhass/configurate
https://github.com/jhass/configurate
spec/configurate_spec.rb
Ruby
mit
45
main
709
# frozen_string_literal: true require "spec_helper" describe Configurate::Settings do describe "#method_missing" do subject { described_class.create } it "delegates the call to a new proxy object" do proxy = double expect(Configurate::Proxy).to receive(:new).and_return(proxy) expect(proxy...
github
jhass/configurate
https://github.com/jhass/configurate
spec/configurate/lookup_chain_spec.rb
Ruby
mit
45
main
3,688
# frozen_string_literal: true require "spec_helper" class InvalidConfigurationProvider; end class ValidConfigurationProvider def lookup(_setting, *_args); end end describe Configurate::LookupChain do subject { described_class.new } describe "#add_provider" do it "adds a valid provider" do expect { ...
github
jhass/configurate
https://github.com/jhass/configurate
spec/configurate/proxy_spec.rb
Ruby
mit
45
main
3,071
# frozen_string_literal: true require "spec_helper" describe Configurate::Proxy do let(:lookup_chain) { double(lookup: "something") } let(:proxy) { described_class.new(lookup_chain) } describe "in case statements" do it "acts like the target" do pending "If anyone knows a sane way to overwrite Module...
github
jhass/configurate
https://github.com/jhass/configurate
spec/configurate/setting_path_spec.rb
Ruby
mit
45
main
3,406
# frozen_string_literal: true require "spec_helper" describe Configurate::SettingPath do let(:normal_path) { described_class.new([:foo]) } let(:question_path) { described_class.new([:foo?]) } let(:action_path) { described_class.new([:foo!]) } let(:setter_path) { described_class.new([:foo=]) } let(:long_path...
github
jhass/configurate
https://github.com/jhass/configurate
spec/configurate/provider_spec.rb
Ruby
mit
45
main
1,020
# frozen_string_literal: true require "spec_helper" describe Configurate::Provider::Base do describe "#lookup" do subject { described_class.new } it "calls #lookup_path" do path = Configurate::SettingPath.new(%w[foo bar]) expect(subject).to receive(:lookup_path).with(path).and_return("something"...
github
jhass/configurate
https://github.com/jhass/configurate
spec/configurate/provider/toml_spec.rb
Ruby
mit
45
main
3,241
# frozen_string_literal: true require "spec_helper" require "configurate/provider/toml" describe Configurate::Provider::TOML do PARSER = Configurate::Provider::TOML::PARSER let(:settings) { { "toplevel" => "bar", "some" => { "nested" => {"some" => "lala", "setting" => "foo"} } ...
github
jhass/configurate
https://github.com/jhass/configurate
spec/configurate/provider/dynamic_spec.rb
Ruby
mit
45
main
1,396
# frozen_string_literal: true require "spec_helper" describe Configurate::Provider::Dynamic do subject { described_class.new } describe "#lookup_path" do it "returns nil if the setting was never set" do expect(subject.lookup_path(Configurate::SettingPath.new(["not_me"]))).to be_nil end it "reme...
github
jhass/configurate
https://github.com/jhass/configurate
spec/configurate/provider/string_hash_spec.rb
Ruby
mit
45
main
2,220
# frozen_string_literal: true require "spec_helper" describe Configurate::Provider::StringHash do let(:settings) { { "toplevel" => "bar", "some" => { "nested" => {"some" => "lala", "setting" => "foo"} } } } describe "#initialize" do it "raises if the argument is not ha...
github
jhass/configurate
https://github.com/jhass/configurate
spec/configurate/provider/env_spec.rb
Ruby
mit
45
main
1,049
# frozen_string_literal: true require "spec_helper" describe Configurate::Provider::Env do subject { described_class.new } let(:existing_path) { %w[existing setting] } let(:not_existing_path) { %w[not existing path] } let(:array_path) { ["array"] } before(:all) do ENV["EXISTING_SETTING"] = "there" E...
github
jhass/configurate
https://github.com/jhass/configurate
spec/configurate/provider/yaml_spec.rb
Ruby
mit
45
main
3,068
# frozen_string_literal: true require "spec_helper" describe Configurate::Provider::YAML do let(:settings) { { "toplevel" => "bar", "some" => { "nested" => {"some" => "lala", "setting" => "foo"} } } } describe "#initialize" do it "loads the file" do file = "fooba...
github
jhass/configurate
https://github.com/jhass/configurate
lib/configurate.rb
Ruby
mit
45
main
3,138
# frozen_string_literal: true require "forwardable" require "configurate/setting_path" require "configurate/lookup_chain" require "configurate/provider" require "configurate/proxy" # A flexible and extendable configuration system. # The calling logic is isolated from the lookup logic # through configuration provider...
github
jhass/configurate
https://github.com/jhass/configurate
lib/configurate/setting_path.rb
Ruby
mit
45
main
1,853
# frozen_string_literal: true require "forwardable" module Configurate # Class encapsulating the concept of a path to a setting class SettingPath include Enumerable extend Forwardable def initialize path=[] path = path.split(".") if path.is_a? String @path = path end def initiali...
github
jhass/configurate
https://github.com/jhass/configurate
lib/configurate/lookup_chain.rb
Ruby
mit
45
main
1,956
# frozen_string_literal: true module Configurate # This object builds a chain of configuration providers to try to find # the value of a setting. class LookupChain def initialize @provider = [] end # Adds a provider to the chain. Providers are tried in the order # they are added, so the or...
github
jhass/configurate
https://github.com/jhass/configurate
lib/configurate/provider.rb
Ruby
mit
45
main
1,235
# frozen_string_literal: true module Configurate module Provider # This provides a basic {#lookup} method for other providers to build # upon. Childs are expected to define +lookup_path(path, *args)+. # The method should return nil if the setting # wasn't found and {#lookup} will raise an {SettingNot...
github
jhass/configurate
https://github.com/jhass/configurate
lib/configurate/proxy.rb
Ruby
mit
45
main
2,969
# frozen_string_literal: true module Configurate # Proxy object to support nested settings # # *Cavehats*: Since this object is always true, adding a +?+ at the end # returns the value, if found, instead of the proxy object. # So instead of +if settings.foo.bar+ use +if settings.foo.bar?+ # to check for bo...
github
jhass/configurate
https://github.com/jhass/configurate
lib/configurate/provider/yaml.rb
Ruby
mit
45
main
1,198
# frozen_string_literal: true require "yaml" module Configurate module Provider # This provider tries to open a YAML file and does nested lookups # in it. class YAML < StringHash # @param file [String] the path to the file # @param namespace [String] optionally set this as the root # @...
github
jhass/configurate
https://github.com/jhass/configurate
lib/configurate/provider/string_hash.rb
Ruby
mit
45
main
1,805
# frozen_string_literal: true module Configurate module Provider # This provider takes a nested string keyed hash and does nested lookups in it. class StringHash < Base # @param hash [::Hash] the string keyed hash to provide values from # @param namespace [String] optionally set this as the root ...
github
jhass/configurate
https://github.com/jhass/configurate
lib/configurate/provider/dynamic.rb
Ruby
mit
45
main
1,219
# frozen_string_literal: true module Configurate module Provider # This provider knows nothing upon initialization, however if you access # a setting ending with +=+ and give one argument to that call it remembers # that setting, stripping the +=+ and will return it on the next call # without +=+. Se...
github
jhass/configurate
https://github.com/jhass/configurate
lib/configurate/provider/toml.rb
Ruby
mit
45
main
1,355
# frozen_string_literal: true require "configurate" module Configurate module Provider # This provider tries to open a TOML file and does nested lookups # in it. class TOML < StringHash begin require "toml-rb" PARSER = TomlRB rescue LoadError => e require "tomlrb" ...
github
jhass/configurate
https://github.com/jhass/configurate
lib/configurate/provider/env.rb
Ruby
mit
45
main
688
# frozen_string_literal: true module Configurate module Provider # This provider looks for settings in the environment. # For the setting +foo.bar_baz+ this provider will look for an # environment variable +FOO_BAR_BAZ+, joining all components of the # setting with underscores and upcasing the result...
github
hack-different/smcutil
https://github.com/hack-different/smcutil
smcutil.gemspec
Ruby
mit
46
master
1,493
# coding: utf-8 lib = File.expand_path("../lib", __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "smcutil/version" Gem::Specification.new do |spec| spec.name = "smcutil" spec.version = SmcUtil::VERSION spec.authors = ["Rick Mark"] spec.email = ["rickmark@o...
github
hack-different/smcutil
https://github.com/hack-different/smcutil
lib/smcutil.rb
Ruby
mit
46
master
249
require "smcutil/version" module SmcUtil DEBUG = true autoload :FileReader, 'smcutil/file_reader' autoload :FileValidator, 'smcutil/file_validator' autoload :FileExtractor, 'smcutil/file_extractor' autoload :Region, 'smcutil/region' end
github
hack-different/smcutil
https://github.com/hack-different/smcutil
lib/smcutil/region.rb
Ruby
mit
46
master
241
module SmcUtil class Region attr_accessor :offset, :data def initialize(offset, data) @offset = offset @data = data end def to_s "#{self.offset.to_s(16).upcase} (length #{data.length})" end end end
github
hack-different/smcutil
https://github.com/hack-different/smcutil
lib/smcutil/file_extractor.rb
Ruby
mit
46
master
871
class SmcUtil::FileExtractor OUTPUT_FILE_FLAGS = File::CREAT | File::TRUNC | File::WRONLY def initialize(file_reader) @file_reader = file_reader end def extract_to(path) File.open(path, OUTPUT_FILE_FLAGS) do |file| @file_reader.regions.each do |region| range_bytes = region.offset - file...
github
hack-different/smcutil
https://github.com/hack-different/smcutil
lib/smcutil/file_reader.rb
Ruby
mit
46
master
2,200
module SmcUtil LINE_COMMAND = /((?<type>[[:upper:]]):(?<offset>([[:xdigit:]]{2})+:)?|(?<continue>\+\s+:))(?<length>\d+):(?<data>([[:xdigit:]]{2})+):(?<check>[[:xdigit:]]{2})/ class FileReader attr_reader :headers attr_reader :signature attr_reader :regions def initialize(data) # Setup the ...
github
hack-different/smcutil
https://github.com/hack-different/smcutil
lib/smcutil/file_validator.rb
Ruby
mit
46
master
1,551
require 'openssl' module SmcUtil class FileValidator attr_reader :file, :errors def initialize(file) @file = file end def validate! @errors = [] validate_regions! validate_headers! validate_signature! end def valid? validate! !@errors.any? en...
github
hack-different/smcutil
https://github.com/hack-different/smcutil
spec/spec_helper.rb
Ruby
mit
46
master
363
require "bundler/setup" require "smcutil" 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` and `main` config.disable_monkey_patching! config.expect_with :rsp...
github
hack-different/smcutil
https://github.com/hack-different/smcutil
spec/smcutil/file_reader_spec.rb
Ruby
mit
46
master
231
require_relative '../spec_helper' RSpec.describe SmcUtil::FileReader do it 'should load a valid file without raising an error' do SmcUtil::FileReader.parse(File.expand_path('../fixtures/flasher_base.smc', __dir__)) end end
github
hack-different/smcutil
https://github.com/hack-different/smcutil
spec/smcutil/file_extractor_spec.rb
Ruby
mit
46
master
553
require_relative '../spec_helper' RSpec.describe SmcUtil::FileExtractor do before(:all) do file = SmcUtil::FileReader.parse(File.expand_path('../fixtures/flasher_base.smc', __dir__)) @extractor = SmcUtil::FileExtractor.new file @output_dir = File.join(Dir.mktmpdir, 'output.bin') puts "Output Direct...
github
hack-different/smcutil
https://github.com/hack-different/smcutil
spec/smcutil/file_validator_spec.rb
Ruby
mit
46
master
856
require_relative '../spec_helper' RSpec.describe SmcUtil::FileValidator do it 'should read `flasher_base` and succeed in validation' do SmcUtil::FileReader.parse(File.expand_path('../fixtures/flasher_base.smc', __dir__)) end it 'should read `flasher_base`, fuzz the commands and fail' do expect { SmcUtil...
github
dfischer/sexy_scaffold
https://github.com/dfischer/sexy_scaffold
Rakefile
Ruby
mit
45
master
558
require 'rake' require 'rake/testtask' require 'rake/rdoctask' desc 'Default: run unit tests.' task :default => :test desc 'Test the rest_scaffold plugin.' Rake::TestTask.new(:test) do |t| t.libs << 'lib' t.pattern = 'test/**/*_test.rb' t.verbose = true end desc 'Generate documentation for the rest_scaffold pl...
github
dfischer/sexy_scaffold
https://github.com/dfischer/sexy_scaffold
generators/sexy_scaffold/sexy_scaffold_generator.rb
Ruby
mit
45
master
8,633
class SexyScaffoldGenerator < Rails::Generator::NamedBase default_options :skip_migration => false #include Rails::Generator::Commands::Base attr_reader :controller_name, :controller_class_path, :controller_file_path, :controller_class_nesting, ...
github
dfischer/sexy_scaffold
https://github.com/dfischer/sexy_scaffold
generators/sexy_scaffold/templates/edit_haml_spec.rb
Ruby
mit
45
master
1,016
require File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../../spec_helper' describe "/<%= name %>/edit.<%= default_file_extension %>" do include <%= controller_class_name %>Helper before do @<%= file_name %> = mock_model(<%= singular_name.capitalize %>) <% for attribute in attributes -%> @<...
github
dfischer/sexy_scaffold
https://github.com/dfischer/sexy_scaffold
generators/sexy_scaffold/templates/index_haml_spec.rb
Ruby
mit
45
master
949
require File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../../spec_helper' describe "/<%= name.pluralize %>/index.<%= default_file_extension %>" do include <%= controller_class_name %>Helper before do <% [98,99].each do |id| -%> <%= file_name %>_<%= id %> = mock_model(<%= singular_name.capitali...
github
dfischer/sexy_scaffold
https://github.com/dfischer/sexy_scaffold
generators/sexy_scaffold/templates/controller.rb
Ruby
mit
45
master
474
class <%= controller_class_name %>Controller < ApplicationController make_resourceful do actions :all <% if !controller_class_name.split("::")[1].nil? %> belongs_to :<%= singular_name %> <% end %> response_for :show do |format| format.html format.xml { render :xml => @<%= singular_name...
github
dfischer/sexy_scaffold
https://github.com/dfischer/sexy_scaffold
generators/sexy_scaffold/templates/show_haml_spec.rb
Ruby
mit
45
master
854
require File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../../spec_helper' describe "/<%= name.pluralize %>/show.<%= default_file_extension %>" do include <%= controller_class_name %>Helper before do @<%= file_name %> = mock_model(<%= singular_name.capitalize %>) <% for attribute in attributes ...
github
dfischer/sexy_scaffold
https://github.com/dfischer/sexy_scaffold
generators/sexy_scaffold/templates/new_haml_spec.rb
Ruby
mit
45
master
1,052
require File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../../spec_helper' describe "/<%= name.pluralize %>/new.<%= default_file_extension %>" do include <%= controller_class_name %>Helper before do @<%= file_name %> = mock_model(<%= singular_name.capitalize %>) @<%= file_name %>.stub!(:new...
github
dfischer/sexy_scaffold
https://github.com/dfischer/sexy_scaffold
generators/sexy_scaffold/templates/migration.rb
Ruby
mit
45
master
349
class <%= migration_name.classify.pluralize %> < ActiveRecord::Migration def self.up create_table :<%= singular_name.pluralize %> do |t| <% for attribute in attributes -%> t.<%= attribute.type %> :<%= attribute.name %> <% end %> t.timestamps end end def self.down drop_table :<%= singula...
github
dfischer/sexy_scaffold
https://github.com/dfischer/sexy_scaffold
generators/sexy_scaffold/templates/model_spec.rb
Ruby
mit
45
master
256
require File.dirname(__FILE__) + '/../spec_helper' describe <%= singular_name.capitalize %> do before(:each) do @<%= file_name %> = <%= singular_name.capitalize %>.new end it "should be valid" do @<%= file_name %>.should be_valid end end
github
dfischer/sexy_scaffold
https://github.com/dfischer/sexy_scaffold
generators/sexy_scaffold/templates/controller_spec.rb
Ruby
mit
45
master
9,939
require File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../spec_helper' describe <%= controller_class_name %>Controller, "#route_for" do it "should map { :controller => '<%= name.pluralize %>', :action => 'index' } to /<%= name.pluralize %>" do route_for(:controller => "<%= name.pluralize %>", :act...
github
dfischer/sexy_scaffold
https://github.com/dfischer/sexy_scaffold
generators/sexy_scaffold/templates/helper_spec.rb
Ruby
mit
45
master
205
require File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../spec_helper' describe <%= controller_class_name %>Helper do # Helper methods can be called directly in the examples (it blocks) end
github
iberianpig/fusuma-plugin-wmctrl
https://github.com/iberianpig/fusuma-plugin-wmctrl
fusuma-plugin-wmctrl.gemspec
Ruby
mit
45
main
1,068
# frozen_string_literal: true lib = File.expand_path("lib", __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "fusuma/plugin/wmctrl/version" Gem::Specification.new do |spec| spec.name = "fusuma-plugin-wmctrl" spec.version = Fusuma::Plugin::Wmctrl::VERSION spec.authors = ["iberianpig"] s...
github
iberianpig/fusuma-plugin-wmctrl
https://github.com/iberianpig/fusuma-plugin-wmctrl
Rakefile
Ruby
mit
45
main
1,325
# frozen_string_literal: true require "rspec/core/rake_task" RSpec::Core::RakeTask.new(:spec) task default: :spec desc "bump version and generate CHANGELOG with the version" task :bump, :type do |_, args| require "bump" label = args[:type] unless %w[major minor patch pre no].include?(label) raise "Usage: ...
github
iberianpig/fusuma-plugin-wmctrl
https://github.com/iberianpig/fusuma-plugin-wmctrl
Gemfile
Ruby
mit
45
main
400
# frozen_string_literal: true source "https://rubygems.org" # Specify your gem's dependencies in fusuma-plugin-wmctrl.gemspec gemspec gem "bump" gem "bundler" gem "coveralls" gem "debug" gem "github_changelog_generator", "~> 1.16" gem "lefthook" gem "rake", "~> 13.0" gem "rspec", "~> 3.0" gem "rspec-debug" gem "rubo...
github
iberianpig/fusuma-plugin-wmctrl
https://github.com/iberianpig/fusuma-plugin-wmctrl
lib/fusuma/plugin/wmctrl/window.rb
Ruby
mit
45
main
553
# frozen_string_literal: true module Fusuma module Plugin module Wmctrl # Manage Window class Window # @param method [String] "toggle" or "add" or "remove" def maximized(method:) "wmctrl -r :ACTIVE: -b #{method},maximized_vert,maximized_horz" end def close ...
github
iberianpig/fusuma-plugin-wmctrl
https://github.com/iberianpig/fusuma-plugin-wmctrl
lib/fusuma/plugin/wmctrl/workspace.rb
Ruby
mit
45
main
5,288
# frozen_string_literal: true module Fusuma module Plugin module Wmctrl # Manage workspace class Workspace class MissingMatrixOption < StandardError; end def initialize(wrap_navigation: nil, matrix_col_size: nil) @wrap_navigation = wrap_navigation @matrix_col_size...
github
iberianpig/fusuma-plugin-wmctrl
https://github.com/iberianpig/fusuma-plugin-wmctrl
lib/fusuma/plugin/executors/wmctrl_executor.rb
Ruby
mit
45
main
4,596
# frozen_string_literal: true require_relative "../wmctrl/window" require_relative "../wmctrl/workspace" module Fusuma module Plugin module Executors # Control Window or Workspaces by executing wctrl class WmctrlExecutor < Executor class InvalidOption < StandardError; end class NotIn...
github
iberianpig/fusuma-plugin-wmctrl
https://github.com/iberianpig/fusuma-plugin-wmctrl
spec/spec_helper.rb
Ruby
mit
45
main
448
# frozen_string_literal: true require "bundler/setup" require "helpers/config_helper" 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` and `main` config.disabl...
github
iberianpig/fusuma-plugin-wmctrl
https://github.com/iberianpig/fusuma-plugin-wmctrl
spec/helpers/config_helper.rb
Ruby
mit
45
main
295
# frozen_string_literal: true require "tempfile" require "fusuma/config" module Fusuma module ConfigHelper module_function def load_config_yml=(string) Config.custom_path = Tempfile.open do |temp_file| temp_file.tap { |f| f.write(string) } end end end end
github
iberianpig/fusuma-plugin-wmctrl
https://github.com/iberianpig/fusuma-plugin-wmctrl
spec/fusuma/plugin/wmctrl/workspace_spec.rb
Ruby
mit
45
main
8,867
# frozen_string_literal: true require "spec_helper" require "./lib/fusuma/plugin/wmctrl/workspace" module Fusuma module Plugin module Wmctrl RSpec.describe Workspace do def stub_workspace_values(current:, total:) allow(@workspace).to receive(:workspace_values).and_return([current, total]...
github
iberianpig/fusuma-plugin-wmctrl
https://github.com/iberianpig/fusuma-plugin-wmctrl
spec/fusuma/plugin/executors/wmctrl_executor_spec.rb
Ruby
mit
45
main
10,995
# frozen_string_literal: true require "spec_helper" require "fusuma/plugin/executors/executor" require "fusuma/plugin/events/event" require "fusuma/plugin/events/records/index_record" require "./lib/fusuma/plugin/executors/wmctrl_executor" module Fusuma module Plugin module Executors RSpec.describe Wmct...
github
geekq/jetty-rackup
https://github.com/geekq/jetty-rackup
jetty-rackup.gemspec
Ruby
mit
44
master
1,363
# -*- encoding: utf-8 -*- lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'jetty-rackup/version' Gem::Specification.new do |gem| gem.name = "jetty-rackup" gem.version = Jetty::Rackup::VERSION gem.authors = ["Vladimir Dobriakov", "Lea...
github
geekq/jetty-rackup
https://github.com/geekq/jetty-rackup
examples/using_java/app.rb
Ruby
mit
44
master
534
require 'sinatra' # If you want to have auto reload in development mode (what is sweet) # you can uncomment this following lines: # # configure :development do # Sinatra::Application.reset! # to reload routes and its contents # use Rack::Reloader # to reload required every files # end get '/some' do ...
github
geekq/jetty-rackup
https://github.com/geekq/jetty-rackup
examples/issue4_handle400/app.rb
Ruby
mit
44
master
369
# See also the pull request https://github.com/geekq/jetty-rackup/pull/4 # This example does not work with jruby-rack-1.1.2 but works with jruby-rack-1.1.12 # Returns Error 354 in Chrome (net::ERR_CONTENT_LENGTH_MISMATCH) require 'sinatra/base' class TestIssue4 < Sinatra::Base get '/' do halt 400, 'test' end ...
github
geekq/jetty-rackup
https://github.com/geekq/jetty-rackup
examples/bind_to_specific_ip/config.ru
Ruby
mit
44
master
200
#\ -p 8765 -o 127.0.0.1 --pid /tmp/jetty-example.pid require 'rubygems' require 'app' set :run, false # disable built-in sinatra web server set :environment, :development run Sinatra::Application
github
geekq/jetty-rackup
https://github.com/geekq/jetty-rackup
examples/just_ruby/app.rb
Ruby
mit
44
master
378
require 'sinatra' # If you want to have auto reload in development mode (what is sweet) # you can uncomment this following lines: # configure :development do Sinatra::Application.reset! # to reload routes and its contents use Rack::Reloader # to reload required every files end get '/?' do "hello" end...
github
geekq/jetty-rackup
https://github.com/geekq/jetty-rackup
lib/jetty-rackup/server.rb
Ruby
mit
44
master
2,047
class Rack::Handler::Jetty def self.run(rackup_content, options={}) Dir["#{File.dirname(__FILE__)}/../../jars/*.jar"].each { |jar| require jar } java_import 'java.net.InetAddress' java_import 'java.net.InetSocketAddress' java_import 'javax.servlet.http.HttpServlet' java_import 'org.eclipse.jetty....
github
geekq/jetty-rackup
https://github.com/geekq/jetty-rackup
lib/jetty-rackup/bootstrap.rb
Ruby
mit
44
master
2,782
# # Option parsing is based on the original rackup script. # automatic = false server_type = nil env = "development" options = {:Port => 9292, :Host => "0.0.0.0", :AccessLog => []} opts = OptionParser.new("", 24, ' ') { |opts| opts.banner = "Usage: jetty_rackup [ruby options] [rack options] [rackup config]" opt...
github
dkubb/descendants_tracker
https://github.com/dkubb/descendants_tracker
Guardfile
Ruby
mit
44
master
633
# encoding: utf-8 guard :bundler do watch('Gemfile') end guard :rspec do # run all specs if the spec_helper or supporting files files are modified watch('spec/spec_helper.rb') { 'spec' } watch(%r{\Aspec/(?:lib|support|shared)/.+\.rb\z}) { 'spec' } # run unit specs if associated lib cod...
github
dkubb/descendants_tracker
https://github.com/dkubb/descendants_tracker
descendants_tracker.gemspec
Ruby
mit
44
master
928
# encoding: utf-8 require File.expand_path('../lib/descendants_tracker/version', __FILE__) Gem::Specification.new do |gem| gem.name = 'descendants_tracker' gem.version = DescendantsTracker::VERSION.dup gem.authors = [ 'Dan Kubb', 'Piotr Solnica', 'Markus Schirp' ] gem.email = %w[ dan.kubb...
github
dkubb/descendants_tracker
https://github.com/dkubb/descendants_tracker
spec/spec_helper.rb
Ruby
mit
44
master
573
# encoding: utf-8 if ENV['COVERAGE'] == 'true' require 'simplecov' require 'coveralls' SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[ SimpleCov::Formatter::HTMLFormatter, Coveralls::SimpleCov::Formatter ] SimpleCov.start do command_name 'spec:unit' add_filter 'config' add_...
github
dkubb/descendants_tracker
https://github.com/dkubb/descendants_tracker
spec/unit/descendants_tracker/descendants_spec.rb
Ruby
mit
44
master
604
# encoding: utf-8 require 'spec_helper' describe DescendantsTracker, '#descendants' do subject { object.descendants } let(:described_class) { Class.new { extend DescendantsTracker } } let(:object) { described_class } context 'when there are no descendants' do it_should_b...
github
dkubb/descendants_tracker
https://github.com/dkubb/descendants_tracker
spec/unit/descendants_tracker/add_descendant_spec.rb
Ruby
mit
44
master
804
# encoding: utf-8 require 'spec_helper' describe DescendantsTracker, '#add_descendant' do subject { object.add_descendant(descendant) } let(:described_class) { Class.new { extend DescendantsTracker } } let(:object) { Class.new(described_class) } let(:descendant) { Class.new ...
github
dkubb/descendants_tracker
https://github.com/dkubb/descendants_tracker
spec/unit/descendants_tracker/inherited_spec.rb
Ruby
mit
44
master
716
# encoding: utf-8 require 'spec_helper' describe DescendantsTracker, '#inherited' do subject { Class.new(object) } let!(:object) { Class.new(superklass).extend(self.class.described_class) } let(:superklass) { Class.new } it 'delegates to the superclass #inhe...
github
dkubb/descendants_tracker
https://github.com/dkubb/descendants_tracker
lib/descendants_tracker.rb
Ruby
mit
44
master
1,274
# encoding: utf-8 require 'thread_safe' # Module that adds descendant tracking to a class module DescendantsTracker # Return the descendants of this class # # @example # descendants = ParentClass.descendants # # @return [Array<Class<DescendantsTracker>>] # # @api public attr_reader :descendants ...
github
pythonicrubyist/ruby_powerpoint
https://github.com/pythonicrubyist/ruby_powerpoint
ruby_powerpoint.gemspec
Ruby
mit
44
master
1,205
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'ruby_powerpoint/version' Gem::Specification.new do |spec| spec.name = "ruby_powerpoint" spec.version = RubyPowerpoint::VERSION spec.authors = ["pythonicrubyist"] spec...
github
pythonicrubyist/ruby_powerpoint
https://github.com/pythonicrubyist/ruby_powerpoint
lib/ruby_powerpoint/paragraph.rb
Ruby
mit
44
master
380
module RubyPowerpoint class RubyPowerpoint::Paragraph def initialize slide, paragraph_xml @slide = slide @presentation = slide.presentation @paragraph_xml = paragraph_xml end def content content_element @paragraph_xml end private def content_element(xml) xml.xp...
github
pythonicrubyist/ruby_powerpoint
https://github.com/pythonicrubyist/ruby_powerpoint
lib/ruby_powerpoint/presentation.rb
Ruby
mit
44
master
601
require 'zip/filesystem' require 'nokogiri' module RubyPowerpoint class RubyPowerpoint::Presentation attr_reader :files def initialize path raise 'Not a valid file format.' unless (['.pptx'].include? File.extname(path).downcase) @files = Zip::File.open path end def slides slides...
github
pythonicrubyist/ruby_powerpoint
https://github.com/pythonicrubyist/ruby_powerpoint
lib/ruby_powerpoint/slide.rb
Ruby
mit
44
master
2,881
require 'zip/filesystem' require 'nokogiri' module RubyPowerpoint class RubyPowerpoint::Slide attr_reader :presentation, :slide_number, :slide_number, :slide_file_name def initialize presentation, slide_xml_path @presentation = presentation @slide...
github
pythonicrubyist/ruby_powerpoint
https://github.com/pythonicrubyist/ruby_powerpoint
spec/test_spec.rb
Ruby
mit
44
master
3,328
require 'ruby_powerpoint' describe 'RubyPowerpoint trying to parsing an invalid file.' do it 'not open an XLS file successfully.' do expect { RubyPowerpoint::Presentation.new 'specs/fixtures/invalid.xls' }.to raise_error 'Not a valid file format.' end end describe 'RubyPowerpoint parsing a sample PPTX file' d...
github
probablycorey/mini_magick
https://github.com/probablycorey/mini_magick
Rakefile
Ruby
mit
44
master
383
require 'bundler' Bundler::GemHelper.install_tasks require 'rake/testtask' $:.unshift 'lib' desc 'Default: run unit tests.' task :default => [:print_version, :test] task :print_version do puts `mogrify --version` end desc 'Test the mini_magick plugin.' Rake::TestTask.new(:test) do |t| t.libs << 'test' t.tes...
github
probablycorey/mini_magick
https://github.com/probablycorey/mini_magick
mini_magick.gemspec
Ruby
mit
44
master
874
# -*- encoding: utf-8 -*- $:.push File.expand_path("../lib", __FILE__) version = File.read("VERSION").strip Gem::Specification.new do |s| s.name = "mini_magick" s.version = version s.platform = Gem::Platform::RUBY s.summary = "Manipulate images with minimal use of memory via ImageMagick / Gr...
github
probablycorey/mini_magick
https://github.com/probablycorey/mini_magick
lib/mini_magick.rb
Ruby
mit
44
master
20,255
require 'tempfile' require 'subexec' require 'stringio' require 'pathname' require 'shellwords' module MiniMagick class << self attr_accessor :processor attr_accessor :timeout # Experimental method for automatically selecting a processor # such as gm. Only works on *nix. # # TODO: Write tes...
github
probablycorey/mini_magick
https://github.com/probablycorey/mini_magick
test/image_test.rb
Ruby
mit
44
master
9,718
require 'test_helper' #MiniMagick.processor = :gm class ImageTest < Test::Unit::TestCase include MiniMagick include MiniMagickTestFiles def test_image_from_blob File.open(SIMPLE_IMAGE_PATH, "rb") do |f| image = Image.read(f.read) assert image.valid? image.destroy! end end def tes...
github
probablycorey/mini_magick
https://github.com/probablycorey/mini_magick
test/test_helper.rb
Ruby
mit
44
master
774
require 'rubygems' require 'test/unit' require 'pathname' require 'tempfile' require File.expand_path('../../lib/mini_magick', __FILE__) module MiniMagickTestFiles test_files = File.expand_path(File.dirname(__FILE__) + "/files") SIMPLE_IMAGE_PATH = test_files + "/simple.gif" MINUS_IMAGE_PATH = test_files + "/s...
github
probablycorey/mini_magick
https://github.com/probablycorey/mini_magick
test/command_builder_test.rb
Ruby
mit
44
master
1,054
require 'test_helper' class CommandBuilderTest < Test::Unit::TestCase include MiniMagick def test_basic c = CommandBuilder.new("test") c.resize "30x40" assert_equal '-resize 30x40', c.args.join(" ") end def test_complicated c = CommandBuilder.new("test") c.resize "30x40" c.alpha "1 3 ...
github
RiverGlide/CukeSalad
https://github.com/RiverGlide/CukeSalad
Rakefile
Ruby
mit
44
master
1,225
require 'rubygems' require 'bundler' begin Bundler.setup(:default, :development) rescue Bundler::BundlerError => e $stderr.puts e.message $stderr.puts "Run `bundle install` to install missing gems" exit e.status_code end require 'rake/dsl_definition' require 'rake' Bundler::GemHelper.install_tasks require 'rsp...
github
RiverGlide/CukeSalad
https://github.com/RiverGlide/CukeSalad
cukesalad.gemspec
Ruby
mit
44
master
1,542
# -*- encoding: utf-8 -*- $:.push File.expand_path("../lib", __FILE__) require "cukesalad/version" Gem::Specification.new do |s| s.name = "cukesalad" s.version = CukeSalad::VERSION s.platform = Gem::Platform::RUBY s.authors = ["RiverGlide"] s.email = ["talktous@riverglide.com"] s.ho...
github
RiverGlide/CukeSalad
https://github.com/RiverGlide/CukeSalad
features/lib/roles/step_free_cuker.rb
Ruby
mit
44
master
547
require 'aruba/api' #TODO: Consider wrapping Aruba module StepFreeCuker include Aruba::Api def role_preparation create_a_new_cuke_salad_project end def create_a_new_cuke_salad_project create_dir 'features' create_dir 'features/support' write_file 'features/support/env.rb', "$:.unshift(File.di...
github
RiverGlide/CukeSalad
https://github.com/RiverGlide/CukeSalad
features/lib/tasks/create_a_task.rb
Ruby
mit
44
master
440
['create a task', 'created a task'].each do | create_a_new_task | in_order_to create_a_new_task, called: :name_of_task, containing: :code do file_name = the( :name_of_task ).gsub(" ", "_") default_content = "in_order_to '#{the :name_of_task}' do #nothing end" content = the :cod...
github
RiverGlide/CukeSalad
https://github.com/RiverGlide/CukeSalad
features/lib/tasks/run_a_scenario.rb
Ruby
mit
44
master
216
in_order_to 'run a scenario', containing: :steps do write_file 'features/a.feature', "Feature: A Feature Scenario: A Scenario #{the :steps}" run_simple unescape( 'cucumber features/a.feature' ), false end