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
Shopify/active_utils
https://github.com/Shopify/active_utils
lib/active_utils/validateable.rb
Ruby
mit
95
main
1,640
module ActiveUtils #:nodoc: module Validateable #:nodoc: def valid? errors.clear before_validate if respond_to?(:before_validate, true) validate if respond_to?(:validate, true) errors.empty? end def initialize(attributes = {}) self.attributes = attributes end def ...
github
Shopify/active_utils
https://github.com/Shopify/active_utils
lib/active_utils/network_connection_retries.rb
Ruby
mit
95
main
3,812
module ActiveUtils module NetworkConnectionRetries DEFAULT_RETRIES = 3 DEFAULT_CONNECTION_ERRORS = { EOFError => "The remote server dropped the connection", Errno::ECONNRESET => "The remote server reset the connection", Timeout::Error => "The connection to the remo...
github
Shopify/active_utils
https://github.com/Shopify/active_utils
lib/active_utils/post_data.rb
Ruby
mit
95
main
480
require 'cgi' module ActiveUtils class PostData < Hash class_attribute :required_fields, :instance_writer => false self.required_fields = [] def []=(key, value) return if value.blank? && !required?(key) super end def to_post_data collect { |key, value| "#{key}=#{CGI.escape(val...
github
Shopify/active_utils
https://github.com/Shopify/active_utils
test/test_helper.rb
Ruby
mit
95
main
299
require 'active_utils' require 'minitest/autorun' require 'mocha/minitest' include ActiveUtils # This makes sure that Minitest::Test exists when an older version of Minitest # (i.e. 4.x) is required by ActiveSupport. unless defined?(Minitest::Test) Minitest::Test = MiniTest::Unit::TestCase end
github
Shopify/active_utils
https://github.com/Shopify/active_utils
test/unit/connection_test.rb
Ruby
mit
95
main
6,195
require 'test_helper' class ConnectionTest < Minitest::Test def setup @ok = stub(:code => 200, :message => 'OK', :body => 'success') @endpoint = 'https://example.com/tx.php' @connection = ActiveUtils::Connection.new(@endpoint) @connection.logger = stub(:info => nil, :debug => nil, :error => nil) ...
github
Shopify/active_utils
https://github.com/Shopify/active_utils
test/unit/post_data_test.rb
Ruby
mit
95
main
1,205
require 'test_helper' class MyPost < ActiveUtils::PostData self.required_fields = [ :ccnumber, :ccexp, :firstname, :lastname, :username, :password, :order_id, :key, :time ] end class PostDataTest < Minitest::Test def teardown ActiveUtils::PostData.required_fields = [] end def test_element_assignment ...
github
Shopify/active_utils
https://github.com/Shopify/active_utils
test/unit/country_code_test.rb
Ruby
mit
95
main
746
require 'test_helper' class CountryCodeTest < Minitest::Test def test_alpha2_country_code code = CountryCode.new('CA') assert_equal 'CA', code.value assert_equal 'CA', code.to_s assert_equal :alpha2, code.format end def test_lower_alpha2_country_code code = CountryCode.new('ca') assert_e...
github
Shopify/active_utils
https://github.com/Shopify/active_utils
test/unit/currency_code_test.rb
Ruby
mit
95
main
1,149
require 'test_helper' class CurrencyCodeTest < Minitest::Test def test_is_iso_should_return_true_for_iso_currencies assert CurrencyCode.is_iso?('CAD') assert CurrencyCode.is_iso?('USD') assert CurrencyCode.is_iso?('TWD') end def test_is_iso_should_return_false_for_non_iso_currencies assert !Curr...
github
Shopify/active_utils
https://github.com/Shopify/active_utils
test/unit/posts_data_test.rb
Ruby
mit
95
main
2,761
require 'test_helper' require 'active_support/core_ext/class' class PostsDataTest < Minitest::Test class SSLPoster include PostsData attr_accessor :logger end def setup @poster = SSLPoster.new end def test_ssl_request_retried_three_times_by_default requester = stubs(:requester) request...
github
Shopify/active_utils
https://github.com/Shopify/active_utils
test/unit/network_connection_retries_test.rb
Ruby
mit
95
main
6,880
require 'test_helper' require 'openssl' require 'net/http' class NetworkConnectionRetriesTest < Minitest::Test class MyNewError < StandardError end include NetworkConnectionRetries def setup @logger = stubs(:logger) @requester = stubs(:requester) @ok = stub(:code => 200, :message => 'OK', :body =...
github
Shopify/active_utils
https://github.com/Shopify/active_utils
test/unit/country_test.rb
Ruby
mit
95
main
2,657
require 'test_helper' class CountryTest < Minitest::Test def test_country_from_hash country = Country.new(:name => 'Canada', :alpha2 => 'CA', :alpha3 => 'CAN', :numeric => '124') assert_equal 'CA', country.code(:alpha2).value assert_equal 'CAN', country.code(:alpha3).value assert_equal '124', country...
github
Shopify/active_utils
https://github.com/Shopify/active_utils
test/unit/validateable_test.rb
Ruby
mit
95
main
1,305
require 'test_helper' class Dood include ActiveUtils::Validateable attr_accessor :name, :email, :country def validate errors.add "name", "cannot be empty" if name.blank? errors.add "email", "cannot be empty" if email.blank? errors.add_to_base "The country cannot be blank" if country.blank? end e...
github
svenfuchs/simple_states
https://github.com/svenfuchs/simple_states
simple_states.gemspec
Ruby
mit
95
master
586
# encoding: utf-8 $:.unshift File.expand_path('../lib', __FILE__) require 'simple_states/version' Gem::Specification.new do |s| s.name = "simple_states" s.version = SimpleStates::VERSION s.authors = ["Sven Fuchs"] s.email = "me@svenfuchs.com" s.homepage = "https://github.com/sve...
github
svenfuchs/simple_states
https://github.com/svenfuchs/simple_states
Rakefile
Ruby
mit
95
master
291
require 'rake' require 'rake/testtask' Rake::TestTask.new do |t| t.libs << 'lib' << 'test' # this currently does not work in rake 0.9.2, 0.9.3 will fix it # t.pattern = 'test/**/*_test.rb' t.test_files = FileList['test/**/*_test.rb'] t.verbose = false end task :default => :test
github
svenfuchs/simple_states
https://github.com/svenfuchs/simple_states
lib/simple_states.rb
Ruby
mit
95
master
1,632
require 'simple_states/states' module SimpleStates class Error < RuntimeError; end class << self def included(const) states = const.const_set(:States, States.new) const.send(:prepend, states) if const.respond_to?(:prepend) const.extend(ClassMethods) const.initial_state = :created ...
github
svenfuchs/simple_states
https://github.com/svenfuchs/simple_states
lib/simple_states/states.rb
Ruby
mit
95
master
1,094
require 'simple_states/event' require 'simple_states/helpers' module SimpleStates class States < Module include Helpers def events @events ||= {} end def states events.values.map { |event| event.opts[:to] }.flatten.compact end def define_event(name, opts) events[name] = E...
github
svenfuchs/simple_states
https://github.com/svenfuchs/simple_states
lib/simple_states/event.rb
Ruby
mit
95
master
2,617
module SimpleStates class Event < Struct.new(:name, :opts) MSGS = { invalid_state: 'If multiple target states are defined, then a valid target state must be passed as an attribute ({ state: :state }). %p given, known states: %p.', unknown_state: 'Unknown state %p for %p for event %p. Known states are:...
github
svenfuchs/simple_states
https://github.com/svenfuchs/simple_states
spec/conditions_spec.rb
Ruby
mit
95
master
2,148
describe SimpleStates, 'conditions' do let(:klass) { create_class { attr_accessor :started_at } } let(:obj) { klass.new } describe ':if' do before { klass.event :start, if: :start? } describe 'if the condition applies' do before { klass.send(:define_method, :start?) { true } } describe ...
github
svenfuchs/simple_states
https://github.com/svenfuchs/simple_states
spec/events_spec.rb
Ruby
mit
95
master
2,431
describe SimpleStates, 'event' do let(:klass) do create_class do attr_accessor :started_at, :finished_at, :log event :start event :finish, to: [:passed, :failed, :errored, :canceled] end end let(:obj) { klass.new } describe 'returns true' do it { expect(obj.start).to eq true } ...
github
svenfuchs/simple_states
https://github.com/svenfuchs/simple_states
spec/predicates_spec.rb
Ruby
mit
95
master
1,597
describe SimpleStates, 'predicates' do let(:klass) do create_class do attr_accessor :started_at, :finished_at event :start event :finish, to: [:passed, :failed, :errored, :canceled] end end let(:obj) { klass.new(:started) } describe 'state?' do describe 'when the object has the g...
github
svenfuchs/simple_states
https://github.com/svenfuchs/simple_states
spec/callbacks_spec.rb
Ruby
mit
95
master
4,121
describe SimpleStates, 'callbacks' do let(:klass) do create_class do attr_reader :events def log(event) @events ||= [] @events << event end end end let(:obj) { klass.new } describe ':before' do describe 'defined on an event' do before do klass.event...
github
svenfuchs/simple_states
https://github.com/svenfuchs/simple_states
spec/ordering_spec.rb
Ruby
mit
95
master
1,196
describe SimpleStates, 'ordering' do let(:klass) do create_class do attr_accessor :started_at, :finished_at event :start event :finish end end let(:obj) { klass.new } shared_examples_for 'accepts the event' do it { expect(obj.finish).to eq true } it { expect { obj.finish }.to...
github
svenfuchs/simple_states
https://github.com/svenfuchs/simple_states
spec/states_spec.rb
Ruby
mit
95
master
1,139
describe SimpleStates do let(:klass) { create_class } let(:obj) { klass.new } describe 'initial state' do describe 'uses :created by default' do it { expect(obj.state).to eq :created } it { expect(obj.state?(:created)).to eq true } it { expect(obj.created?).to eq true } end describ...
github
svenfuchs/simple_states
https://github.com/svenfuchs/simple_states
spec/support/helpers.rb
Ruby
mit
95
master
330
module Support module Helpers def self.included(c) c.let!(:now) { Time.now.utc } c.before { Time.stubs(:now).returns(stub('now', utc: now)) } end def create_class(&block) Class.new(Struct.new(:state)) do include SimpleStates class_eval(&block) if block end end ...
github
benbalter/jekyll-readme-index
https://github.com/benbalter/jekyll-readme-index
jekyll-readme-index.gemspec
Ruby
mit
95
master
1,032
# frozen_string_literal: true $LOAD_PATH.unshift File.expand_path("lib", __dir__) require "jekyll-readme-index/version" Gem::Specification.new do |s| s.name = "jekyll-readme-index" s.version = JekyllReadmeIndex::VERSION s.authors = ["Ben Balter"] s.email = ["ben.balter@github.com"...
github
benbalter/jekyll-readme-index
https://github.com/benbalter/jekyll-readme-index
spec/spec_helper.rb
Ruby
mit
95
master
1,074
# frozen_string_literal: true require "jekyll-readme-index" RSpec.configure do |config| config.expect_with :rspec do |expectations| expectations.include_chain_clauses_in_custom_matcher_descriptions = true end config.mock_with :rspec do |mocks| mocks.verify_partial_doubles = true end config.shared_...
github
benbalter/jekyll-readme-index
https://github.com/benbalter/jekyll-readme-index
spec/jekyll-readme-index/generator_spec.rb
Ruby
mit
95
master
23,455
# frozen_string_literal: true describe JekyllReadmeIndex::Generator do subject { described_class.new(site) } let(:overrides) { {} } let(:site) { fixture_site(fixture, overrides) } let(:readmes) { subject.send(:readmes) } let(:readmes_with_frontmatter) { subject.send(:readmes_with_frontmatter) } let(:dir) ...
github
benbalter/jekyll-readme-index
https://github.com/benbalter/jekyll-readme-index
lib/jekyll-readme-index/generator.rb
Ruby
mit
95
master
4,635
# frozen_string_literal: true module JekyllReadmeIndex class Generator < Jekyll::Generator INDEX_REGEX = %r!$|index\.(html?|xhtml|xml)$!i.freeze GITHUB_DIR = "/.github" DOCS_DIR = "/docs" SPECIAL_DIRS = [GITHUB_DIR, DOCS_DIR].freeze GITHUB_README_PATTERN = %r!^/\.github/readme!i.freeze DOCS_R...
github
benbalter/jekyll-readme-index
https://github.com/benbalter/jekyll-readme-index
lib/jekyll/static_file_ext.rb
Ruby
mit
95
master
1,214
# frozen_string_literal: true module Jekyll class StaticFile # Convert this static file to a Page def to_page page = Jekyll::Page.new(@site, @base, @dir, @name) # For READMEs in .github or docs at root level, they should be the root index target_dir = if special_readme? ...
github
chatterbugapp/cacheql
https://github.com/chatterbugapp/cacheql
cacheql.gemspec
Ruby
mit
95
master
1,101
lib = File.expand_path("../lib", __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "cacheql/version" Gem::Specification.new do |spec| spec.name = "cacheql" spec.version = CacheQL::VERSION spec.authors = ["Nick Quaranto"] spec.email = ["nick@quaran.to"] sp...
github
chatterbugapp/cacheql
https://github.com/chatterbugapp/cacheql
lib/cacheql.rb
Ruby
mit
95
master
1,232
require "digest" require "graphql" require "graphql/batch" require "cacheql/version" require "cacheql/resolve_wrapper" require_relative "./cacheql/railtie" if defined? Rails::Railtie # Wrap a resolve function to store its value in Rails.cache # This requires `cache_key` as an instance method on the object (usually o...
github
chatterbugapp/cacheql
https://github.com/chatterbugapp/cacheql
lib/cacheql/field_instrumentation.rb
Ruby
mit
95
master
1,964
# https://github.com/rmosolgo/graphql-ruby/blob/master/lib/graphql/tracing/scout_tracing.rb # https://github.com/rmosolgo/graphql-ruby/blob/master/guides/fields/instrumentation.md # http://help.apm.scoutapp.com/#ruby-custom-instrumentation module CacheQL class FieldInstrumentation NAME = "graphql.field".freeze ...
github
chatterbugapp/cacheql
https://github.com/chatterbugapp/cacheql
lib/cacheql/railtie.rb
Ruby
mit
95
master
670
module CacheQL class Railtie < Rails::Railtie # Bump to bust all GraphQL caches! config.global_key = "CacheQL/v1" # Expire caches within this minute range config.expires_range = (90..120).to_a.freeze initializer "cacheql.initialize" do # Bring over some rails default config.cache = R...
github
chatterbugapp/cacheql
https://github.com/chatterbugapp/cacheql
lib/cacheql/association_loader.rb
Ruby
mit
95
master
1,427
# https://github.com/Shopify/graphql-batch/blob/master/examples/association_loader.rb module CacheQL class AssociationLoader < GraphQL::Batch::Loader def self.validate(model, association_name) new(model, association_name) nil end def initialize(model, association_name) @model = model ...
github
chatterbugapp/cacheql
https://github.com/chatterbugapp/cacheql
lib/cacheql/resolve_wrapper.rb
Ruby
mit
95
master
522
module CacheQL class ResolveWrapper def initialize(resolver_func) @resolver_func = resolver_func end def __getobj__ @resolver_func end # Resolve function level caching! def call(obj, args, ctx) cache_key = [CacheQL::Railtie.config.global_key, obj.cache_key, ctx.field.name] ...
github
chatterbugapp/cacheql
https://github.com/chatterbugapp/cacheql
lib/cacheql/record_loader.rb
Ruby
mit
95
master
833
# Via https://github.com/Shopify/graphql-batch/blob/master/examples/record_loader.rb # And https://github.com/rmosolgo/graphql-batch-example/blob/master/good_schema/find_loader.rb module CacheQL class RecordLoader < GraphQL::Batch::Loader def initialize(model, column: model.primary_key, where: nil) @model =...
github
chatterbugapp/cacheql
https://github.com/chatterbugapp/cacheql
lib/cacheql/polymorphic_key_loader.rb
Ruby
mit
95
master
863
# Based on https://github.com/rmosolgo/graphql-batch-example/blob/master/good_schema/polymorphic_key_loader.rb module CacheQL class PolymorphicKeyLoader < GraphQL::Batch::Loader def initialize(model, polymorphic_key) @model = model @polymorphic_key = polymorphic_key end def perform(polymorphi...
github
guard/guard-test
https://github.com/guard/guard-test
Gemfile
Ruby
mit
95
master
335
source 'https://rubygems.org' gemspec gem 'rake' group :development do gem 'ruby_gntp' gem 'guard-rspec' end # The test group will be # installed on Travis CI # group :test do gem 'rspec', '~> 3.1' gem 'codeclimate-test-reporter', require: nil end platforms :rbx do gem 'racc' gem 'rubysl', '~> 2.0' g...
github
guard/guard-test
https://github.com/guard/guard-test
Guardfile
Ruby
mit
95
master
612
group :specs, halt_on_fail: true do guard :rspec, cmd: 'bundle exec rspec', failed_mode: :keep do require "guard/rspec/dsl" dsl = Guard::RSpec::Dsl.new(self) # Feel free to open issues for suggestions and improvements # RSpec files rspec = dsl.rspec watch(rspec.spec_helper) { rspec.spec_dir ...
github
guard/guard-test
https://github.com/guard/guard-test
guard-test.gemspec
Ruby
mit
95
master
806
$:.push File.expand_path('../lib', __FILE__) require 'guard/test/version' Gem::Specification.new do |s| s.name = 'guard-test' s.version = Guard::TestVersion::VERSION s.platform = Gem::Platform::RUBY s.license = 'MIT' s.author = 'Rémy Coutable' s.email = 'remy@rymai.me' s.home...
github
guard/guard-test
https://github.com/guard/guard-test
spec/spec_helper.rb
Ruby
mit
95
master
996
require 'guard/compat/test/helper' require 'codeclimate-test-reporter' CodeClimate::TestReporter.start RSpec.configure do |config| config.expect_with :rspec do |expectations| expectations.include_chain_clauses_in_custom_matcher_descriptions = true end config.mock_with :rspec do |mocks| mocks.verify_par...
github
guard/guard-test
https://github.com/guard/guard-test
spec/lib/guard/test_spec.rb
Ruby
mit
95
master
7,451
require 'guard/test' RSpec.describe Guard::Test do subject { described_class.new } let(:runner) { subject.instance_variable_get(:@runner) } before do allow(Guard::Compat::UI).to receive(:info) end describe "#initialize" do it "instantiates a new Runner" do expect(Guard::Test::Runner).to recei...
github
guard/guard-test
https://github.com/guard/guard-test
spec/lib/guard/test/runner_spec.rb
Ruby
mit
95
master
11,704
require 'guard/test/runner' RSpec.describe Guard::Test::Runner do before do allow(Guard::Compat::UI).to receive(:info) end describe "#initialize" do describe "sets the @runner instance variable from options" do it "sets default options" do runner = described_class.new expect(runner...
github
guard/guard-test
https://github.com/guard/guard-test
spec/lib/guard/test/notifier_spec.rb
Ruby
mit
95
master
1,308
require 'guard/test/notifier' RSpec.describe Guard::Test::Notifier do describe "#notify(result, duration)" do context "no failure, no error" do it "displays a 'success' image" do result = create_mock_result expect(Guard::Compat::UI).to receive(:notify).with(anything, title: "Test::Unit res...
github
guard/guard-test
https://github.com/guard/guard-test
spec/lib/guard/test/inspector_spec.rb
Ruby
mit
95
master
2,463
require 'guard/test/inspector' RSpec.describe Guard::Test::Inspector do describe "clean" do before { subject.test_paths = ["test"] } it "should add all test files under the given dir" do expect(subject.clean(["test"])).to \ eq ["test/succeeding_test.rb", "test/succeeding_tests.rb", "test/test_o...
github
guard/guard-test
https://github.com/guard/guard-test
lib/guard/test.rb
Ruby
mit
95
master
1,786
require 'guard/compat/plugin' require 'guard/test/version' require 'test/unit/version' module Guard class Test < Plugin require 'guard/test/runner' require 'guard/test/inspector' def initialize(options = {}) super @options = { all_on_start: true, all_after_pass: true, ...
github
guard/guard-test
https://github.com/guard/guard-test
lib/guard/test/guard_test_runner.rb
Ruby
mit
95
master
1,172
require 'test/unit/autorunner' require 'test/unit/ui/console/testrunner' require 'guard/test/notifier' # Thanks to Adam Sanderson for the really good starting point: # http://endofline.wordpress.com/2008/02/11/a-custom-testrunner-to-scratch-an-itch/ # # This class inherits from Test::Unit' standard console TestRunner ...
github
guard/guard-test
https://github.com/guard/guard-test
lib/guard/test/notifier.rb
Ruby
mit
95
master
1,149
require 'guard/compat/plugin' module Guard class Test < Plugin module Notifier class << self def notify(result, elapsed_time) Compat::UI.notify( summary(result) + "\n\n" + duration(elapsed_time), title: "Test::Unit results", image: result.passed? ? :su...
github
guard/guard-test
https://github.com/guard/guard-test
lib/guard/test/runner.rb
Ruby
mit
95
master
3,158
require 'guard/compat/plugin' module Guard class Test < Plugin class Runner attr_reader :options def initialize(opts = {}) @options = { bundler: File.exist?("#{Dir.pwd}/Gemfile"), rubygems: false, rvm: [], include: %w[lib:test], drb: ...
github
guard/guard-test
https://github.com/guard/guard-test
lib/guard/test/inspector.rb
Ruby
mit
95
master
1,374
require 'guard/compat/plugin' module Guard class Test < Plugin module Inspector class << self def test_paths @test_paths || [] end def test_paths=(path_array) @test_paths = Array(path_array) end def clean(paths) paths.uniq! ...
github
guard/guard-test
https://github.com/guard/guard-test
lib/guard/test/templates/Guardfile
Ruby
mit
95
master
1,142
guard :test do watch(%r{^test/.+_test\.rb$}) watch('test/test_helper.rb') { 'test' } # Non-rails watch(%r{^lib/(.+)\.rb$}) { |m| "test/#{m[1]}_test.rb" } # Rails 4 # watch(%r{^app/(.+)\.rb}) { |m| "test/#{m[1]}_test.rb" } # watch(%r{^app/controllers/application_controller\...
github
fluffgfx/dit
https://github.com/fluffgfx/dit
dit.gemspec
Ruby
mit
95
master
650
require 'date' Gem::Specification.new do |s| s.name = 'dit' s.version = '0.4' s.date = Date.today.strftime('%Y-%m-%d') s.summary = "Dit is a dotfiles manager that thinks it's git." s.description = 'Dit is a dotfiles manager that wraps around git and makes ' \ 'dotfiles easy to manage across devices.' s...
github
fluffgfx/dit
https://github.com/fluffgfx/dit
lib/dit.rb
Ruby
mit
95
master
6,104
require 'thor' require 'git' require 'os' require 'fileutils' require 'set' # This is the class where all the dit work is done. # The thor class is basically a very thin layer on top of this that just # calls its methods directly. # This is because the hooks are not running through the Thor object, but also # referenc...
github
ruby-openid/omniauth-openid
https://github.com/ruby-openid/omniauth-openid
Appraisals
Ruby
mit
95
main
5,559
# frozen_string_literal: true # HOW TO UPDATE APPRAISALS: # BUNDLE_GEMFILE=Appraisal.root.gemfile bundle # BUNDLE_GEMFILE=Appraisal.root.gemfile bundle exec appraisal update # bundle exec rake rubocop_gradual:autocorrect # Used for HEAD (nightly) releases of ruby, truffleruby, and jruby. # Split into discrete a...
github
ruby-openid/omniauth-openid
https://github.com/ruby-openid/omniauth-openid
omniauth-openid.gemspec
Ruby
mit
95
main
3,889
# encoding: utf-8 gem_version = if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.1") # Loading the version from an anonymous module allows version.rb to get code coverage from SimpleCov! # See: https://github.com/simplecov-ruby/simplecov/issues/557#issuecomment-2630782358 Module.new.tap { |mod| K...
github
ruby-openid/omniauth-openid
https://github.com/ruby-openid/omniauth-openid
Guardfile
Ruby
mit
95
main
241
# A sample Guardfile # More info at https://github.com/guard/guard#readme guard "rspec", version: 2 do watch(%r{^spec/.+_spec\.rb$}) watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } watch("spec/spec_helper.rb") { "spec" } end
github
ruby-openid/omniauth-openid
https://github.com/ruby-openid/omniauth-openid
Gemfile
Ruby
mit
95
main
796
#### IMPORTANT ####################################################### # Gemfile is for local development ONLY; Gemfile is NOT loaded in CI # ####################################################### IMPORTANT #### source "https://rubygems.org" git_source(:github) { |repo_name| "https://github.com/#{repo_name}" } gems...
github
ruby-openid/omniauth-openid
https://github.com/ruby-openid/omniauth-openid
Rakefile
Ruby
mit
95
main
3,306
# frozen_string_literal: true require "bundler/gem_tasks" defaults = [] # See: https://docs.gitlab.com/ci/variables/predefined_variables/ is_gitlab = ENV.fetch("GITLAB_CI", "false").casecmp("true") == 0 ### DEVELOPMENT TASKS # Setup Kettle Soup Cover begin require "kettle-soup-cover" Kettle::Soup::Cover.instal...
github
ruby-openid/omniauth-openid
https://github.com/ruby-openid/omniauth-openid
lib/omniauth-openid.rb
Ruby
mit
95
main
299
# external gems require "version_gem" require "rexml" # this library's version require "omniauth/openid/version" # Configure version before loading the rest of the library OmniAuth::OpenID::Version.class_eval do extend VersionGem::Basic end # This library require "omniauth/strategies/open_id"
github
ruby-openid/omniauth-openid
https://github.com/ruby-openid/omniauth-openid
lib/omniauth-openid/version.rb
Ruby
mit
95
main
589
# DEPRECATED # TODO[v3]: Remove this file entirely with v3 release. # :nocov: unless defined?(OmniAuth::Identity::Version::VERSION) # external gems require "version_gem" # this library's version require "omniauth/openid/version" # Configure version before loading the rest of the library OmniAuth::OpenID::...
github
ruby-openid/omniauth-openid
https://github.com/ruby-openid/omniauth-openid
lib/omniauth/strategies/open_id.rb
Ruby
mit
95
main
5,103
require "omniauth" require "rack/openid" require "openid/store/memory" module OmniAuth module Strategies # OmniAuth strategy for connecting via OpenID. This allows for connection # to a wide variety of sites, some of which are listed [on the OpenID website](http://openid.net/get-an-openid/). class OpenID...
github
ruby-openid/omniauth-openid
https://github.com/ruby-openid/omniauth-openid
spec/spec_helper.rb
Ruby
mit
95
main
1,563
# Std Libs require "securerandom" # Bugfixes # JRuby needed an explicit "require 'logger'" for Rails < 7.1 # See: https://github.com/rails/rails/issues/54260#issuecomment-2594650047 # Placing above omniauth because it is a dependency of omniauth, # which is undeclared in older versions. require "logger" # External ...
github
ruby-openid/omniauth-openid
https://github.com/ruby-openid/omniauth-openid
spec/omniauth/openid/version_spec.rb
Ruby
mit
95
main
588
# rubocop:disable RSpec/SpecFilePathFormat RSpec.describe OmniAuth::OpenID::Version do it_behaves_like "a Version module", described_class it "is greater than 1.0.0" do expect(Gem::Version.new(described_class) >= Gem::Version.new("1.0.0")).to be(true) end it "includes into parent namespace" do expect...
github
ruby-openid/omniauth-openid
https://github.com/ruby-openid/omniauth-openid
spec/omniauth/strategies/open_id_spec.rb
Ruby
mit
95
main
3,330
RSpec.describe OmniAuth::Strategies::OpenID, type: :strategy do def app strat = OmniAuth::Strategies::OpenID Rack::Builder.new { use Rack::Session::Cookie, secret: SecureRandom.hex(64) use strat run lambda { |env| [404, {"Content-Type" => "text/plain"}, [nil || env.key?("omniauth.auth").to_s...
github
ruby-openid/omniauth-openid
https://github.com/ruby-openid/omniauth-openid
examples/client.rb
Ruby
mit
95
main
638
#!/usr/bin/env ruby require "bundler/inline" gemfile do source "https://rubygems.org" gemspec path: "../" gem "httparty" end response = HTTParty.get("http://127.0.0.1:4567/auth/open_id/callback", body: "{\"foo\":\"bar\"}", headers: {"Content-Type" => "plain/text"}) # NOTE: You'll see an invalid_credentials ...
github
ruby-openid/omniauth-openid
https://github.com/ruby-openid/omniauth-openid
examples/server.rb
Ruby
mit
95
main
797
#!/usr/bin/env ruby require "bundler/inline" gemfile do source "https://rubygems.org" gemspec path: "../" gem "sinatra" gem "rackup" gem "puma" gem "json", require: false gem "nap", require: "rest" end require "json" require "securerandom" require "sinatra" require "omniauth-openid" require "openid/s...
github
projectfedena/projectfedena_v2.0
https://github.com/projectfedena/projectfedena_v2.0
features/support/env.rb
Ruby
apache-2.0
95
master
2,594
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril. # It is recommended to regenerate this file in the future when you upgrade to a # newer version of cucumber-rails. Consider adding your own code to a new file # instead of editing this one. Cucumber will automatically load all features/**...
github
projectfedena/projectfedena_v2.0
https://github.com/projectfedena/projectfedena_v2.0
features/step_definitions/web_steps.rb
Ruby
apache-2.0
95
master
8,105
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril. # It is recommended to regenerate this file in the future when you upgrade to a # newer version of cucumber-rails. Consider adding your own code to a new file # instead of editing this one. Cucumber will automatically load all features/**...
github
projectfedena/projectfedena_v2.0
https://github.com/projectfedena/projectfedena_v2.0
script/log_analyzer.rb
Ruby
apache-2.0
95
master
3,836
#!/usr/bin/env ruby # This script will take a look at the output from your rails application and print # info about the number of selects, updates and inserts, as well as the slowest partials # to render and the slowest selects. # # Usage... just pipe the output of your rails app or log to it: # # script/server | log...
github
projectfedena/projectfedena_v2.0
https://github.com/projectfedena/projectfedena_v2.0
test/factories.rb
Ruby
apache-2.0
95
master
1,711
Factory.define :employee_user, :class => User do |u| u.sequence(:username) { |n| "emp#{n}" } u.password { |u1| "#{u1.username}123" } u.email { |u1| "#{u1.username}@fedena.com" } u.first_name 'John' u.last_name 'Doe' u.role 'Employee' end Factory.de...
github
projectfedena/projectfedena_v2.0
https://github.com/projectfedena/projectfedena_v2.0
test/test_helper.rb
Ruby
apache-2.0
95
master
463
ENV["RAILS_ENV"] = "test" require File.expand_path(File.dirname(__FILE__) + "./../config/environment") require File.dirname(__FILE__) + "/factories" require 'test_help' class ActiveSupport::TestCase self.use_transactional_fixtures = true self.use_instantiated_fixtures = false # fixtures :all private def ...
github
projectfedena/projectfedena_v2.0
https://github.com/projectfedena/projectfedena_v2.0
test/unit/grading_level_test.rb
Ruby
apache-2.0
95
master
1,118
require File.expand_path(File.dirname(__FILE__) + './../test_helper') class GradingLevelTest < ActiveSupport::TestCase fixtures :batches should_belong_to :batch context 'a new grading level' do setup do @grading_level = GradingLevel.new(:name => 'A', :min_score => 85, :order => 1) end shoul...
github
projectfedena/projectfedena_v2.0
https://github.com/projectfedena/projectfedena_v2.0
test/unit/exam_group_test.rb
Ruby
apache-2.0
95
master
639
require File.expand_path(File.dirname(__FILE__) + './../test_helper') class ExamGroupTest < ActiveSupport::TestCase should_validate_presence_of :name should_have_many :exams context 'a new exam group' do setup do @exam_group = Factory.build(:exam_group) end should 'be valid' do assert_v...
github
projectfedena/projectfedena_v2.0
https://github.com/projectfedena/projectfedena_v2.0
test/unit/student_test.rb
Ruby
apache-2.0
95
master
3,468
require File.expand_path(File.dirname(__FILE__) + './../test_helper') class StudentTest < ActiveSupport::TestCase should_belong_to :batch should_belong_to :student_category should_belong_to :country should_belong_to :nationality should_have_many :guardians should_have_many :finance_transactions context...
github
projectfedena/projectfedena_v2.0
https://github.com/projectfedena/projectfedena_v2.0
test/unit/course_test.rb
Ruby
apache-2.0
95
master
361
require File.expand_path(File.dirname(__FILE__) + './../test_helper') class CourseTest < ActiveSupport::TestCase should_validate_presence_of :course_name should_have_many :batches # context 'a new course' do # setup do # @course = Factory.build(:course) # @batch = Factory.build(:batch) # @cour...
github
projectfedena/projectfedena_v2.0
https://github.com/projectfedena/projectfedena_v2.0
test/unit/user_test.rb
Ruby
apache-2.0
95
master
4,306
require File.expand_path(File.dirname(__FILE__) + './../test_helper') class UserTest < ActiveSupport::TestCase should_validate_presence_of :email should_validate_presence_of :role context 'a new user' do setup do @user = Factory.build(:admin_user) end should 'be new record' do assert @...
github
projectfedena/projectfedena_v2.0
https://github.com/projectfedena/projectfedena_v2.0
test/unit/batch_test.rb
Ruby
apache-2.0
95
master
590
require File.expand_path(File.dirname(__FILE__) + './../test_helper') class BatchTest < ActiveSupport::TestCase should_have_many :students should_have_many :exam_groups should_belong_to :course should_validate_presence_of :name should_validate_presence_of :start_date should_validate_presence_of :end_date ...
github
projectfedena/projectfedena_v2.0
https://github.com/projectfedena/projectfedena_v2.0
test/unit/news_comment_test.rb
Ruby
apache-2.0
95
master
294
require File.expand_path(File.dirname(__FILE__) + './../test_helper') class NewsCommentTest < ActiveSupport::TestCase should_validate_presence_of :author should_validate_presence_of :content should_validate_presence_of :news_id should_belong_to :news should_belong_to :author end
github
projectfedena/projectfedena_v2.0
https://github.com/projectfedena/projectfedena_v2.0
test/unit/exam_test.rb
Ruby
apache-2.0
95
master
1,585
require File.expand_path(File.dirname(__FILE__) + './../test_helper') class ExamTest < ActiveSupport::TestCase fixtures :users should_belong_to :exam_group should_belong_to :subject context 'a new exam record' do setup do @exam = Factory.build(:exam) @exam_group = Factory.create(:exam_group, ...
github
projectfedena/projectfedena_v2.0
https://github.com/projectfedena/projectfedena_v2.0
test/functional/exam_groups_controller_test.rb
Ruby
apache-2.0
95
master
1,147
require File.expand_path(File.dirname(__FILE__) + '/../test_helper') class ExamGroupsControllerTest < ActionController::TestCase fixtures :users context 'with admin logged in' do setup do @controller = ExamGroupsController.new @request = ActionController::TestRequest.new @response = ActionCo...
github
projectfedena/projectfedena_v2.0
https://github.com/projectfedena/projectfedena_v2.0
test/functional/user_controller_test.rb
Ruby
apache-2.0
95
master
457
require File.expand_path(File.dirname(__FILE__) + './../test_helper') class UserControllerTest < ActionController::TestCase fixtures :batches, :courses, :users setup do @controller = UserController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new @req...
github
projectfedena/projectfedena_v2.0
https://github.com/projectfedena/projectfedena_v2.0
spec/spec_helper.rb
Ruby
apache-2.0
95
master
1,986
# This file is copied to ~/spec when you run 'ruby script/generate rspec' # from the project root directory. ENV["RAILS_ENV"] ||= 'test' require File.expand_path(File.join(File.dirname(__FILE__),'..','config','environment')) require 'spec/autorun' require 'spec/rails' # Uncomment the next line to use webrat's matchers...
github
projectfedena/projectfedena_v2.0
https://github.com/projectfedena/projectfedena_v2.0
spec/routing/exams_routing_spec.rb
Ruby
apache-2.0
95
master
1,463
require 'spec_helper' describe ExamsController do describe "routing" do it "recognizes and generates #index" do { :get => "/exam_groups/1/exams" }.should \ route_to(:controller => "exams", :action => "index", :exam_group_id => "1") end it "recognizes and generates #new" do { :get =>...
github
projectfedena/projectfedena_v2.0
https://github.com/projectfedena/projectfedena_v2.0
spec/routing/exam_groups_routing_spec.rb
Ruby
apache-2.0
95
master
1,488
require 'spec_helper' describe ExamGroupsController do describe "routing" do it "recognizes and generates #index" do { :get => "/batches/1/exam_groups" }.should \ route_to(:controller => "exam_groups", :action => "index", :batch_id => "1") end it "recognizes and generates #new" do { ...
github
projectfedena/projectfedena_v2.0
https://github.com/projectfedena/projectfedena_v2.0
spec/routing/elective_groups_routing_spec.rb
Ruby
apache-2.0
95
master
1,506
require 'spec_helper' describe ElectiveGroupsController do describe "routing" do it "recognizes and generates #index" do { :get => "/batches/1/electives" }.should \ route_to(:controller => "elective_groups", :action => "index", :batch_id => "1") end it "recognizes and generates #new" do ...
github
projectfedena/projectfedena_v2.0
https://github.com/projectfedena/projectfedena_v2.0
spec/controllers/elective_groups_controller_spec.rb
Ruby
apache-2.0
95
master
230
require 'spec_helper' describe ElectiveGroupsController do #Delete this example and add some real ones it "should use ElectiveGroupsController" do controller.should be_an_instance_of(ElectiveGroupsController) end end
github
projectfedena/projectfedena_v2.0
https://github.com/projectfedena/projectfedena_v2.0
spec/controllers/exams_controller_spec.rb
Ruby
apache-2.0
95
master
4,185
require 'spec_helper' describe ExamsController do before(:each) do @exam_group = Factory.create(:exam_group, :id => 1) end def mock_exam(stubs={}) @mock_exam ||= mock_model(Exam, stubs) end describe "GET index" do # There is no index action # it "assigns all exams as @exams" do # Exam.stu...
github
projectfedena/projectfedena_v2.0
https://github.com/projectfedena/projectfedena_v2.0
spec/controllers/exam_groups_controller_spec.rb
Ruby
apache-2.0
95
master
4,696
require 'spec_helper' describe ExamGroupsController do before(:each) do @batch = Factory.create(:batch, :id => 1) end def mock_exam_group(stubs={}) @mock_exam_group ||= mock_model(ExamGroup, stubs) end describe "GET index" do it "assigns all exam_groups as @exam_groups" do ExamGroup.stub...
github
projectfedena/projectfedena_v2.0
https://github.com/projectfedena/projectfedena_v2.0
spec/views/exam_groups/index.html.erb_spec.rb
Ruby
apache-2.0
95
master
246
require 'spec_helper' describe "/exam_groups/index.html.erb" do before(:each) do assigns[:exam_groups] = [ stub_model(ExamGroup), stub_model(ExamGroup) ] end it "renders a list of exam_groups" do render end end
github
projectfedena/projectfedena_v2.0
https://github.com/projectfedena/projectfedena_v2.0
spec/views/exam_groups/edit.html.erb_spec.rb
Ruby
apache-2.0
95
master
355
require 'spec_helper' describe "/exam_groups/edit.html.erb" do before(:each) do assigns[:exam_groups] = @exam_group = stub_model(ExamGroup, :new_record? => false ) end it "renders the edit exam_group form" do render response.should have_tag("form[action=#{exam_group_path(@exam_group)}][m...
github
projectfedena/projectfedena_v2.0
https://github.com/projectfedena/projectfedena_v2.0
spec/views/exam_groups/new.html.erb_spec.rb
Ruby
apache-2.0
95
master
320
require 'spec_helper' describe "/exam_groups/new.html.erb" do before(:each) do assigns[:test_model] = stub_model(ExamGroup, :new_record? => true ) end it "renders new test_model form" do render response.should have_tag("form[action=?][method=post]", exam_groups_path) do end end end
github
projectfedena/projectfedena_v2.0
https://github.com/projectfedena/projectfedena_v2.0
spec/views/exam_groups/show.html.erb_spec.rb
Ruby
apache-2.0
95
master
210
require 'spec_helper' describe "/exam_groups/show.html.erb" do before(:each) do assigns[:exam_group] = @exam_group = stub_model(ExamGroup) end it "renders attributes in <p>" do render end end
github
projectfedena/projectfedena_v2.0
https://github.com/projectfedena/projectfedena_v2.0
spec/models/exam_score_spec.rb
Ruby
apache-2.0
95
master
223
require 'spec_helper' describe ExamScore do before(:each) do @valid_attributes = { } end it "should create a new instance given valid attributes" do ExamScore.create!(@valid_attributes) end end
github
projectfedena/projectfedena_v2.0
https://github.com/projectfedena/projectfedena_v2.0
spec/models/elective_group_spec.rb
Ruby
apache-2.0
95
master
231
require 'spec_helper' describe ElectiveGroup do before(:each) do @valid_attributes = { } end it "should create a new instance given valid attributes" do ElectiveGroup.create!(@valid_attributes) end end
github
projectfedena/projectfedena_v2.0
https://github.com/projectfedena/projectfedena_v2.0
spec/models/exam_group_spec.rb
Ruby
apache-2.0
95
master
243
require 'spec_helper' describe ExamGroup do before(:each) do @valid_attributes = Factory.attributes_for :exam_group end it "should create a new instance given valid attributes" do ExamGroup.create!(@valid_attributes) end end
github
projectfedena/projectfedena_v2.0
https://github.com/projectfedena/projectfedena_v2.0
app/models/exam_score.rb
Ruby
apache-2.0
95
master
2,510
class ExamScore < ActiveRecord::Base belongs_to :student belongs_to :exam belongs_to :grading_level before_save :calculate_grade def calculate_percentage percentage = self.marks.to_i * 100 / self.exam.maximum_marks end def grouped_exam_subject_total(subject,student,type,batch = "") if batch == ...
github
projectfedena/projectfedena_v2.0
https://github.com/projectfedena/projectfedena_v2.0
app/models/guardian.rb
Ruby
apache-2.0
95
master
646
class Guardian < ActiveRecord::Base belongs_to :country belongs_to :ward, :class_name => 'Student' validates_presence_of :first_name, :relation def validate errors.add(:dob, "cannot be a future date.") if self.dob > Date.today unless self.dob.nil? end def is_immediate_contact? ward.immediate_cont...
github
projectfedena/projectfedena_v2.0
https://github.com/projectfedena/projectfedena_v2.0
app/models/batch.rb
Ruby
apache-2.0
95
master
1,774
class Batch < ActiveRecord::Base belongs_to :course has_many :students has_many :archived_students has_many :grading_levels, :conditions => { :is_deleted => false } has_many :subjects, :conditions => { :is_deleted => false } has_many :exam_groups has_many :fee_category , :class_name => "FinanceFeeCategor...
github
projectfedena/projectfedena_v2.0
https://github.com/projectfedena/projectfedena_v2.0
app/models/student_additional_field.rb
Ruby
apache-2.0
95
master
204
class StudentAdditionalField < ActiveRecord::Base belongs_to :student belongs_to :student_additional_details validates_presence_of :name validates_uniqueness_of :name,:case_sensitive => false end
github
projectfedena/projectfedena_v2.0
https://github.com/projectfedena/projectfedena_v2.0
app/models/grading_level.rb
Ruby
apache-2.0
95
master
1,030
class GradingLevel < ActiveRecord::Base belongs_to :batch validates_presence_of :name, :min_score validates_uniqueness_of :name, :scope => [:batch_id, :is_deleted],:case_sensitive => false default_scope :order => 'min_score desc' named_scope :default, :conditions => { :batch_id => nil, :is_deleted => fal...