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 | davydovanton/rspec-hanami | https://github.com/davydovanton/rspec-hanami | lib/rspec/hanami/match_status.rb | Ruby | mit | 46 | master | 684 | module RSpec
module Hanami
class MatchStatus
def call(actual, expected)
case expected
when Numeric
actual == expected
when Symbol
chec_symbol_status(actual, expected)
else
false
end
end
private
TYPE_CODES = {
err... |
github | davydovanton/rspec-hanami | https://github.com/davydovanton/rspec-hanami | lib/rspec/hanami/match_type.rb | Ruby | mit | 46 | master | 593 | module RSpec
module Hanami
class MatchType
attr_reader :actual, :expected
def initialize(actual, expected)
@actual = actual
@expected = expected
end
def call
match_types?
end
private
def match_types?
return match_if_sum? if expected.cla... |
github | davydovanton/rspec-hanami | https://github.com/davydovanton/rspec-hanami | lib/rspec/hanami/form_parser.rb | Ruby | mit | 46 | master | 967 | require 'hanami/utils/hash'
module RSpec
module Hanami
class FormParser
def call(html)
meta_list = select_inputs(html).map! { |input| input_data_hash(input) }
meta_list.map! { |hash| ::Hanami::Utils::Hash.new(hash).symbolize! }
end
private
def select_inputs(html)
h... |
github | davydovanton/rspec-hanami | https://github.com/davydovanton/rspec-hanami | lib/rspec/hanami/matchers/match_in_body.rb | Ruby | mit | 46 | master | 730 | module RSpec
module Hanami
module Matchers
extend ::RSpec::Matchers::DSL
# @api public
# Passes if `response` has a not 4xx and 5xx error code.
#
# @example Accepts numeric and symbol statuses
# response = action.call(params)
# expect(response).to be_success
#
... |
github | davydovanton/rspec-hanami | https://github.com/davydovanton/rspec-hanami | lib/rspec/hanami/matchers/be_status.rb | Ruby | mit | 46 | master | 721 | module RSpec
module Hanami
module Matchers
extend ::RSpec::Matchers::DSL
# @api public
# Passes if `response` has a not 4xx and 5xx error code.
#
# @example Accepts numeric and symbol statuses
# response = action.call(params)
# expect(response).to be_success
#
... |
github | davydovanton/rspec-hanami | https://github.com/davydovanton/rspec-hanami | lib/rspec/hanami/matchers/match_entity_schema.rb | Ruby | mit | 46 | master | 2,539 | module RSpec
module Hanami
module Matchers
extend ::RSpec::Matchers::DSL
# @api public
# Passes if `parameter` has an passed attribute of expected type
# Hanami::Entity::Types are allowed
#
# expect(User).to have_attribute(:name, Type::String)
#
matcher :have_attri... |
github | davydovanton/rspec-hanami | https://github.com/davydovanton/rspec-hanami | lib/rspec/hanami/matchers/redirect_to.rb | Ruby | mit | 46 | master | 820 | module RSpec
module Hanami
module Matchers
extend ::RSpec::Matchers::DSL
# @api public
# Passes if `response` has a redirect to special url
#
# @example Accepts numeric and symbol statuses
# response = action.call(params)
# expect(response).to redirect_to('site.com')... |
github | davydovanton/rspec-hanami | https://github.com/davydovanton/rspec-hanami | lib/rspec/hanami/matchers/include_json.rb | Ruby | mit | 46 | master | 879 | require 'json'
module RSpec
module Hanami
module Matchers
extend ::RSpec::Matchers::DSL
# @api public
# Passes if `json` string in the body matches with hash arg
#
#
# @example Accepts numeric and symbol statuses
# response = action.call(params)
# expect(respo... |
github | davydovanton/rspec-hanami | https://github.com/davydovanton/rspec-hanami | lib/rspec/hanami/matchers/form_matchers.rb | Ruby | mit | 46 | master | 2,799 | module RSpec
module Hanami
module Matchers
extend ::RSpec::Matchers::DSL
# @api public
# Passes if form object has a action
#
# @example Accepts numeric and symbol statuses
#
# expect(view.form).to have_action('/users')
#
matcher :have_action do |action|
... |
github | davydovanton/rspec-hanami | https://github.com/davydovanton/rspec-hanami | lib/rspec/hanami/matchers/have_http_status.rb | Ruby | mit | 46 | master | 1,181 | module RSpec
module Hanami
module Matchers
extend ::RSpec::Matchers::DSL
# @api public
# Passes if `response` has a matching HTTP status code.
#
# The following symbolic status codes are allowed:
# - `:error`
# - `:missing`
# - `:redirect`
# - `:success`
... |
github | brentsowers1/googlestaticmap | https://github.com/brentsowers1/googlestaticmap | googlestaticmap.gemspec | Ruby | mit | 46 | master | 1,077 | Gem::Specification.new do |spec|
spec.name = 'googlestaticmap'
spec.version = '1.2.6'
spec.license = 'MIT'
spec.files = Dir['lib/**/*', 'test/**/*', 'README.md', 'History.txt']
spec.test_files = Dir.glob('test/tc_*.rb')
spec.summary = 'Class for retrieving maps from the Google Map... |
github | brentsowers1/googlestaticmap | https://github.com/brentsowers1/googlestaticmap | example.rb | Ruby | mit | 46 | master | 3,050 | require File.dirname(__FILE__) + '/lib/googlestaticmap'
print "This script requires an API key to test. If you do not have one, visit\n"
print "https://developers.google.com/maps/documentation/javascript/get-api-key\n"
print "and click Get Started\n\n"
print "Please enter your API key: "
api_key = gets.chomp
print "-... |
github | brentsowers1/googlestaticmap | https://github.com/brentsowers1/googlestaticmap | Rakefile | Ruby | mit | 46 | master | 250 | # It appears as if the state of unit testing gems through gem is in question,
# so I'm just writing a simple rake task here to run the test files one by
# one.
task :test do
Dir.glob('test/tc_*.rb').each do |tf|
system("ruby ./#{tf}")
end
end |
github | brentsowers1/googlestaticmap | https://github.com/brentsowers1/googlestaticmap | lib/googlestaticmap_helper.rb | Ruby | mit | 46 | master | 1,742 | require 'base64'
require 'openssl'
# Helper methods used in this code
module GoogleStaticMapHelpers #:nodoc: all
# Returns a hash of instance variables for the passed in Object, where the
# key is the instance variable name ("@instance_variable"), and the value is
# the current instance variable value. This is ... |
github | brentsowers1/googlestaticmap | https://github.com/brentsowers1/googlestaticmap | lib/googlestaticmap.rb | Ruby | mit | 46 | master | 13,162 | # Main file for the googlestaticmap gem. See README.md for a full desciption with examples, licensing, contact
# info, etc.
require 'cgi'
require 'net/http'
require 'net/https' if RUBY_VERSION < "1.9"
require File.dirname(__FILE__) + '/googlestaticmap_helper'
MAP_SEPARATOR = CGI.escape("|")
# Main class for creati... |
github | brentsowers1/googlestaticmap | https://github.com/brentsowers1/googlestaticmap | test/tc_map_marker.rb | Ruby | mit | 46 | master | 1,538 | require 'test/unit'
require 'cgi'
require File.dirname(__FILE__) + '/../lib/googlestaticmap'
class MapMarkerTest < Test::Unit::TestCase #:nodoc: all
def test_exception_no_location
m = MapMarker.new
assert_raise Exception do
m.to_s
end
end
def test_exception_invalid_location
m = MapMarker.... |
github | brentsowers1/googlestaticmap | https://github.com/brentsowers1/googlestaticmap | test/tc_map_path_and_polygon.rb | Ruby | mit | 46 | master | 1,724 | require 'test/unit'
require 'cgi'
require File.dirname(__FILE__) + '/../lib/googlestaticmap'
class MapPathAndPolygonTest < Test::Unit::TestCase #:nodoc: all
def test_exception_no_points
m = MapPath.new
assert_raise Exception do
m.to_s
end
end
def test_exception_empty_points
m = MapPath.ne... |
github | brentsowers1/googlestaticmap | https://github.com/brentsowers1/googlestaticmap | test/tc_helper.rb | Ruby | mit | 46 | master | 2,087 | require 'test/unit'
require 'cgi'
require File.dirname(__FILE__) + '/../lib/googlestaticmap_helper'
class GoogleStaticMapHelperTest < Test::Unit::TestCase #:nodoc: all
IVS = {"@var1" => 1, "@var2" => 2, "@var3" => 3,
"@url" => "http://maps.google.com", "@nilvar" => nil}
class MockRuby18Object
def s... |
github | brentsowers1/googlestaticmap | https://github.com/brentsowers1/googlestaticmap | test/tc_map_location.rb | Ruby | mit | 46 | master | 986 | require 'test/unit'
require 'cgi'
require File.dirname(__FILE__) + '/../lib/googlestaticmap'
class MapLocationTest < Test::Unit::TestCase #:nodoc: all
def test_exception_no_location
m = MapLocation.new
assert_raise Exception do
m.to_s
end
end
def test_attributes_filled_in
m = MapLocation.... |
github | brentsowers1/googlestaticmap | https://github.com/brentsowers1/googlestaticmap | test/tc_google_static_map.rb | Ruby | mit | 46 | master | 9,747 | require 'rubygems'
require 'test/unit'
require 'cgi'
require 'net/http'
require 'mocha/setup'
require File.dirname(__FILE__) + '/../lib/googlestaticmap'
class MockSuccess < Net::HTTPSuccess #:nodoc: all
def initialize(data)
@data = data
end
def body
@data
end
end
class MockFailure < Net::HTTPService... |
github | oesgalha/disposable_mail | https://github.com/oesgalha/disposable_mail | Rakefile | Ruby | mit | 46 | master | 813 | require 'bundler/gem_tasks'
task :test do
$LOAD_PATH.unshift('lib', 'test')
require './test/disposable_mail_tests.rb'
end
task default: :test
namespace :disposable_mail do
desc "outputs the current disposable domains"
task :puts_domains do
blacklist_path = 'data/disposable-email-domains/disposable_email_... |
github | oesgalha/disposable_mail | https://github.com/oesgalha/disposable_mail | disposable_mail.gemspec | Ruby | mit | 46 | master | 1,244 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'disposable_mail/version'
Gem::Specification.new do |spec|
spec.name = 'disposable_mail'
spec.version = DisposableMail::VERSION
spec.authors = ['Oscar Esgalha']
spec.e... |
github | oesgalha/disposable_mail | https://github.com/oesgalha/disposable_mail | lib/disposable_mail/disposable.rb | Ruby | mit | 46 | master | 71,847 | module DisposableMail
class << self
# Returns a list with the disposable mail domains
def list
[
"0-00.usa.cc",
"0-mail.com",
"001.igg.biz",
"027168.com",
"0815.ru",
"0815.ry",
"0815.su",
"0845.ru",
"0box.eu",
"0clickemail.c... |
github | oesgalha/disposable_mail | https://github.com/oesgalha/disposable_mail | lib/disposable_mail/rails/railtie.rb | Ruby | mit | 46 | master | 348 | module DisposableMail
class Railtie < ::Rails::Railtie
initializer 'disposable_mail-i18n' do |app|
locales = app.config.i18n.available_locales || []
yml_pattern = locales.blank? ? '*' : "{#{locales.join(',')}}"
I18n.load_path.concat(Dir[File.join(File.dirname(__FILE__), 'locales', "#{yml_pattern... |
github | oesgalha/disposable_mail | https://github.com/oesgalha/disposable_mail | lib/disposable_mail/rails/validator.rb | Ruby | mit | 46 | master | 218 | class UndisposableValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
if DisposableMail.include?(value)
record.errors.add(attribute, :undisposable, options)
end
end
end |
github | oesgalha/disposable_mail | https://github.com/oesgalha/disposable_mail | test/disposable_mail_tests.rb | Ruby | mit | 46 | master | 663 | require 'minitest/autorun'
require 'minitest/benchmark'
require 'minitest/pride'
require 'disposable_mail'
class TestDisposableMail < MiniTest::Test
def test_list
assert_kind_of Array, DisposableMail.list
refute_empty DisposableMail.list
DisposableMail.list.each do |domain|
assert_kind_of String, ... |
github | ankane/gindex | https://github.com/ankane/gindex | gindex.gemspec | Ruby | mit | 46 | master | 547 | require_relative "lib/gindex/version"
Gem::Specification.new do |spec|
spec.name = "gindex"
spec.version = Gindex::VERSION
spec.summary = "Instant concurrent indexes for Rails"
spec.homepage = "https://github.com/ankane/gindex"
spec.license = "MIT"
spec.author = "And... |
github | ankane/gindex | https://github.com/ankane/gindex | lib/generators/index/index_generator.rb | Ruby | mit | 46 | master | 762 | require "rails/generators/active_record"
class IndexGenerator < Rails::Generators::Base
include ActiveRecord::Generators::Migration
source_root File.join(__dir__, "templates")
argument :table, type: :string
argument :columns, type: :array
def copy_migration
migrate_path = ActiveRecord::Tasks::DatabaseT... |
github | ankane/gindex | https://github.com/ankane/gindex | test/test_helper.rb | Ruby | mit | 46 | master | 229 | require "bundler/setup"
require "combustion"
Bundler.require(:default)
require "minitest/autorun"
Combustion.path = "test/internal"
Combustion.initialize! :active_record do
config.load_defaults Rails::VERSION::STRING.to_f
end |
github | ankane/gindex | https://github.com/ankane/gindex | test/index_generator_test.rb | Ruby | mit | 46 | master | 1,101 | require_relative "test_helper"
require "rails/generators/test_case"
require "generators/index/index_generator"
class IndexGeneratorTest < Rails::Generators::TestCase
tests IndexGenerator
destination File.expand_path("../tmp", __dir__)
setup :prepare_destination
def test_one
with_migrations_path do
... |
github | kavu/sprockets-webp | https://github.com/kavu/sprockets-webp | sprockets-webp.gemspec | Ruby | mit | 46 | master | 963 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'sprockets/webp/version'
Gem::Specification.new do |spec|
spec.name = 'sprockets-webp'
spec.version = Sprockets::WebP::VERSION
spec.authors = ['Max Riveiro']
spec.emai... |
github | kavu/sprockets-webp | https://github.com/kavu/sprockets-webp | lib/sprockets-webp.rb | Ruby | mit | 46 | master | 597 | # encoding: utf-8
require 'sprockets/webp/version'
require 'sprockets/webp/converter'
require 'sprockets/webp/railtie' if defined?(Rails)
module Sprockets
module WebP
# configure web encode options
#
# Sprockets::WebP.encode_options = { quality: 100, lossless: 1, method: 6, alpha_filtering: 2, alpha_com... |
github | kavu/sprockets-webp | https://github.com/kavu/sprockets-webp | lib/sprockets/webp/railtie.rb | Ruby | mit | 46 | master | 615 | # encoding: utf-8
module Sprockets
module WebP
class Railtie < ::Rails::Railtie
initializer :webp, group: :all do |app|
app.config.assets.configure do |env|
env.register_mime_type 'image/jpeg', '.jpeg'
env.register_postprocessor 'image/jpeg', :jpeg_webp do |context, data|
... |
github | kavu/sprockets-webp | https://github.com/kavu/sprockets-webp | lib/sprockets/webp/converter.rb | Ruby | mit | 46 | master | 2,167 | # encoding: utf-8
require 'tempfile'
require 'logger'
require 'fileutils'
require 'webp-ffi'
module Sprockets
module WebP
class Converter
class << self
attr_reader :context
def process(app, context, data)
@context = context
# Application Config alias
config ... |
github | sous-chefs/hashicorp-vault | https://github.com/sous-chefs/hashicorp-vault | metadata.rb | Ruby | apache-2.0 | 46 | main | 574 | name 'hashicorp-vault'
maintainer 'Sous Chefs'
maintainer_email 'help@sous-chefs.org'
license 'Apache-2.0'
description 'Application cookbook for installing and configuring Vault.'
issues_url 'https://github.com/sous-chefs/vault/issues'
source_url 'https://github.com/so... |
github | sous-chefs/hashicorp-vault | https://github.com/sous-chefs/hashicorp-vault | test/cookbooks/test/recipes/server_hcl_ark.rb | Ruby | apache-2.0 | 46 | main | 1,242 | hashicorp_vault_install 'package' do
install_method :ark
version '1.6.1'
action :install
end
directory '/opt/vault/tls' do
owner 'vault'
group 'vault'
mode '0750'
recursive true
action :create
end
openssl_x509_certificate '/opt/vault/tls/tls.crt' do
common_name 'Vault Testing'
expire 7
subject_... |
github | sous-chefs/hashicorp-vault | https://github.com/sous-chefs/hashicorp-vault | test/cookbooks/test/recipes/server_json.rb | Ruby | apache-2.0 | 46 | main | 296 | hashicorp_vault_install 'package' do
action :upgrade
end
hashicorp_vault_config 'vault' do
sensitive false
action :create
end
hashicorp_vault_service 'vault' do
config_type :json
action %i(create enable start)
subscribes :restart, 'template[/etc/vault.d/vault.json]', :delayed
end |
github | sous-chefs/hashicorp-vault | https://github.com/sous-chefs/hashicorp-vault | test/cookbooks/test/recipes/agent_hcl.rb | Ruby | apache-2.0 | 46 | main | 1,827 | hashicorp_vault_install 'package' do
action :upgrade
end
hashicorp_vault_config_global 'vault' do
vault_mode :agent
global(
'log_level' => 'info'
)
cache(
'use_auto_auth_token' => true
)
vault(
'address' => 'https://127.0.0.1:8200'
)
sensitive false
notifies :restart, 'hashicorp_vault_... |
github | sous-chefs/hashicorp-vault | https://github.com/sous-chefs/hashicorp-vault | test/cookbooks/test/recipes/server_hcl.rb | Ruby | apache-2.0 | 46 | main | 2,409 | hashicorp_vault_install 'package' do
action :upgrade
end
hashicorp_vault_config_global 'vault' do
sensitive false
telemetry(
statsite_address: '127.0.0.1:8125',
disable_hostname: true
)
notifies :restart, 'hashicorp_vault_service[vault]', :delayed
action :create
end
hashicorp_vault_config_listener... |
github | sous-chefs/hashicorp-vault | https://github.com/sous-chefs/hashicorp-vault | test/cookbooks/test/recipes/agent_json.rb | Ruby | apache-2.0 | 46 | main | 1,579 | hashicorp_vault_install 'package' do
action :upgrade
end
hashicorp_vault_config 'vault' do
config_file '/etc/vault.d/vault-agent.json'
config(
'log_level' => 'info',
'vault' => {
'address' => 'https://127.0.0.1:8200',
},
'auto_auth' => {
'method' => [
{
'type' => 'ap... |
github | sous-chefs/hashicorp-vault | https://github.com/sous-chefs/hashicorp-vault | test/integration/server_json/default_spec.rb | Ruby | apache-2.0 | 46 | main | 698 | describe package('vault') do
it { should be_installed }
end
describe group('vault') do
it { should exist }
end
describe user('vault') do
it { should exist }
end
describe file('/etc/vault.d/vault.json') do
it { should be_file }
its('owner') { should eq 'vault' }
its('group') { should eq 'vault' }
its('m... |
github | sous-chefs/hashicorp-vault | https://github.com/sous-chefs/hashicorp-vault | test/integration/agent_hcl/default_spec.rb | Ruby | apache-2.0 | 46 | main | 875 | describe package('vault') do
it { should be_installed }
end
describe group('vault') do
it { should exist }
end
describe user('vault') do
it { should exist }
end
describe file('/etc/vault.d/vault.hcl') do
it { should be_file }
its('owner') { should eq 'vault' }
its('group') { should eq 'vault' }
its('mo... |
github | sous-chefs/hashicorp-vault | https://github.com/sous-chefs/hashicorp-vault | test/integration/server_hcl/default_spec.rb | Ruby | apache-2.0 | 46 | main | 2,302 | describe package('vault') do
it { should be_installed }
end
describe group('vault') do
it { should exist }
end
describe user('vault') do
it { should exist }
end
describe file('/etc/vault.d/vault.hcl') do
it { should_not exist }
end
describe file('/etc/vault.d/config_global_vault.hcl') do
it { should be_fi... |
github | sous-chefs/hashicorp-vault | https://github.com/sous-chefs/hashicorp-vault | test/integration/server_hcl_ark/default_spec.rb | Ruby | apache-2.0 | 46 | main | 1,785 | describe file('/opt/vault/vault-1.6.1/vault') do
it { should be_file }
it { should be_executable }
end
describe file('/usr/local/bin/vault') do
it { should be_symlink }
it { should be_file }
it { should_not be_directory }
it { should be_executable }
end
describe group('vault') do
it { should exist }
end... |
github | sous-chefs/hashicorp-vault | https://github.com/sous-chefs/hashicorp-vault | test/integration/agent_json/default_spec.rb | Ruby | apache-2.0 | 46 | main | 744 | describe package('vault') do
it { should be_installed }
end
describe group('vault') do
it { should exist }
end
describe user('vault') do
it { should exist }
end
describe file('/etc/vault.d/vault-agent.json') do
it { should be_file }
its('owner') { should eq 'vault' }
its('group') { should eq 'vault' }
... |
github | sous-chefs/hashicorp-vault | https://github.com/sous-chefs/hashicorp-vault | resources/config_listener.rb | Ruby | apache-2.0 | 46 | main | 2,287 | #
# Cookbook:: hashicorp-vault
# Resource:: config_listener
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... |
github | sous-chefs/hashicorp-vault | https://github.com/sous-chefs/hashicorp-vault | resources/config.rb | Ruby | apache-2.0 | 46 | main | 3,419 | #
# Cookbook:: hashicorp-vault
# Resource:: config
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... |
github | sous-chefs/hashicorp-vault | https://github.com/sous-chefs/hashicorp-vault | resources/config_entropy.rb | Ruby | apache-2.0 | 46 | main | 1,411 | #
# Cookbook:: hashicorp-vault
# Resource:: config_entropy
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... |
github | sous-chefs/hashicorp-vault | https://github.com/sous-chefs/hashicorp-vault | resources/config_auto_auth.rb | Ruby | apache-2.0 | 46 | main | 3,271 | #
# Cookbook:: hashicorp-vault
# Resource:: config_auto_auth
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
github | sous-chefs/hashicorp-vault | https://github.com/sous-chefs/hashicorp-vault | resources/config_global.rb | Ruby | apache-2.0 | 46 | main | 2,980 | #
# Cookbook:: hashicorp-vault
# Resource:: config_global
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... |
github | sous-chefs/hashicorp-vault | https://github.com/sous-chefs/hashicorp-vault | resources/config_template.rb | Ruby | apache-2.0 | 46 | main | 2,398 | #
# Cookbook:: hashicorp-vault
# Resource:: config_template
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... |
github | sous-chefs/hashicorp-vault | https://github.com/sous-chefs/hashicorp-vault | resources/config_storage.rb | Ruby | apache-2.0 | 46 | main | 1,398 | #
# Cookbook:: hashicorp-vault
# Resource:: config_storage
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... |
github | sous-chefs/hashicorp-vault | https://github.com/sous-chefs/hashicorp-vault | resources/install.rb | Ruby | apache-2.0 | 46 | main | 5,530 | #
# Cookbook:: hashicorp-vault
# Resource:: install
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
github | sous-chefs/hashicorp-vault | https://github.com/sous-chefs/hashicorp-vault | resources/config_seal.rb | Ruby | apache-2.0 | 46 | main | 1,395 | #
# Cookbook:: hashicorp-vault
# Resource:: config_seal
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... |
github | sous-chefs/hashicorp-vault | https://github.com/sous-chefs/hashicorp-vault | resources/service.rb | Ruby | apache-2.0 | 46 | main | 2,978 | #
# Cookbook:: hashicorp-vault
# Resource:: service
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
github | sous-chefs/hashicorp-vault | https://github.com/sous-chefs/hashicorp-vault | resources/config_service_registration.rb | Ruby | apache-2.0 | 46 | main | 1,404 | #
# Cookbook:: hashicorp-vault
# Resource:: service_registration
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... |
github | sous-chefs/hashicorp-vault | https://github.com/sous-chefs/hashicorp-vault | resources/partial/_config_hcl_item.rb | Ruby | apache-2.0 | 46 | main | 965 | #
# Cookbook:: hashicorp-vault
# Resource:: _config_hcl_item
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
github | sous-chefs/hashicorp-vault | https://github.com/sous-chefs/hashicorp-vault | resources/partial/_config_hcl_base.rb | Ruby | apache-2.0 | 46 | main | 2,482 | #
# Cookbook:: hashicorp-vault
# Resource:: _config_hcl_base
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
github | sous-chefs/hashicorp-vault | https://github.com/sous-chefs/hashicorp-vault | resources/partial/_config_hcl_item_type.rb | Ruby | apache-2.0 | 46 | main | 830 | #
# Cookbook:: hashicorp-vault
# Resource:: _config_hcl_item_type
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
github | sous-chefs/hashicorp-vault | https://github.com/sous-chefs/hashicorp-vault | spec/unit/resources/config_template_spec.rb | Ruby | apache-2.0 | 46 | main | 1,236 | require 'spec_helper'
describe 'hashicorp_vault_config_template' do
step_into :hashicorp_vault_config_template
platform 'centos'
context 'create service registration HCL configuration' do
recipe do
hashicorp_vault_config_template '/etc/vault/server.key' do
options(
'source' => '/etc/... |
github | sous-chefs/hashicorp-vault | https://github.com/sous-chefs/hashicorp-vault | spec/unit/resources/config_listener_spec.rb | Ruby | apache-2.0 | 46 | main | 2,174 | require 'spec_helper'
describe 'hashicorp_vault_config_listener' do
step_into :hashicorp_vault_config_listener
platform 'centos'
context 'create server listener HCL configuration' do
recipe do
hashicorp_vault_config_listener 'tcp' do
type 'tcp'
options(
'address' => '127.0.0.... |
github | sous-chefs/hashicorp-vault | https://github.com/sous-chefs/hashicorp-vault | spec/unit/resources/config_service_registration_spec.rb | Ruby | apache-2.0 | 46 | main | 829 | require 'spec_helper'
describe 'hashicorp_vault_config_service_registration' do
step_into :hashicorp_vault_config_service_registration
platform 'centos'
context 'create service registration HCL configuration' do
recipe do
hashicorp_vault_config_service_registration 'kubernetes' do
type 'kubern... |
github | sous-chefs/hashicorp-vault | https://github.com/sous-chefs/hashicorp-vault | spec/unit/resources/install_spec.rb | Ruby | apache-2.0 | 46 | main | 463 | require 'spec_helper'
describe 'hashicorp_vault_install' do
step_into :hashicorp_vault_install
platform 'centos'
context 'install vault' do
recipe do
hashicorp_vault_install 'package'
end
describe 'creates repo and installs vault' do
it { is_expected.to create_yum_repository('hashicorp'... |
github | sous-chefs/hashicorp-vault | https://github.com/sous-chefs/hashicorp-vault | spec/unit/resources/config_storage_spec.rb | Ruby | apache-2.0 | 46 | main | 1,025 | require 'spec_helper'
describe 'hashicorp_vault_config_storage' do
step_into :hashicorp_vault_config_storage
platform 'centos'
context 'create file storage HCL configuration' do
recipe do
hashicorp_vault_config_storage 'file test' do
type 'file'
options(
'path' => '/opt/vault... |
github | sous-chefs/hashicorp-vault | https://github.com/sous-chefs/hashicorp-vault | spec/unit/resources/config_auto_auth_spec.rb | Ruby | apache-2.0 | 46 | main | 2,592 | require 'spec_helper'
describe 'hashicorp_vault_config_auto_auth' do
step_into :hashicorp_vault_config_auto_auth
platform 'centos'
context 'create a method auto auth HCL configuration' do
recipe do
hashicorp_vault_config_auto_auth 'aws' do
entry_type :method
type 'aws'
options(... |
github | sous-chefs/hashicorp-vault | https://github.com/sous-chefs/hashicorp-vault | spec/unit/resources/config_entropy_spec.rb | Ruby | apache-2.0 | 46 | main | 613 | require 'spec_helper'
describe 'hashicorp_vault_config_entropy' do
step_into :hashicorp_vault_config_entropy
platform 'centos'
context 'create entropy HCL configuration' do
recipe do
hashicorp_vault_config_entropy 'seal' do
type 'seal'
options(
'mode' => 'augmentation'
... |
github | sous-chefs/hashicorp-vault | https://github.com/sous-chefs/hashicorp-vault | spec/unit/resources/service_spec.rb | Ruby | apache-2.0 | 46 | main | 593 | require 'spec_helper'
describe 'hashicorp_vault_service' do
step_into :hashicorp_vault_service
platform 'centos'
context 'create a vault service and verify service is created properly' do
recipe do
hashicorp_vault_service 'vault' do
action %i(create enable start)
end
end
describ... |
github | sous-chefs/hashicorp-vault | https://github.com/sous-chefs/hashicorp-vault | spec/unit/resources/config_seal_spec.rb | Ruby | apache-2.0 | 46 | main | 979 | require 'spec_helper'
describe 'hashicorp_vault_config_seal' do
step_into :hashicorp_vault_config_seal
platform 'centos'
context 'create seal HCL configuration' do
recipe do
hashicorp_vault_config_seal 'awskms' do
options(
'region' => 'us-east-1',
'access_key' => 'AKIAIOSFO... |
github | sous-chefs/hashicorp-vault | https://github.com/sous-chefs/hashicorp-vault | libraries/helpers.rb | Ruby | apache-2.0 | 46 | main | 4,563 | module Vault
module Cookbook
module Helpers
def default_vault_user
'vault'
end
def default_vault_group
'vault'
end
def default_vault_packages
%w(vault)
end
def default_vault_config_dir
'/etc/vault.d'
end
def default_vault_co... |
github | sous-chefs/hashicorp-vault | https://github.com/sous-chefs/hashicorp-vault | libraries/common.rb | Ruby | apache-2.0 | 46 | main | 497 | module Vault
module Cookbook
module CommonHelpers
def nil_or_empty?(v)
v.nil? || (v.respond_to?(:empty?) && v.empty?)
end
def array_wrap(obj)
return obj if obj.is_a?(Array)
[obj]
end
private
# Hash compact implementation for empties as well as nils
... |
github | sous-chefs/hashicorp-vault | https://github.com/sous-chefs/hashicorp-vault | libraries/template.rb | Ruby | apache-2.0 | 46 | main | 2,300 | module Vault
module Cookbook
module TemplateHelpers
include Vault::Cookbook::CommonHelpers
VAULT_HCL_CONFIG_CONTAINED = %i(auto_auth).freeze
VAULT_HCL_CONFIGURATION_ITEMS = %i(@global @auto_auth @cache @entropy @listener @seal @sentinel @service_registration @storage @telemetry @template @vault... |
github | sous-chefs/hashicorp-vault | https://github.com/sous-chefs/hashicorp-vault | libraries/resource.rb | Ruby | apache-2.0 | 46 | main | 4,054 | require 'hcl/checker'
module Vault
module Cookbook
module ResourceHelpers
include Vault::Cookbook::CommonHelpers
VAULT_GLOBAL_PROPERTIES = %i(global cache sentinel telemetry vault).freeze
def vault_hcl_file_prefix
"config_#{vault_hcl_config_type}"
end
def vault_hcl_config... |
github | sous-chefs/hashicorp-vault | https://github.com/sous-chefs/hashicorp-vault | libraries/install.rb | Ruby | apache-2.0 | 46 | main | 1,594 | module Vault
module Cookbook
module InstallHelpers
def vault_source(version)
platform = case node['platform_family']
when 'debian', 'rhel', 'suse', 'fedora', 'amazon'
'linux'
when 'windows'
'windows'
w... |
github | mhuggins/ruby-measurement | https://github.com/mhuggins/ruby-measurement | ruby-measurement.gemspec | Ruby | mit | 46 | master | 930 | # -*- encoding: utf-8 -*-
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'ruby-measurement/version'
Gem::Specification.new do |gem|
gem.name = 'ruby-measurement'
gem.version = Measurement::VERSION
gem.author = 'Matt Huggins'
gem.... |
github | mhuggins/ruby-measurement | https://github.com/mhuggins/ruby-measurement | lib/ruby-measurement/measurement.rb | Ruby | mit | 46 | master | 4,626 | # encoding: UTF-8
require 'ruby-measurement/unit'
require 'ruby-measurement/version'
class Measurement
include Comparable
UNIT_REGEX = /([^\d\s\/].*)/.freeze
SCIENTIFIC_NUMBER = /([+-]?\d*\.?\d+(?:[Ee][+-]?)?\d*)/.freeze
SCIENTIFIC_REGEX = /\A#{SCIENTIFIC_NUMBER}\s*#{UNIT_REGEX}?\z/.freeze
RATIONAL... |
github | mhuggins/ruby-measurement | https://github.com/mhuggins/ruby-measurement | lib/ruby-measurement/unit.rb | Ruby | mit | 46 | master | 1,760 | require 'set'
class Measurement
class Unit
attr_reader :name, :aliases, :conversions
@definitions = {}
def initialize(name)
@name = name.to_s
@aliases = Set.new
@conversions = {}
add_alias(name)
end
def add_alias(*args)
args.each do |unit_alias|
@aliases <... |
github | mhuggins/ruby-measurement | https://github.com/mhuggins/ruby-measurement | lib/ruby-measurement/definitions/metric.rb | Ruby | mit | 46 | master | 265 | require 'ruby-measurement/definitions/metric/area'
require 'ruby-measurement/definitions/metric/capacity'
require 'ruby-measurement/definitions/metric/length'
require 'ruby-measurement/definitions/metric/volume'
require 'ruby-measurement/definitions/metric/weight' |
github | mhuggins/ruby-measurement | https://github.com/mhuggins/ruby-measurement | lib/ruby-measurement/definitions/us_customary.rb | Ruby | mit | 46 | master | 295 | require 'ruby-measurement/definitions/us_customary/area'
require 'ruby-measurement/definitions/us_customary/capacity'
require 'ruby-measurement/definitions/us_customary/length'
require 'ruby-measurement/definitions/us_customary/volume'
require 'ruby-measurement/definitions/us_customary/weight' |
github | mhuggins/ruby-measurement | https://github.com/mhuggins/ruby-measurement | lib/ruby-measurement/definitions/metric/volume.rb | Ruby | mit | 46 | master | 3,463 | # encoding: UTF-8
Measurement.define(:kl) do |unit|
unit.alias :kiloliter, :kiloliters
unit.convert_to(:hl) { |value| value * 10.0 }
unit.convert_to(:dal) { |value| value * 100.0 }
unit.convert_to(:l) { |value| value * 1000.0 }
unit.convert_to(:dl) { |value| value * 10000.0 }
unit.convert_to(:cl) { |value|... |
github | mhuggins/ruby-measurement | https://github.com/mhuggins/ruby-measurement | lib/ruby-measurement/definitions/metric/weight.rb | Ruby | mit | 46 | master | 4,435 | # encoding: UTF-8
Measurement.define(:t) do |unit|
unit.alias :'metric tonne', :'metric tonnes', :tonne, :tonnes
unit.convert_to(:kg) { |value| value * 1_000.0 }
unit.convert_to(:hg) { |value| value * 10_000.0 }
unit.convert_to(:dag) { |value| value * 100_000.0 }
unit.convert_to(:g) { |value| value * 1_000_0... |
github | mhuggins/ruby-measurement | https://github.com/mhuggins/ruby-measurement | lib/ruby-measurement/definitions/metric/capacity.rb | Ruby | mit | 46 | master | 696 | # encoding: UTF-8
Measurement.define(:'m³') do |unit|
unit.alias :m3, :'m^3', :'m*m*m', :'cubic meter', :'cubic meters'
unit.convert_to(:dm3) { |value| value * 1_000.0 }
unit.convert_to(:cm3) { |value| value * 1_000_000.0 }
end
Measurement.define(:'dm³') do |unit|
unit.alias :dm3, :'dm^3', :'dm*dm*dm', :'cubi... |
github | mhuggins/ruby-measurement | https://github.com/mhuggins/ruby-measurement | lib/ruby-measurement/definitions/metric/length.rb | Ruby | mit | 46 | master | 3,470 | # encoding: UTF-8
Measurement.define(:km) do |unit|
unit.alias :kilometer, :kilometers
unit.convert_to(:hm) { |value| value * 10.0 }
unit.convert_to(:dam) { |value| value * 100.0 }
unit.convert_to(:m) { |value| value * 1_000.0 }
unit.convert_to(:dm) { |value| value * 10_000.0 }
unit.convert_to(:cm) { |valu... |
github | mhuggins/ruby-measurement | https://github.com/mhuggins/ruby-measurement | lib/ruby-measurement/definitions/metric/area.rb | Ruby | mit | 46 | master | 1,602 | # encoding: UTF-8
Measurement.define(:'km²') do |unit|
unit.alias :km2, :'km^2', :'km*km', :'sq km', :'square kilometer', :'square kilometers'
unit.convert_to(:ha) { |value| value * 100.0 }
unit.convert_to(:a) { |value| value * 10_000.0 }
unit.convert_to(:m2) { |value| value * 1_000_000.0 }
unit.convert_to(:... |
github | mhuggins/ruby-measurement | https://github.com/mhuggins/ruby-measurement | lib/ruby-measurement/definitions/us_customary/weight.rb | Ruby | mit | 46 | master | 1,999 | # encoding: UTF-8
Measurement.define(:ton) do |unit|
unit.alias :'short ton', :'short tons', :tons
unit.convert_to(:cwt) { |value| value * 20.0 }
unit.convert_to(:lb) { |value| value * 2_000.0 }
unit.convert_to(:oz) { |value| value * 32_000.0 }
unit.convert_to(:dr) { |value| value * 512_000.0 }
unit.conver... |
github | mhuggins/ruby-measurement | https://github.com/mhuggins/ruby-measurement | lib/ruby-measurement/definitions/us_customary/volume.rb | Ruby | mit | 46 | master | 2,659 | # encoding: UTF-8
Measurement.define(:'gal.') do |unit|
unit.alias :gal, :gallon, :gallons
unit.convert_to(:qt) { |value| value * 4.0 }
unit.convert_to(:pt) { |value| value * 8.0 }
unit.convert_to(:c) { |value| value * 16.0 }
unit.convert_to(:'fl oz') { |value| value * 128.0 }
unit.convert_to(:tbsp) { |val... |
github | mhuggins/ruby-measurement | https://github.com/mhuggins/ruby-measurement | lib/ruby-measurement/definitions/us_customary/length.rb | Ruby | mit | 46 | master | 3,428 | # encoding: UTF-8
Measurement.define(:'mi.') do |unit|
unit.alias :mi, :mile, :miles
unit.convert_to(:fur) { |value| value * 8.0 }
unit.convert_to(:ch) { |value| value * 80.0 }
unit.convert_to(:ftm) { |value| value * 880.0 }
unit.convert_to(:yd) { |value| value * 1_760.0 }
unit.convert_to(:ft) { |value| va... |
github | mhuggins/ruby-measurement | https://github.com/mhuggins/ruby-measurement | lib/ruby-measurement/definitions/us_customary/area.rb | Ruby | mit | 46 | master | 2,308 | # encoding: UTF-8
Measurement.define(:'mi²') do |unit|
unit.alias :mi2, :'mi*mi', :'sq mi', :'square mile', :'square miles'
unit.convert_to(:fur2) { |value| value * 64.0 }
unit.convert_to(:ch2) { |value| value * 6_400.0 }
unit.convert_to(:yd2) { |value| value * 3_097_600.0 }
unit.convert_to(:ft2) { |value| v... |
github | mhuggins/ruby-measurement | https://github.com/mhuggins/ruby-measurement | lib/ruby-measurement/definitions/us_customary/capacity.rb | Ruby | mit | 46 | master | 1,126 | # encoding: UTF-8
Measurement.define(:'acre ft') do |unit|
unit.alias :'acre-foot', :'acre-feet'
unit.convert_to(:yd3) { |value| value * Rational(4840, 3).to_f }
unit.convert_to(:ft3) { |value| value * 43_560.0 }
unit.convert_to(:in3) { |value| value * 75_271_680.0 }
end
Measurement.define(:'yd³') do |unit|
... |
github | mhuggins/ruby-measurement | https://github.com/mhuggins/ruby-measurement | lib/ruby-measurement/core_ext/string.rb | Ruby | mit | 46 | master | 211 | require 'ruby-measurement/measurement'
class String
def to_measurement
Measurement.parse(self)
end
def to_unit
Measurement::Unit[self] or raise ArgumentError, "Invalid unit: '#{self}'"
end
end |
github | mhuggins/ruby-measurement | https://github.com/mhuggins/ruby-measurement | spec/ruby-measurement/measurement_spec.rb | Ruby | mit | 46 | master | 12,500 | # encoding: UTF-8
require 'spec_helper'
RSpec.describe Measurement do
subject { described_class }
describe '.new' do
describe 'with valid quantity' do
it 'sets the quantity' do
expect(subject.new(3).quantity).to eq 3
end
it 'sets the default unit' do
expect(subject.new(3).u... |
github | mhuggins/ruby-measurement | https://github.com/mhuggins/ruby-measurement | spec/ruby-measurement/unit_builder_spec.rb | Ruby | mit | 46 | master | 2,770 | require 'spec_helper'
RSpec.describe Measurement::Unit::Builder do
subject { described_class.new(name, &block) }
let(:name) { :hour }
let(:block) { proc {} }
describe '.new' do
describe 'with a block' do
let(:block) do
proc { |unit| unit.alias :hr, :hrs }
end
it 'should evaluat... |
github | mhuggins/ruby-measurement | https://github.com/mhuggins/ruby-measurement | spec/ruby-measurement/unit_spec.rb | Ruby | mit | 46 | master | 4,313 | require 'spec_helper'
RSpec.describe Measurement::Unit do
subject { described_class.new(name) }
let(:name) { :hour }
describe '#name' do
it 'returns the name' do
expect(subject.name).to eq 'hour'
end
end
describe '#add_alias' do
it 'adds new aliases' do
subject.add_alias :hr, :hrs
... |
github | mhuggins/ruby-measurement | https://github.com/mhuggins/ruby-measurement | spec/ruby-measurement/core_ext/string_spec.rb | Ruby | mit | 46 | master | 1,127 | require 'spec_helper'
RSpec.describe String do
describe '#to_measurement' do
describe 'with valid quantity' do
subject { '3' }
specify { expect(subject.to_measurement).to eq Measurement.new(3) }
end
describe 'with valid quantity and unit' do
subject { '3 dozen' }
specify { expect... |
github | mhuggins/ruby-measurement | https://github.com/mhuggins/ruby-measurement | spec/ruby-measurement/core_ext/symbol_spec.rb | Ruby | mit | 46 | master | 396 | require 'spec_helper'
RSpec.describe Symbol do
describe '#to_unit' do
describe 'with valid unit' do
subject { :dozen }
specify { expect(subject.to_unit).to eq Measurement::Unit[:dozen] }
end
describe 'with invalid unit' do
subject { :person }
specify { expect { subject.to_unit }.... |
github | mhuggins/ruby-measurement | https://github.com/mhuggins/ruby-measurement | spec/ruby-measurement/definitions/us_customary/length_spec.rb | Ruby | mit | 46 | master | 6,190 | # encoding: UTF-8
require 'spec_helper'
RSpec.describe Measurement do
describe 'miles' do
subject { described_class.parse('1 mi') }
it 'converts to furlongs' do
expect(subject.convert_to(:fur).quantity).to eq 8
end
it 'converts to chains' do
expect(subject.convert_to(:ch).quantity).to ... |
github | mhuggins/ruby-measurement | https://github.com/mhuggins/ruby-measurement | spec/ruby-measurement/definitions/us_customary/capacity_spec.rb | Ruby | mit | 46 | master | 1,755 | # encoding: UTF-8
require 'spec_helper'
RSpec.describe Measurement do
describe 'acre-feet' do
subject { described_class.parse('1 acre ft') }
it 'converts to cubic yards' do
expect(subject.convert_to(:yd3).quantity).to eq Rational(4840, 3).to_f
end
it 'converts to cubic feet' do
expect(... |
github | mhuggins/ruby-measurement | https://github.com/mhuggins/ruby-measurement | spec/ruby-measurement/definitions/us_customary/weight_spec.rb | Ruby | mit | 46 | master | 3,574 | # encoding: UTF-8
require 'spec_helper'
RSpec.describe Measurement do
describe 'tons' do
subject { described_class.parse('1 ton') }
it 'converts to hundredweights' do
expect(subject.convert_to(:cwt).quantity).to eq 20
end
it 'converts to pounds' do
expect(subject.convert_to(:lbs).quant... |
github | mhuggins/ruby-measurement | https://github.com/mhuggins/ruby-measurement | spec/ruby-measurement/definitions/us_customary/volume_spec.rb | Ruby | mit | 46 | master | 4,784 | # encoding: UTF-8
require 'spec_helper'
RSpec.describe Measurement do
describe 'gallons' do
subject { described_class.parse('1 gal') }
it 'converts to quarts' do
expect(subject.convert_to(:qt).quantity).to eq 4
end
it 'converts to pints' do
expect(subject.convert_to(:pt).quantity).to e... |
github | mhuggins/ruby-measurement | https://github.com/mhuggins/ruby-measurement | spec/ruby-measurement/definitions/us_customary/area_spec.rb | Ruby | mit | 46 | master | 3,865 | # encoding: UTF-8
require 'spec_helper'
RSpec.describe Measurement do
describe 'square miles' do
subject { described_class.parse('1 mi²') }
it 'converts to square furlongs' do
expect(subject.convert_to(:fur2).quantity).to eq 64
end
it 'converts to square chains' do
expect(subject.conve... |
github | mhuggins/ruby-measurement | https://github.com/mhuggins/ruby-measurement | spec/ruby-measurement/definitions/metric/weight_spec.rb | Ruby | mit | 46 | master | 8,065 | # encoding: UTF-8
require 'spec_helper'
RSpec.describe Measurement do
describe 'tonnes' do
subject { described_class.parse('0.001 tonne') }
it 'converts to hectograms' do
expect(subject.convert_to(:hg).quantity).to eq 10
end
it 'converts to dekagrams' do
expect(subject.convert_to(:dag)... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.