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
qonto/api_schema
https://github.com/qonto/api_schema
lib/api_schema/serializer_definition.rb
Ruby
mit
19
master
1,487
module ApiSchema class SerializerDefinition include ::Swagger::Blocks::ClassMethods PriorReference = ::Struct.new(:id, :type, :desc) attr_reader :id, :fields, :references, :parent, :api_version attr_accessor :type, :name, :description, :prior_references def initialize(id, type, api_version, nam...
github
qonto/api_schema
https://github.com/qonto/api_schema
lib/api_schema/configuration.rb
Ruby
mit
19
master
1,347
module ApiSchema class Configuration include ::Swagger::Blocks::ClassMethods attr_accessor :title, :description, :version, :host, :base_path, :terms_of_service, :contact_name, :consumes, :produces, :authorization, :error_model, :error_desc attr_reader :descriptions_path def initialize ...
github
qonto/api_schema
https://github.com/qonto/api_schema
lib/api_schema/api_version.rb
Ruby
mit
19
master
3,875
module ApiSchema class ApiVersion attr_accessor :configuration, :resources, :serializers, :imported_versions, :errors def initialize(configuration) @configuration = configuration @resources = [] @serializers = [] @imported_versions = [] @errors = {} end def check_consi...
github
qonto/api_schema
https://github.com/qonto/api_schema
lib/api_schema/serializer_methods.rb
Ruby
mit
19
master
585
module ApiSchema module SerializerMethods private def serializer(id, structure: :object, name: nil, parent: nil) serializer = SerializerDefinition.new(id, structure, api_version, name, parent) yield serializer if block_given? api_version.serializers << serializer end def array_ser...
github
qonto/api_schema
https://github.com/qonto/api_schema
lib/api_schema/response.rb
Ruby
mit
19
master
318
module ApiSchema class Response attr_reader :code, :model, :fields def initialize(code, model) @code = code @model = model @fields = [] end def method_missing(type, *args, &block) options = args[1] || {} @fields << Field.new(type, args[0], options) end end end
github
qonto/api_schema
https://github.com/qonto/api_schema
lib/api_schema/resource_methods.rb
Ruby
mit
19
master
1,693
module ApiSchema module ResourceMethods private def base_path(base_path) @base_path = base_path end def get(base_path = default_path, extra_path: nil, &block) resource = ResourceDefinition.new(:get, api_version, base_path, extra_path) resource.instance_eval(&block) api_versi...
github
qonto/api_schema
https://github.com/qonto/api_schema
lib/api_schema/patches/schema_node.rb
Ruby
mit
19
master
2,194
module Swagger module Blocks module Nodes class SchemaNode < Node def requires(fields) key :required, fields end def schema_for(serializer) key :title, serializer.id.to_s.humanize serializer.type == :array ? array_schema(serializer) : single_schema(seri...
github
qonto/api_schema
https://github.com/qonto/api_schema
lib/api_schema/patches/property_node.rb
Ruby
mit
19
master
845
module Swagger module Blocks module Nodes class PropertyNode < Node def requires(fields) key :required, fields end def property_schema_for(serializer) property serializer.name do key :type, serializer.type key :description, serializer.desc...
github
qonto/api_schema
https://github.com/qonto/api_schema
lib/api_schema/patches/operation_node.rb
Ruby
mit
19
master
1,660
module Swagger module Blocks module Nodes class OperationNode < Node def success_response(code, model_name = nil, fields = []) response code do schema do key :'$ref', model_name if model_name fields.each do |f| property f.name do ...
github
fredkelly/sense-client
https://github.com/fredkelly/sense-client
sense-client.gemspec
Ruby
mit
19
master
1,394
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'sense/client/version' Gem::Specification.new do |spec| spec.name = "sense-client" spec.version = Sense::Client::VERSION spec.authors = ["Freddy Kelly"] spec.email ...
github
fredkelly/sense-client
https://github.com/fredkelly/sense-client
lib/sense/client.rb
Ruby
mit
19
master
738
require "sense/client/version" require "oauth2" module Sense class Client CLIENT_ID = '8d3c1664-05ae-47e4-bcdb-477489590aa4' CLIENT_SECRET = '4f771f6f-5c10-4104-bbc6-3333f5b11bf9' SITE_URL = 'https://api.hello.is/' TOKEN_URL = '/v1/oauth2/token' def initialize @client = ::OAuth2::Client.n...
github
pluginaweek/encrypted_attributes
https://github.com/pluginaweek/encrypted_attributes
encrypted_attributes.gemspec
Ruby
mit
19
master
997
$LOAD_PATH.unshift File.expand_path('../lib', __FILE__) require 'encrypted_attributes/version' Gem::Specification.new do |s| s.name = "encrypted_attributes" s.version = EncryptedAttributes::VERSION s.authors = ["Aaron Pfeifer"] s.email = "aaron@pluginaweek.org" s....
github
pluginaweek/encrypted_attributes
https://github.com/pluginaweek/encrypted_attributes
Rakefile
Ruby
mit
19
master
926
require 'rubygems' require 'rake' require 'rake/testtask' require 'rake/rdoctask' desc 'Default: run all tests.' task :default => :test desc "Test encrypted_attributes." Rake::TestTask.new(:test) do |t| t.libs << 'lib' t.test_files = Dir['test/**/*_test.rb'] t.verbose = true end begin require 'rcov/rcovtask'...
github
pluginaweek/encrypted_attributes
https://github.com/pluginaweek/encrypted_attributes
lib/encrypted_attributes.rb
Ruby
mit
19
master
9,003
require 'encrypted_strings' require 'encrypted_attributes/sha_cipher' module EncryptedAttributes module MacroMethods # Encrypts the given attribute. # # Configuration options: # * <tt>:mode</tt> - The mode of encryption to use. Default is <tt>:sha</tt>. # See EncryptedStrings for other possib...
github
pluginaweek/encrypted_attributes
https://github.com/pluginaweek/encrypted_attributes
lib/encrypted_attributes/sha_cipher.rb
Ruby
mit
19
master
1,642
module EncryptedAttributes # Adds support for embedding salts in the encrypted value class ShaCipher < EncryptedStrings::ShaCipher class << self # Whether to embed the salt by default attr_accessor :default_embed_salt end # Set defaults @default_embed_salt = false # Tracks ...
github
pluginaweek/encrypted_attributes
https://github.com/pluginaweek/encrypted_attributes
test/factory.rb
Ruby
mit
19
master
1,298
module Factory # Build actions for the model def self.build(model, &block) name = model.to_s.underscore define_method("#{name}_attributes", block) define_method("valid_#{name}_attributes") {|*args| valid_attributes_for(model, *args)} define_method("new_#{name}") {|*args| new_record...
github
pluginaweek/encrypted_attributes
https://github.com/pluginaweek/encrypted_attributes
test/unit/encrypted_attributes_test.rb
Ruby
mit
19
master
15,762
require File.dirname(__FILE__) + '/../test_helper' class EncryptedAttributesTest < ActiveSupport::TestCase def setup User.encrypts :password end def test_should_use_sha_by_default user = create_user(:login => 'admin', :password => 'secret') assert_equal '8152bc582f58c854f580cb101d3182813dec4afe', ...
github
pluginaweek/encrypted_attributes
https://github.com/pluginaweek/encrypted_attributes
test/unit/sha_cipher_test.rb
Ruby
mit
19
master
3,834
require File.dirname(__FILE__) + '/../test_helper' class ShaCipherWithoutEmbeddingTest < Test::Unit::TestCase def setup @cipher = EncryptedAttributes::ShaCipher.new('dc0fc7c07bba982a8d8f18fe138dbea912df5e0e', :salt => 'custom_salt') end def test_should_use_configured_salt assert_equal 'custom_salt', @...
github
pluginaweek/encrypted_attributes
https://github.com/pluginaweek/encrypted_attributes
test/app_root/config/environment.rb
Ruby
mit
19
master
320
require 'config/boot' Rails::Initializer.run do |config| config.plugin_paths << '..' config.plugins = %w(encrypted_strings encrypted_attributes) config.cache_classes = false config.whiny_nils = true config.action_controller.session = {:key => 'rails_session', :secret => 'd229e4d22437432705ab3985d4d246'} end
github
pluginaweek/encrypted_attributes
https://github.com/pluginaweek/encrypted_attributes
test/app_root/db/migrate/001_create_users.rb
Ruby
mit
19
master
233
class CreateUsers < ActiveRecord::Migration def self.up create_table :users do |t| t.string :login, :password, :crypted_password, :salt, :password_reminder end end def self.down drop_table :users end end
github
janlelis/unicopy
https://github.com/janlelis/unicopy
Rakefile
Ruby
mit
20
main
995
# # # # Get gemspec info gemspec_file = Dir['*.gemspec'].first gemspec = eval File.read(gemspec_file), binding, gemspec_file info = "#{gemspec.name} | #{gemspec.version} | " \ "#{gemspec.runtime_dependencies.size} dependencies | " \ "#{gemspec.files.size} files" # # # # Gem build and install task desc ...
github
janlelis/unicopy
https://github.com/janlelis/unicopy
unicopy.gemspec
Ruby
mit
20
main
1,172
# -*- encoding: utf-8 -*- require File.dirname(__FILE__) + "/lib/unicopy/version" Gem::Specification.new do |gem| gem.name = "unicopy" gem.version = Unicopy::VERSION gem.summary = "Converts Unicode codepoints to a string (or vice versa) and copies it to the system clipboard" gem.descripti...
github
janlelis/unicopy
https://github.com/janlelis/unicopy
lib/unicopy.rb
Ruby
mit
20
main
4,236
# enable-frozen-string: true require_relative "unicopy/version" require "clipboard" module Unicopy DUMP_FORMATS = { 'hex' => { description: "____ (hexadecimal)", replace: "%X", alias: "x", }, 'uplus' => { description: "U+____ (hexadecimal)", replace: "U+%04X", alias:...
github
janlelis/unicopy
https://github.com/janlelis/unicopy
spec/unicopy_spec.rb
Ruby
mit
20
main
3,617
require_relative "../lib/unicopy/kernel_method" require "minitest/autorun" describe Unicopy do it "converts codepoints to string and, with --print, outputs it to STDOUT" do assert_output(/Ruby 🌫/){ unicopy("52 75 62 79 20 1F32B", print: true) } end it "also works with U+ prefixes" do assert_output(/Rub...
github
pdabrowski6/wordprss
https://github.com/pdabrowski6/wordprss
wordprss.gemspec
Ruby
mit
19
master
725
lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'wordprss/version' Gem::Specification.new do |s| s.add_runtime_dependency 'rest-client', '2.0.2' s.add_runtime_dependency 'nokogiri', '1.8.2' s.add_development_dependency "rspec" s.name = 'wordprss...
github
pdabrowski6/wordprss
https://github.com/pdabrowski6/wordprss
lib/wordprss/url.rb
Ruby
mit
19
master
245
require 'uri' module WordpRSS class Url # Parses given URL to get the version with the /feed # # @return [String] def self.parse(url) return url if url.nil? || url.match(/\/feed$/) "#{url}/feed" end end end
github
pdabrowski6/wordprss
https://github.com/pdabrowski6/wordprss
lib/wordprss/feed.rb
Ruby
mit
19
master
683
require 'nokogiri' module WordpRSS class Feed def initialize(body) @body = body end # Returns the RSS feed title # # @return [String] def title xml.xpath("//channel").at("title").text end # Returns the RSS feed description # # @return [String] def descriptio...
github
pdabrowski6/wordprss
https://github.com/pdabrowski6/wordprss
lib/wordprss/policy.rb
Ruby
mit
19
master
327
module WordpRSS class Policy # Returns the result of the RSS feed validation. The RSS generator must be wordpress # # @return [Boolean] def valid_rss_feed?(response) xml = Nokogiri::XML(response.body) !!(!xml.at("rss").nil? && xml.at("generator").text.to_s.match(/wordpress/i)) end e...
github
pdabrowski6/wordprss
https://github.com/pdabrowski6/wordprss
lib/wordprss/request.rb
Ruby
mit
19
master
434
require 'uri' require 'rest-client' module WordpRSS class Request def initialize(url) @url = url end # Performs the request to the given URL in order to get the RSS feed contents # # @return [RestClient::Response] def call fail(WordpRSS::InvalidURLError.new("#{url} is not a valid...
github
pdabrowski6/wordprss
https://github.com/pdabrowski6/wordprss
lib/wordprss/item.rb
Ruby
mit
19
master
954
module WordpRSS class Item def initialize(node) @node = node end # Returns the item title # # @return [String] def title node.at("title").text end # Returns the item link # # @return [String] def link node.at("link").text end # Returns the item ...
github
pdabrowski6/wordprss
https://github.com/pdabrowski6/wordprss
lib/wordprss/channel.rb
Ruby
mit
19
master
656
module WordpRSS class Channel # Pull Wordpress RSS feed for given URL # # @return [WordpRSS::Feed] def self.subscribe(url) wordpress_url = WordpRSS::Url.parse(url) response = WordpRSS::Request.new(wordpress_url).call WordpRSS::Feed.new(response.body) end # Checks if the giv...
github
pdabrowski6/wordprss
https://github.com/pdabrowski6/wordprss
spec/lib/wordprss/item_spec.rb
Ruby
mit
19
master
1,445
require 'rspec' require 'wordprss' describe WordpRSS::Item do before(:all) { @item = WordpRSS::Item.new(nokogiri_node) } describe "#title" do it 'returns item title' do expect(@item.title).to eq('Item title') end end describe '#link' do it 'returns item link' do expect(@item.link).to ...
github
pdabrowski6/wordprss
https://github.com/pdabrowski6/wordprss
spec/lib/wordprss/feed_spec.rb
Ruby
mit
19
master
1,157
require 'rspec' require 'wordprss' describe WordpRSS::Feed do describe "#title" do it 'returns feed title' do feed = WordpRSS::Feed.new(xml_feed) expect(feed.title).to eq('Feed title') end end describe '#description' do it 'returns feed description' do feed = WordpRSS::Feed.new(x...
github
pdabrowski6/wordprss
https://github.com/pdabrowski6/wordprss
spec/lib/wordprss/policy_spec.rb
Ruby
mit
19
master
899
require 'rspec' require 'wordprss' describe WordpRSS::Policy do describe "#valid_rss_feed?" do it 'returns false if response is not a RSS feed' do response = double(body: "") policy = WordpRSS::Policy.new expect(policy.valid_rss_feed?(response)).to eq(false) end it 'returns false if ...
github
pdabrowski6/wordprss
https://github.com/pdabrowski6/wordprss
spec/lib/wordprss/url_spec.rb
Ruby
mit
19
master
526
require 'rspec' require 'wordprss' describe WordpRSS::Url do describe '.parse' do it 'returns nil if given URL is nil' do expect(WordpRSS::Url.parse(nil)).to eq(nil) end it 'does not duplicate feed part if given URL contains feed part' do expect(WordpRSS::Url.parse("http://blog.com/feed")).t...
github
pdabrowski6/wordprss
https://github.com/pdabrowski6/wordprss
spec/lib/wordprss/channel_spec.rb
Ruby
mit
19
master
2,549
require 'rspec' require 'wordprss' describe WordpRSS::Channel do describe '.wordpress_rss_feed?' do it 'returns true if given feed is a wordpress feed' do url = 'http://blog.com/feed' allow(WordpRSS::Url).to receive(:parse).with(url).and_return(url) response = double('response') request =...
github
pdabrowski6/wordprss
https://github.com/pdabrowski6/wordprss
spec/lib/wordprss/request_spec.rb
Ruby
mit
19
master
697
require 'rspec' require 'wordprss' describe WordpRSS::Request do describe '#call' do it 'raises WordpRSS::InvalidURLError error when given URL is invalid' do request = WordpRSS::Request.new('invalid url') expect { request.call }.to raise_error(WordpRSS::InvalidURLError, 'invalid url is not a valid U...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
Gemfile
Ruby
mit
19
master
2,278
# frozen_string_literal: true source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } ruby '2.7.1' gem 'pg', '>= 0.18', '< 2.0' gem 'puma', '~> 4.3.5' gem 'rails', '~> 6.0.3.2' gem 'sassc', '2.3.0' gem 'sassc-rails', '~> 2.1' # Use Uglifier as compressor for JavaScript assets ge...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/rails_helper.rb
Ruby
mit
19
master
3,203
# frozen_string_literal: true # This file is copied to spec/ when you run 'rails generate rspec:install' require 'spec_helper' # require 'rails_helper' ENV['RAILS_ENV'] ||= 'test' require File.expand_path('../config/environment', __dir__) # Prevent database truncation if the environment is production abort('The Rails ...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/spec_helper.rb
Ruby
mit
19
master
5,020
# frozen_string_literal: true require 'simplecov' SimpleCov.start do SimpleCov.add_filter '/spec' SimpleCov.add_filter '/config' end require 'sidekiq/testing' Sidekiq::Testing.fake! # This file was generated by the `rails generate rspec:install` command. Conventionally, all # specs live under a `spec` directory,...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/requests/application_spec.rb
Ruby
mit
19
master
563
# frozen_string_literal: true require 'rails_helper' RSpec.describe 'Application', type: :request do describe 'wrong tenant redirect' do it 'redirects to sign in' do sign_in users(:member) get users_url(subdomain: 'admin') expect(response).to redirect_to(new_user_session_url) end end ...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/requests/categories_spec.rb
Ruby
mit
19
master
2,843
# frozen_string_literal: true require 'rails_helper' RSpec.describe 'Categories', type: :request do let!(:category) { categories(:category_parent) } describe 'GET /categories' do it 'has http status 200' do sign_in users(:admin_org) get categories_url(subdomain: 'admin') expect(response).t...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/requests/locations_spec.rb
Ruby
mit
19
master
3,683
# frozen_string_literal: true require 'rails_helper' RSpec.describe 'Locations', type: :request do let!(:location) { locations(:lancaster) } let(:organization) { organizations(:midatlantic) } describe 'GET /locations' do it_behaves_like 'admin authorized-only resource', :get do let(:endpoint) { locat...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/requests/users_spec.rb
Ruby
mit
19
master
2,518
# frozen_string_literal: true require 'rails_helper' RSpec.describe 'Users', type: :request do let(:admin) { users(:admin) } let(:member) { users(:member) } let(:volunteer) { users(:volunteer) } describe '#edit' do it_behaves_like 'admin and volunteer authorized-only resource', :get do let(:endpoi...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/requests/email_templates_spec.rb
Ruby
mit
19
master
4,549
# frozen_string_literal: true require 'rails_helper' RSpec.describe 'EmailTemplates', type: :request do let(:email_template) { email_templates(:checkout) } let(:valid_attr) do { type: 'CheckoutEmailTemplate', name: 'Checkout acknowledgement', subject: 'Midatlantic Carrier Loan', body: ...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/requests/membership_types_spec.rb
Ruby
mit
19
master
4,810
# frozen_string_literal: true require 'rails_helper' RSpec.describe 'MembershipTypes', type: :request do let!(:membership_type) { membership_types(:annual) } let(:organization) { organizations(:midatlantic) } describe 'GET /membership_types' do it_behaves_like 'admin authorized-only resource', :get do ...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/requests/organizations_spec.rb
Ruby
mit
19
master
3,406
# frozen_string_literal: true require 'rails_helper' RSpec.describe 'Organizations', type: :request do let!(:organization) { organizations(:midatlantic) } describe '#create' do let(:valid_attr) { { name: 'Test', subdomain: 'test', email: 'test@example.com' } } let(:invalid_attr) { { name: '' } } con...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/requests/fee_types_spec.rb
Ruby
mit
19
master
3,542
# frozen_string_literal: true require 'rails_helper' RSpec.describe 'FeeTypes', type: :request do let!(:fee_type) { fee_types(:upgrade) } let(:organization) { organizations(:midatlantic) } describe 'GET /fee_types' do it_behaves_like 'admin authorized-only resource', :get do let(:endpoint) { fee_type...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/requests/loan_listing_spec.rb
Ruby
mit
19
master
748
# frozen_string_literal: true require 'rails_helper' RSpec.describe 'LoanListing', type: :request do describe '#index' do let(:admin) { users(:admin) } describe 'permissions' do it_behaves_like 'admin and volunteer authorized-only resource', :get do let(:endpoint) { loan_listing_url } e...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/requests/agreements_spec.rb
Ruby
mit
19
master
3,248
# frozen_string_literal: true require 'rails_helper' RSpec.describe 'Agreements', type: :request do let!(:agreement) { agreements(:agreement) } let(:organization) { organizations(:midatlantic) } describe 'GET /agreements' do it 'has http status 200' do sign_in users(:member) send :get, agreemen...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/requests/agreements/versions_spec.rb
Ruby
mit
19
master
5,187
# frozen_string_literal: true require 'rails_helper' RSpec.describe 'Agreements::Versions', type: :request do let(:admin) { users(:admin) } let(:admin2) { users(:admin2) } let(:agreement) { agreements(:agreement) } let(:version) { agreement_versions(:agreement_version) } let(:valid_params) do { title: '...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/requests/carriers/loans_spec.rb
Ruby
mit
19
master
3,915
# frozen_string_literal: true require 'rails_helper' RSpec.describe 'Loans', type: :request do let(:volunteer) { users(:volunteer) } let(:member) { users(:member) } let(:carrier) { carriers(:carrier) } let(:valid_params) { { borrower_id: users(:member).id, due_date: Date.current + 5.days } } let(:loan) { lo...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/requests/users/memberships_spec.rb
Ruby
mit
19
master
4,142
# frozen_string_literal: true require 'rails_helper' RSpec.describe 'Users::Memberships', type: :request do let(:volunteer) { users(:volunteer) } let(:nonmember) { users(:nonmember) } let(:member) { users(:member) } let(:membership) { memberships(:member) } let(:membership_type) { membership_types(:annual) ...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/requests/users/signatures_spec.rb
Ruby
mit
19
master
1,626
# frozen_string_literal: true require 'rails_helper' RSpec.describe 'Users::Signatures', type: :request do let(:volunteer) { users(:volunteer) } let(:nonmember) { users(:nonmember) } let(:member) { users(:member) } let(:version) { agreement_versions(:agreement_version) } let(:valid_params) do { agreemen...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/policies/agreement_policy_spec.rb
Ruby
mit
19
master
411
# frozen_string_literal: true RSpec.describe AgreementPolicy do subject { described_class } let(:admin) { users(:admin) } let(:volunteer) { users(:volunteer) } let(:borrower) { users(:borrower) } %i[create? edit? update? destroy?].each do |activity| permissions activity do it { is_expected.not_to...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/policies/location_policy_spec.rb
Ruby
mit
19
master
434
# frozen_string_literal: true require 'rails_helper' RSpec.describe LocationPolicy do subject { described_class } let(:admin) { users(:admin) } let(:volunteer) { users(:volunteer) } let(:borrower) { users(:borrower) } %i[create? edit? update? destroy?].each do |activity| permissions activity do ...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/policies/fee_type_policy_spec.rb
Ruby
mit
19
master
427
# frozen_string_literal: true require 'rails_helper' RSpec.describe FeeTypePolicy do subject { described_class } let(:admin) { users(:admin) } let(:volunteer) { users(:volunteer) } let(:member) { users(:member) } %i[create? edit? update? destroy?].each do |activity| permissions activity do it { ...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/policies/carrier_policy_spec.rb
Ruby
mit
19
master
790
# frozen_string_literal: true require 'rails_helper' RSpec.describe CarrierPolicy do subject(:instance) { described_class } let(:admin) { users(:admin) } let(:volunteer) { users(:volunteer) } let(:member) { users(:member) } %i[update? destroy?].each do |activity| permissions activity do it { is_...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/policies/membership_type_policy_spec.rb
Ruby
mit
19
master
458
# frozen_string_literal: true require 'rails_helper' RSpec.describe MembershipTypePolicy do subject { described_class } let(:admin) { users(:admin) } let(:volunteer) { users(:volunteer) } let(:borrower) { users(:borrower) } %i[create? index? update? edit? destroy?].each do |activity| permissions activ...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/policies/application_policy_spec.rb
Ruby
mit
19
master
1,071
# frozen_string_literal: true ## setup for testing abstract-ish application policy class DummyPundit def self.all [1, 2, 3] end end class DummyPunditPolicy < ApplicationPolicy end ### RSpec.describe ApplicationPolicy do subject(:policy) { described_class } let(:admin) { users(:admin) } let(:volunteer)...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/policies/user_policy_spec.rb
Ruby
mit
19
master
422
# frozen_string_literal: true RSpec.describe UserPolicy do subject(:instance) { described_class } let(:admin) { users(:admin) } let(:volunteer) { users(:volunteer) } let(:borrower) { users(:borrower) } %i[new? create? edit? update? destroy?].each do |activity| permissions activity do it { is_expe...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/policies/category_policy_spec.rb
Ruby
mit
19
master
428
# frozen_string_literal: true require 'rails_helper' RSpec.describe CategoryPolicy do subject { described_class } let(:admin) { users(:admin) } let(:volunteer) { users(:volunteer) } let(:member) { users(:member) } %i[create? edit? update? destroy?].each do |activity| permissions activity do it {...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/policies/loan_policy_spec.rb
Ruby
mit
19
master
365
# frozen_string_literal: true RSpec.describe LoanPolicy do subject { described_class } let(:admin) { users(:admin) } let(:volunteer) { users(:volunteer) } let(:member) { users(:member) } permissions :create? do it { is_expected.not_to permit(member) } it { is_expected.to permit(admin) } it { ...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/mailers/checkout_mailer_spec.rb
Ruby
mit
19
master
1,747
# frozen_string_literal: true RSpec.describe CheckoutMailer, type: :mailer do let(:loan) { loans(:outstanding) } let(:user) { loan.borrower } let(:template) { email_templates(:checkout) } describe '#checkout_email' do context 'with active template' do it 'renders the email with the template text' do...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/mailers/reminder_mailer_spec.rb
Ruby
mit
19
master
1,394
# frozen_string_literal: true RSpec.describe ReminderMailer, type: :mailer do let(:loan) { loans(:due_one_week) } let(:user) { loan.borrower } let(:template) { email_templates(:reminder_one_week) } describe '#reminder_email' do context 'with active template' do it 'renders the email with the templat...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/mailers/welcome_mailer_spec.rb
Ruby
mit
19
master
938
# frozen_string_literal: true RSpec.describe WelcomeMailer, type: :mailer do let(:user) { users(:member) } describe '#welcome_email' do let(:template) { email_templates(:welcome) } context 'with active template' do it 'renders the email with the template text' do mail = described_class.welc...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/lib/email_template_parser_spec.rb
Ruby
mit
19
master
716
# frozen_string_literal: true require 'spec_helper' require 'email_template_parser' RSpec.describe EmailTemplateParser do describe '#parse_body' do it 'sets replaces the substitution values' do due_date = '03/31/2021' carrier_name = 'My Carrier' user_name = 'George' parser = described_cl...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/validators/subdomain_validator_spec.rb
Ruby
mit
19
master
1,669
# frozen_string_literal: true require 'rails_helper' require 'subdomain_validator' class Subdomain include ActiveModel::Model attr_accessor :subdomain validates :subdomain, subdomain: true end RSpec.describe SubdomainValidator, type: :validator do it 'validates if the value is not present' do subdomain ...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/support/devise.rb
Ruby
mit
19
master
325
# frozen_string_literal: true RSpec.configure do |config| config.include Devise::Test::IntegrationHelpers, type: :request config.include Devise::Test::ControllerHelpers, type: :controller config.include Devise::Test::ControllerHelpers, type: :view config.include Devise::Test::IntegrationHelpers, type: :feature...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/support/request_subdomain_helpers.rb
Ruby
mit
19
master
215
# frozen_string_literal: true module RequestSubdomainHelpers def within_subdomain(subdomain = 'admin') before { host! "#{subdomain}.example.com" } after { host! 'www.example.com' } yield end end
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/support/location.rb
Ruby
mit
19
master
259
# frozen_string_literal: true RSpec.configure do |config| config.include Devise::Test::ControllerHelpers, type: :controller config.include Devise::Test::ControllerHelpers, type: :view config.include Devise::Test::IntegrationHelpers, type: :feature end
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/support/feature_subdomain_helpers.rb
Ruby
mit
19
master
309
# frozen_string_literal: true module FeatureSubdomainHelpers # Sets Capybara to use a given subdomain. def within_subdomain(subdomain = 'admin') before { Capybara.default_host = "http://#{subdomain}.example.com" } after { Capybara.default_host = 'http://www.example.com' } yield end end
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/support/requests/shared_examples.rb
Ruby
mit
19
master
1,140
# frozen_string_literal: true RSpec.shared_examples 'admin authorized-only resource' do |action| subject(:access) { send action.to_sym, endpoint, params: defined?(params) && params || {} } it 'authorizes admin users' do sign_in users(:admin) access expect(response).not_to be_unauthorized end it ...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/support/features/devise_helpers.rb
Ruby
mit
19
master
465
# frozen_string_literal: true module Features def sign_in_with(email:, password:) visit new_user_session_url fill_in 'user_email', with: email fill_in 'user_password', with: password click_button 'Log In' end def user_sign_out click_link 'Logout' end def user_should_be_signed_in vis...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/helpers/users_helper_spec.rb
Ruby
mit
19
master
1,437
# frozen_string_literal: true RSpec.describe UsersHelper do let(:member) { users(:member) } let(:nonmember) { users(:nonmember) } let(:expired) { users(:expired) } let(:blocked) { users(:blocked) } describe '#user_roles_select' do it 'returns user roles formated for rails select' do result = helpe...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/helpers/carriers_helper_spec.rb
Ruby
mit
19
master
365
# frozen_string_literal: true RSpec.describe CarriersHelper do describe '#carrier_badge_class' do it 'returns correct css class base on the carrier status' do expect(helper.carrier_badge_class(carriers(:carrier))).to eq 'badge badge-success' expect(helper.carrier_badge_class(carriers(:unavailable)))....
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/helpers/email_templates_helper_spec.rb
Ruby
mit
19
master
1,196
# frozen_string_literal: true RSpec.describe EmailTemplatesHelper do describe '#types_for_select' do it 'returns the correct types' do expect(helper.types_for_select).to eq( [%w[Checkout CheckoutEmailTemplate], %w[Reminder ReminderEmailTemplate], %w[Welcome WelcomeEmailTemplate]] ...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/models/category_spec.rb
Ruby
mit
19
master
295
# frozen_string_literal: true RSpec.describe Category, type: :model do let!(:category) { categories(:category) } it 'is unique' do duplicate = described_class.new(name: category.name) duplicate.save expect(duplicate.errors[:name]).to include 'has already been taken' end end
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/models/organization_spec.rb
Ruby
mit
19
master
1,918
# frozen_string_literal: true RSpec.describe Organization, type: :model do let(:midatlantic) { organizations(:midatlantic) } describe 'associations' do it { is_expected.to have_many(:users) } end describe 'validations' do it { is_expected.to validate_presence_of(:name) } it { is_expected.to valid...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/models/user_spec.rb
Ruby
mit
19
master
6,271
# frozen_string_literal: true require 'rails_helper' RSpec.describe User do let(:user) { users(:user) } let(:member) { users(:member) } let(:upcoming) { users(:upcoming) } let(:nonmember) { users(:nonmember) } let(:unsigned) { users(:unsigned) } let(:expired) { users(:expired) } let(:admin) { users(:adm...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/models/membership_spec.rb
Ruby
mit
19
master
1,464
# frozen_string_literal: true require 'rails_helper' RSpec.describe Membership, type: :model do let(:membership) { memberships(:member) } let(:expired) { memberships(:expired) } it { is_expected.to belong_to(:user) } it { is_expected.to belong_to(:membership_type) } it { is_expected.to validate_presence_of...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/models/agreement_version_spec.rb
Ruby
mit
19
master
2,225
# frozen_string_literal: true RSpec.describe AgreementVersion do let(:user) { users(:user) } let(:agreement) { agreements(:agreement) } let(:agreement_version) { agreement_versions(:agreement_version) } describe 'associations' do it { is_expected.to belong_to(:agreement) } it { is_expected.to belong_t...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/models/carrier_spec.rb
Ruby
mit
19
master
2,911
# frozen_string_literal: true RSpec.describe Carrier do let(:washington) { locations(:washington) } let(:lancaster) { locations(:lancaster) } let(:category) { categories(:category) } describe 'associations' do it { is_expected.to belong_to(:organization) } end it 'has a valid fixture' do expect(c...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/models/email_template_spec.rb
Ruby
mit
19
master
209
# frozen_string_literal: true RSpec.describe EmailTemplate do describe 'validations' do it { is_expected.to validate_presence_of(:name) } it { is_expected.to validate_presence_of(:type) } end end
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/models/signature_spec.rb
Ruby
mit
19
master
1,499
# frozen_string_literal: true RSpec.describe Signature do let(:user) { users(:user) } let(:agreement) { agreements(:agreement) } let(:agreement_version) { agreement_versions(:agreement_version) } let(:signature) { signatures(:signature) } let(:nonmember_signature) { signatures(:nonmember_signature) } let(:...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/models/agreement_spec.rb
Ruby
mit
19
master
1,595
# frozen_string_literal: true RSpec.describe Agreement do let(:user) { users(:admin) } let(:organization) { organizations(:midatlantic) } let(:agreement) { agreements(:agreement) } describe 'associations' do it { is_expected.to belong_to(:organization) } it { is_expected.to have_many(:versions) } en...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/models/reminder_email_template_spec.rb
Ruby
mit
19
master
807
# frozen_string_literal: true RSpec.describe ReminderEmailTemplate do let(:template) { subject } describe 'validations' do it { is_expected.to validate_presence_of(:when_sent) } context 'with when_sent before_due_date' do before { allow(template).to receive(:when_sent).and_return('before_due_date')...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/models/loan_spec.rb
Ruby
mit
19
master
2,768
# frozen_string_literal: true RSpec.describe Loan do let(:borrower) { users(:borrower) } let(:nonmember_borrower) { users(:nonmember) } let(:expired_borrower) { users(:expired) } let(:volunteer) { users(:volunteer) } let(:carrier) { carriers(:carrier) } describe '#valid?' do context 'with a borrow...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/models/user/filter_impl_spec.rb
Ruby
mit
19
master
1,857
# frozen_string_literal: true RSpec.describe User::FilterImpl do around do |example| ActsAsTenant.with_tenant(organizations(:midatlantic)) do example.run end end describe '.search_name' do context 'with single word parameter' do it 'returns matching users' do pis = [users(:user),...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/models/carrier/filter_impl_spec.rb
Ruby
mit
19
master
648
# frozen_string_literal: true RSpec.describe Carrier::FilterImpl do around do |example| ActsAsTenant.with_tenant(organizations(:midatlantic)) do example.run end end describe '.with_state_in' do context 'with parameter available' do it 'returns all and only ones with available state' do ...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/models/loan/filter_impl_spec.rb
Ruby
mit
19
master
1,717
# frozen_string_literal: true RSpec.describe Loan::FilterImpl do let(:organization) { organizations(:midatlantic) } around do |example| ActsAsTenant.with_tenant(organization) do example.run end end describe '.with_overdue' do describe '.with_Yes' do it 'returns all overdue loans' do ...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/features/fee_type_spec.rb
Ruby
mit
19
master
1,704
# frozen_string_literal: true RSpec.feature 'fee_type' do let(:user) { users(:admin) } let(:fee_type) { fee_types(:upgrade) } before do visit '/' sign_in user end scenario 'SHOW' do visit fee_types_url click_link fee_type.name expect(page).to have_content(fee_type.name) expect(page...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/features/user_registration_spec.rb
Ruby
mit
19
master
1,154
# frozen_string_literal: true RSpec.feature 'user registration' do it 'allows user to create a user account' do visit root_url find_link('Sign Up', match: :first).click fill_in 'Enter email address', with: 'alicia@gmail.com' fill_in 'Password', with: 'just4now' fill_in 'Confirm Password', with: '...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/features/agreement_spec.rb
Ruby
mit
19
master
1,631
# frozen_string_literal: true RSpec.feature 'create an agreement', type: :feature do let(:user) { users(:admin) } let(:agreement) { agreements(:agreement) } before do visit '/' sign_in user end scenario 'SHOW' do visit agreements_url click_on agreement.name expect(page).to have_content...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/features/membership_type_spec.rb
Ruby
mit
19
master
1,526
# frozen_string_literal: true RSpec.describe 'MembershipType', type: :feature do let(:user) { users(:admin) } let(:membership_type) { membership_types(:annual) } before do visit '/' sign_in user end scenario 'EDIT when name is NOT given' do visit edit_membership_type_url(membership_type) f...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/features/category_spec.rb
Ruby
mit
19
master
1,511
# frozen_string_literal: true RSpec.feature 'category' do let!(:category) { categories(:category_parent) } let!(:category_child) { categories(:category) } let(:user) { users(:admin_org) } before do visit subdomain_root_url sign_in user end it 'allows user to create a category' do visit catego...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/features/visitor_signs_in_spec.rb
Ruby
mit
19
master
737
# frozen_string_literal: true RSpec.describe 'Visitor signs in', type: :feature do let(:user) { users(:member) } let(:valid_password) { 'password' } scenario 'with valid email and password' do sign_in_with email: user.email, password: valid_password user_should_be_signed_in end scenario 'with inval...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/features/user_spec.rb
Ruby
mit
19
master
3,449
# frozen_string_literal: true require 'rails_helper' RSpec.describe User do include ActionView::Helpers::NumberHelper let(:admin) { users(:admin) } let(:volunteer) { users(:volunteer) } let(:member) { users(:member) } let(:borrower) { users(:borrower) } scenario 'should allow a volunteer user to create ...
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/features/user_signs_out_spec.rb
Ruby
mit
19
master
230
# frozen_string_literal: true RSpec.describe 'User signs out', type: :feature do scenario 'signs out' do user = users(:member) sign_in user visit root_url user_sign_out user_should_be_signed_out end end
github
rubyforgood/babywearing
https://github.com/rubyforgood/babywearing
spec/features/user_update_infos_spec.rb
Ruby
mit
19
master
1,527
# frozen_string_literal: true RSpec.describe 'User update information', type: :feature do let!(:user) { users(:user) } scenario 'checking the fields before update' do sign_in_with email: user.email, password: 'password' user_should_be_signed_in visit(edit_user_registration_url) expect(page).to hav...