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
scotdalton/exlibris-primo
https://github.com/scotdalton/exlibris-primo
test/web_service/response/error_test.rb
Ruby
mit
18
master
1,156
module WebService module Response require 'test_helper' class ErrorTest < Test::Unit::TestCase def setup @base_url = "http://bobcatdev.library.nyu.edu" @isbn = "0143039008" @user_id = "N12162279" @institution = "NYU" @doc_id = "nyu_aleph000062856" @dedupmg...
github
scotdalton/exlibris-primo
https://github.com/scotdalton/exlibris-primo
test/web_service/response/search_stats_test.rb
Ruby
mit
18
master
2,999
module WebService module Response require 'test_helper' class SearchStatsTest < Test::Unit::TestCase def setup @base_url = "http://bobcatdev.library.nyu.edu" @isbn = "0143039008" @user_id = "N12162279" @institution = "NYU" @doc_id = "nyu_aleph000062856" @d...
github
scotdalton/exlibris-primo
https://github.com/scotdalton/exlibris-primo
test/web_service/response/eshelf_test.rb
Ruby
mit
18
master
949
module WebService module Response require 'test_helper' class EshelfTest < Test::Unit::TestCase def setup @base_url = "http://bobcatdev.library.nyu.edu" @isbn = "0143039008" @user_id = "N12162279" @institution = "NYU" @doc_id = "nyu_aleph000062856" @dedupm...
github
scotdalton/exlibris-primo
https://github.com/scotdalton/exlibris-primo
test/web_service/response/reviews_test.rb
Ruby
mit
18
master
956
module WebService module Response require 'test_helper' class ReviewsTest < Test::Unit::TestCase def setup @base_url = "http://bobcatdev.library.nyu.edu" @isbn = "0143039008" @user_id = "N12162279" @institution = "NYU" @doc_id = "nyu_aleph000062856" @dedup...
github
scotdalton/exlibris-primo
https://github.com/scotdalton/exlibris-primo
test/web_service/response/facets_test.rb
Ruby
mit
18
master
1,608
module WebService module Response require 'test_helper' class FacetsTest < Test::Unit::TestCase def setup @base_url = "http://bobcatdev.library.nyu.edu" @isbn = "0143039008" @user_id = "N12162279" @institution = "NYU" @doc_id = "nyu_aleph000062856" @dedupm...
github
scotdalton/exlibris-primo
https://github.com/scotdalton/exlibris-primo
test/web_service/response/abstract_test.rb
Ruby
mit
18
master
11,661
module WebService module Response require 'test_helper' class AbstractTest < Test::Unit::TestCase def setup @base_url = "http://bobcatdev.library.nyu.edu" @isbn = "0143039008" @user_id = "N12162279" @institution = "NYU" @doc_id = "nyu_aleph000062856" @dedu...
github
scotdalton/exlibris-primo
https://github.com/scotdalton/exlibris-primo
test/web_service/response/tags_test.rb
Ruby
mit
18
master
935
module WebService module Response require 'test_helper' class TagsTest < Test::Unit::TestCase def setup @base_url = "http://bobcatdev.library.nyu.edu" @isbn = "0143039008" @user_id = "N12162279" @institution = "NYU" @doc_id = "nyu_aleph000062856" @dedupmgr...
github
scotdalton/exlibris-primo
https://github.com/scotdalton/exlibris-primo
test/web_service/response/did_u_mean_test.rb
Ruby
mit
18
master
1,784
module WebService module Response require 'test_helper' class DidUMeanTest < Test::Unit::TestCase def setup @base_url = "http://bobcatdev.library.nyu.edu" @isbn = "0143039008" @user_id = "N12162279" @institution = "NYU" @doc_id = "nyu_aleph000062856" @dedu...
github
scotdalton/exlibris-primo
https://github.com/scotdalton/exlibris-primo
test/web_service/client/reviews_test.rb
Ruby
mit
18
master
1,436
module WebService module Client require 'test_helper' class ReviewsTest < Test::Unit::TestCase def setup @base_url = "http://bobcatdev.library.nyu.edu" @doc_id = "nyu_aleph000062856" @user_id = "N12162279" @institution = "NYU" end def test_get_reviews ...
github
scotdalton/exlibris-primo
https://github.com/scotdalton/exlibris-primo
test/web_service/client/tags_test.rb
Ruby
mit
18
master
1,397
module WebService module Client require 'test_helper' class TagsTest < Test::Unit::TestCase def setup @base_url = "http://bobcatdev.library.nyu.edu" @doc_id = "nyu_aleph000062856" @user_id = "N12162279" @institution = "NYU" end def test_get_tags asser...
github
scotdalton/exlibris-primo
https://github.com/scotdalton/exlibris-primo
test/web_service/client/soap_actions_test.rb
Ruby
mit
18
master
1,422
module WebService module Client require 'test_helper' class SoapActionsTest < Test::Unit::TestCase def setup @base_url = "http://bobcatdev.library.nyu.edu" end def test_respond_to VCR.use_cassette('client nonexistent method') do client = Exlibris::Primo::WebService...
github
scotdalton/exlibris-primo
https://github.com/scotdalton/exlibris-primo
test/web_service/client/abstract_test.rb
Ruby
mit
18
master
915
module WebService module Client require 'test_helper' class AbstractTest < Test::Unit::TestCase def setup @base_url = "http://bobcatdev.library.nyu.edu" @user_id = "N12162279" @institution = "NYU" @doc_id = "nyu_aleph000062856" @dedupmgr_id = "dedupmrg17343091" ...
github
scotdalton/exlibris-primo
https://github.com/scotdalton/exlibris-primo
test/web_service/client/search_test.rb
Ruby
mit
18
master
2,961
module WebService module Client require 'test_helper' class SearchTest < Test::Unit::TestCase def setup @base_url = "http://bobcatdev.library.nyu.edu" @doc_id = "nyu_aleph000062856" @isbn = "0143039008" @issn = "0090-5720" @title = "Travels with My Aunt" @...
github
scotdalton/exlibris-primo
https://github.com/scotdalton/exlibris-primo
test/web_service/client/search_benchmarks.rb
Ruby
mit
18
master
1,355
module WebService module Client require 'test_helper' class SearchBenchmarks < Test::Unit::TestCase def setup @base_url = "http://bobcatdev.library.nyu.edu" @doc_id = "nyu_aleph000062856" @isbn = "0143039008" @issn = "0090-5720" @title = "Travels with My Aunt" ...
github
scotdalton/exlibris-primo
https://github.com/scotdalton/exlibris-primo
test/web_service/client/eshelf_test.rb
Ruby
mit
18
master
830
module WebService module Client require 'test_helper' class EshelfTest < Test::Unit::TestCase def setup @base_url = "http://bobcatdev.library.nyu.edu" @doc_id = "nyu_aleph000062856" @user_id = "N12162279" @institution = "NYU" end def test_get_eshelf a...
github
scotdalton/exlibris-primo
https://github.com/scotdalton/exlibris-primo
test/web_service/client/savon_client_test.rb
Ruby
mit
18
master
482
module WebService module Client require 'test_helper' class SavonClientTest < Test::Unit::TestCase def setup @base_url = "http://bobcatdev.library.nyu.edu" end def test_nonexistent_soap_action VCR.use_cassette('client nonexistent soap action') do client = Exlibris:...
github
scotdalton/exlibris-primo
https://github.com/scotdalton/exlibris-primo
test/pnx/elements_test.rb
Ruby
mit
18
master
599
module Pnx require 'test_helper' class ElementsTest < Test::Unit::TestCase def test_elements record = Exlibris::Primo::Record.new(:raw_xml => record_xml) assert record.respond_to? :display_title assert record.respond_to? :recordid assert record.respond_to? :all_search_isbn assert_e...
github
scotdalton/exlibris-primo
https://github.com/scotdalton/exlibris-primo
test/pnx/dedup_mgr_test.rb
Ruby
mit
18
master
550
module Pnx require 'test_helper' class DedupMgrTest < Test::Unit::TestCase def test_dedupmrg record = Exlibris::Primo::Record.new(:raw_xml => dedupmgr_record_xml) assert record.respond_to? :display_title assert record.respond_to? :recordid assert_equal "The New York times", record.displa...
github
scotdalton/exlibris-primo
https://github.com/scotdalton/exlibris-primo
test/pnx/links_test.rb
Ruby
mit
18
master
2,857
module Pnx require 'test_helper' class LinksTest < Test::Unit::TestCase def test_fulltexts record = Exlibris::Primo::Record.new(:raw_xml => dedupmgr_record_xml) assert_not_nil record.fulltexts assert((not record.fulltexts.empty?)) assert_not_nil(record.fulltexts.first.institution) ...
github
scotdalton/exlibris-primo
https://github.com/scotdalton/exlibris-primo
test/pnx/holdings_test.rb
Ruby
mit
18
master
3,076
module Pnx require 'test_helper' class HoldingsTest < Test::Unit::TestCase def test_load_other_holdings reset_primo_configuration record = Exlibris::Primo::Record.new(:raw_xml => record_other_source_xml) holdings = record.holdings.collect { | h | } assert record.respond_to? :display_titl...
github
scotdalton/exlibris-primo
https://github.com/scotdalton/exlibris-primo
test/pnx/frbr_test.rb
Ruby
mit
18
master
548
module Pnx require 'test_helper' class FrbrTest < Test::Unit::TestCase def test_frbr record = Exlibris::Primo::Record.new(:raw_xml => record_xml) assert record.frbr? assert_not_nil record.frbr_id assert((not record.frbr_id.blank?)) assert_equal "49340863", record.frbr_id end ...
github
scotdalton/exlibris-primo
https://github.com/scotdalton/exlibris-primo
test/pnx/openurl_test.rb
Ruby
mit
18
master
261
module Pnx require 'test_helper' class OpenurlTest < Test::Unit::TestCase def test_openurl record = Exlibris::Primo::Record.new(:raw_xml => record_xml) assert_not_nil record.openurl assert((not record.openurl.blank?)) end end end
github
svileng/announcements
https://github.com/svileng/announcements
announcements.gemspec
Ruby
mit
18
master
940
# -*- encoding: utf-8 -*- $:.push File.expand_path("../lib", __FILE__) require "announcements/version" Gem::Specification.new do |s| s.name = "announcements" s.version = Announcements::VERSION s.authors = ["Svilen Gospodinov", "and others"] s.email = "svilen.gospodinov@gmail.com" s.homep...
github
svileng/announcements
https://github.com/svileng/announcements
lib/announcements/announcements_helper.rb
Ruby
mit
18
master
1,787
module AnnouncementsHelper # Outputs given announcement in HTML (with optional twitter bootstrap style). # # Basic usage: <%= announce Announcement.newest %> # Alt usage: <%= announce Announcement.newest, :format => "boostrap" %> # # Options: # div_class -- name for a custom div class, which wraps the an...
github
svileng/announcements
https://github.com/svileng/announcements
lib/generators/announcements/install/install_generator.rb
Ruby
mit
18
master
963
module Announcements class InstallGenerator < Rails::Generators::Base desc "Installs the Announcement gem" source_root File.expand_path('../templates', __FILE__) def create_model say "--- Creating model in app/models..." template "announcement.rb", "app/models/announcement.rb" say "--- Creating t...
github
svileng/announcements
https://github.com/svileng/announcements
lib/generators/announcements/install/templates/announcement.rb
Ruby
mit
18
master
318
class Announcement < ActiveRecord::Base validates_presence_of :body def self.newest Announcement.last end def self.newest_private Announcement.where("type is null").order("id desc").first end def self.newest_public Announcement.where("type = 'public'").order("id desc").first end end
github
svileng/announcements
https://github.com/svileng/announcements
spec/announcements/announcements_helper_spec.rb
Ruby
mit
18
master
1,329
require 'spec_helper' include ActionView::Context include ActionView::Helpers include AnnouncementsHelper describe AnnouncementsHelper do before do @announcement = Announcement.new @announcement.id = 1 @announcement.body = "announcement text" @mocked_cookies = Hash.new stub!(:cookies).and_r...
github
nmeans/minitest-profile
https://github.com/nmeans/minitest-profile
minitest-profile.gemspec
Ruby
mit
18
master
1,023
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'minitest/profile_plugin' Gem::Specification.new do |spec| spec.name = "minitest-profile" spec.version = Minitest::ProfileReporter::VERSION spec.authors = ["Nickolas Mea...
github
nmeans/minitest-profile
https://github.com/nmeans/minitest-profile
test/test_minitest_profile.rb
Ruby
mit
18
master
288
require 'minitest' require 'minitest/autorun' $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require 'minitest/profile' describe 'a random smattering of tests' do 50.times do |i| it "will take #{i/1000.0}ms" do sleep(i/1000.0) assert true end end end
github
nmeans/minitest-profile
https://github.com/nmeans/minitest-profile
lib/minitest/profile_plugin.rb
Ruby
mit
18
master
950
require 'minitest' module Minitest def self.plugin_profile_options(opts, options) opts.on("--profile", "Display list of slowest tests") do |p| options[:profile] = true end end def self.plugin_profile_init(options) self.reporter << ProfileReporter.new(options) if options[:profile] end cla...
github
leonardoscorza/stack_helper
https://github.com/leonardoscorza/stack_helper
Gemfile
Ruby
mit
18
master
2,696
source 'https://rubygems.org' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 5.0.0', '>= 5.0.0.1' # Use Puma as the app server gem 'puma', '~> 3.0' # Use SCSS for stylesheets gem 'sass-rails', '~> 5.0' # Use Uglifier as compressor for JavaScript assets gem 'uglifier', '>= 1.3.0' # Use...
github
leonardoscorza/stack_helper
https://github.com/leonardoscorza/stack_helper
Guardfile
Ruby
mit
18
master
2,438
# A sample Guardfile # More info at https://github.com/guard/guard#readme ## Uncomment and set this to only include directories you want to watch # directories %w(app lib config test spec features) \ # .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")} ## Note: if you are using the `direct...
github
leonardoscorza/stack_helper
https://github.com/leonardoscorza/stack_helper
db/schema.rb
Ruby
mit
18
master
3,672
# This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # Note that this schema.rb definition is the authoritative source for your # dat...
github
leonardoscorza/stack_helper
https://github.com/leonardoscorza/stack_helper
db/migrate/20161006193925_create_questions.rb
Ruby
mit
18
master
205
class CreateQuestions < ActiveRecord::Migration[5.0] def change create_table :questions do |t| t.integer :user_id t.string :title t.text :text t.timestamps end end end
github
leonardoscorza/stack_helper
https://github.com/leonardoscorza/stack_helper
db/migrate/20161008202846_create_questions_hashtags.rb
Ruby
mit
18
master
271
class CreateQuestionsHashtags < ActiveRecord::Migration[5.0] def change create_table :questions_hashtags, :id => false do |t| t.references :question, index: true, foreign_key: true t.references :hashtag, index: true, foreign_key: true end end end
github
leonardoscorza/stack_helper
https://github.com/leonardoscorza/stack_helper
db/migrate/20161005232534_create_hashtags.rb
Ruby
mit
18
master
212
class CreateHashtags < ActiveRecord::Migration[5.0] def change create_table :hashtags do |t| t.string :text t.integer :question_id t.integer :user_id t.timestamps end end end
github
leonardoscorza/stack_helper
https://github.com/leonardoscorza/stack_helper
db/migrate/20161009151146_acts_as_votable_migration.rb
Ruby
mit
18
master
642
class ActsAsVotableMigration < ActiveRecord::Migration def self.up create_table :votes do |t| t.references :votable, :polymorphic => true t.references :voter, :polymorphic => true t.boolean :vote_flag t.string :vote_scope t.integer :vote_weight t.timestamps end if A...
github
leonardoscorza/stack_helper
https://github.com/leonardoscorza/stack_helper
db/migrate/20161005232517_create_answers.rb
Ruby
mit
18
master
278
class CreateAnswers < ActiveRecord::Migration[5.0] def change create_table :answers do |t| t.integer :question_id t.integer :user_id t.text :text t.integer :answer_father_id t.boolean :user_mark_as_right t.timestamps end end end
github
leonardoscorza/stack_helper
https://github.com/leonardoscorza/stack_helper
db/migrate/20161005234110_add_devise_to_users.rb
Ruby
mit
18
master
1,715
class AddDeviseToUsers < ActiveRecord::Migration[5.0] def self.up change_table :users do |t| ## Database authenticatable t.string :email, null: false, default: "" t.string :encrypted_password, null: false, default: "" ## Recoverable t.string :reset_password_token ...
github
leonardoscorza/stack_helper
https://github.com/leonardoscorza/stack_helper
db/migrate/20161005232526_create_notifications.rb
Ruby
mit
18
master
227
class CreateNotifications < ActiveRecord::Migration[5.0] def change create_table :notifications do |t| t.integer :hashtag_id t.integer :user_id t.integer :frequency t.timestamps end end end
github
leonardoscorza/stack_helper
https://github.com/leonardoscorza/stack_helper
db/migrate/20161008204158_remove_question_id_from_hashtags.rb
Ruby
mit
18
master
204
class RemoveQuestionIdFromHashtags < ActiveRecord::Migration[5.0] def up remove_column :hashtags, :question_id, :integer end def down add_column :hashtags, :question_id, :integer end end
github
leonardoscorza/stack_helper
https://github.com/leonardoscorza/stack_helper
db/migrate/20161008221741_rename_questions_hashtags.rb
Ruby
mit
18
master
223
class RenameQuestionsHashtags < ActiveRecord::Migration[5.0] def self.up rename_table :questions_hashtags, :hashtags_questions end def self.down rename_table :hashtags_questions, :questions_hashtags end end
github
leonardoscorza/stack_helper
https://github.com/leonardoscorza/stack_helper
config/application.rb
Ruby
mit
18
master
684
require_relative 'boot' require 'rails/all' # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) module SocialStack class Application < Rails::Application config.i18n.default_locale = "pt-BR" # Settings in config/env...
github
leonardoscorza/stack_helper
https://github.com/leonardoscorza/stack_helper
config/routes.rb
Ruby
mit
18
master
393
Rails.application.routes.draw do mount RailsAdmin::Engine => '/admin', as: 'rails_admin' devise_for :users, :controllers => { :omniauth_callbacks => "callbacks" } resources :questions resources :answers, only: [:create] resources :users, only: [:show] root to: 'home#index' get 'about' => 'home#about', a...
github
leonardoscorza/stack_helper
https://github.com/leonardoscorza/stack_helper
config/initializers/rails_admin.rb
Ruby
mit
18
master
1,112
RailsAdmin.config do |config| ### Popular gems integration ## == Devise == config.authenticate_with do warden.authenticate! scope: :user end config.current_user_method(&:current_user) config.authorize_with do unless current_user.admin == true flash[:alert] = "Acesso disponível apenas para ...
github
leonardoscorza/stack_helper
https://github.com/leonardoscorza/stack_helper
config/initializers/devise.rb
Ruby
mit
18
master
13,603
# Use this hook to configure devise mailer, warden hooks and so forth. # Many of these configuration options can be set straight in your model. Devise.setup do |config| config.omniauth :facebook, ENV['FACEBOOK_APP_ID'], ENV['FACEBOOK_APP_SECRET'], scope: "email" # The secret key used by Devise. Devise uses this ke...
github
leonardoscorza/stack_helper
https://github.com/leonardoscorza/stack_helper
config/environments/development.rb
Ruby
mit
18
master
1,908
Rails.application.configure do # Keys Social Register # Settings specified here will take precedence over those in config/application.rb. # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't ha...
github
leonardoscorza/stack_helper
https://github.com/leonardoscorza/stack_helper
config/environments/production.rb
Ruby
mit
18
master
3,784
Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. config.cache_classes = true # Eager load code on boot. This eager loads most of Rails and # your application in memory, allowing both threaded web serve...
github
leonardoscorza/stack_helper
https://github.com/leonardoscorza/stack_helper
app/models/question.rb
Ruby
mit
18
master
822
class Question < ApplicationRecord belongs_to :user validates :user_id, :title, :text, :tag_body, presence: true has_and_belongs_to_many :hashtags has_many :answers, dependent: :destroy def self.search(search) if search where("title LIKE :search OR text LIKE :search OR tag_body LIKE :search ", search: "%#{se...
github
leonardoscorza/stack_helper
https://github.com/leonardoscorza/stack_helper
app/models/user.rb
Ruby
mit
18
master
1,061
class User < ApplicationRecord # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :omniauthable acts_as_voter has_many :notifications ...
github
leonardoscorza/stack_helper
https://github.com/leonardoscorza/stack_helper
app/controllers/application_controller.rb
Ruby
mit
18
master
448
class ApplicationController < ActionController::Base protect_from_forgery with: :exception before_action :configure_permitted_parameters, if: :devise_controller? protected def configure_permitted_parameters devise_parameter_sanitizer.permit(:sign_up) { |u| u.permit(:name, :email, :password) } devis...
github
leonardoscorza/stack_helper
https://github.com/leonardoscorza/stack_helper
app/controllers/answers_controller.rb
Ruby
mit
18
master
641
class AnswersController < ApplicationController before_action :get_answer, only: [:update, :destroy] before_action :authenticate_user!, only: [:create, :update, :destroy] def create answer = current_user.answers.build(answer_params) if answer.save ActionCable.server.broadcast 'answers', ans...
github
leonardoscorza/stack_helper
https://github.com/leonardoscorza/stack_helper
app/controllers/callbacks_controller.rb
Ruby
mit
18
master
340
class CallbacksController < Devise::OmniauthCallbacksController def facebook @user = User.from_omniauth(request.env["omniauth.auth"]) if @user.persisted? sign_in_and_redirect @user, :event => :authentication else redirect_to new_user_registration_url end end def failure redirect_to ...
github
leonardoscorza/stack_helper
https://github.com/leonardoscorza/stack_helper
app/controllers/questions_controller.rb
Ruby
mit
18
master
1,151
class QuestionsController < ApplicationController before_action :get_question, only: [:show, :edit, :update, :destroy] before_action :authenticate_user!, only: [:create, :edit, :update, :destroy, :new] def index @questions = Question.search(params[:search]) end def new @question = Question.new end...
github
leonardoscorza/stack_helper
https://github.com/leonardoscorza/stack_helper
app/helpers/application_helper.rb
Ruby
mit
18
master
615
module ApplicationHelper # Get title tag content def title(title) full_title = "StackHelper" if title.empty? full_title else "#{title} - #{full_title}" end end # Get desciption to meta description tags def description(meta_description) if meta_description.empty? "O Stack...
github
leonardoscorza/stack_helper
https://github.com/leonardoscorza/stack_helper
app/helpers/devise_helper.rb
Ruby
mit
18
master
575
module DeviseHelper def devise_error_messages! return '' if resource.errors.empty? messages = resource.errors.full_messages.map { |msg| content_tag(:li, msg) }.join sentence = I18n.t('errors.messages.not_saved', count: resource.errors.count, resource: resource.class.model_name.human.downcase)...
github
leonardoscorza/stack_helper
https://github.com/leonardoscorza/stack_helper
app/helpers/questions_helper.rb
Ruby
mit
18
master
206
module QuestionsHelper def first_tag(question) Hashtag.find(@question.hashtag_ids.first).name end def truncate_question_text(text) truncate(text, :length => 200, :separator => ' ') end end
github
leonardoscorza/stack_helper
https://github.com/leonardoscorza/stack_helper
app/channels/answers_channel.rb
Ruby
mit
18
master
308
# Be sure to restart your server when you modify this file. Action Cable runs in a loop that does not support auto reloading. class AnswersChannel < ApplicationCable::Channel def subscribed stream_from "answers" end def unsubscribed # Any cleanup needed when channel is unsubscribed end end
github
leonardoscorza/stack_helper
https://github.com/leonardoscorza/stack_helper
spec/rails_helper.rb
Ruby
mit
18
master
3,120
# This file is copied to spec/ when you run 'rails generate rspec:install' ENV['RAILS_ENV'] ||= 'test' require File.expand_path('../../config/environment', __FILE__) # Prevent database truncation if the environment is production abort("The Rails environment is running in production mode!") if Rails.env.production? requ...
github
leonardoscorza/stack_helper
https://github.com/leonardoscorza/stack_helper
spec/controllers/questions_controller_spec.rb
Ruby
mit
18
master
5,541
require 'rails_helper' describe QuestionsController, type: :controller do describe "GET #index" do before { get :index } it "renders :index view" do expect(response).to render_template(:index) end it "assigns the requested object to @questions" do expect(assigns(:questions)).to eq(Quest...
github
leonardoscorza/stack_helper
https://github.com/leonardoscorza/stack_helper
spec/controllers/users_controller_spec.rb
Ruby
mit
18
master
384
require 'rails_helper' RSpec.describe UsersController, type: :controller do describe "GET #show" do let(:user) { create(:user) } before { get :show, params: { id: user } } it "renders :show view" do expect(response).to render_template(:show) end it "assigns the requested object to @user"...
github
leonardoscorza/stack_helper
https://github.com/leonardoscorza/stack_helper
spec/controllers/answers_controller_spec.rb
Ruby
mit
18
master
267
require 'rails_helper' RSpec.describe AnswersController, type: :controller do before(:each) do @question = FactoryGirl.create(:question) end describe "POST #create" do end describe "PUT #update" do end describe "DELETE #destroy" do end end
github
leonardoscorza/stack_helper
https://github.com/leonardoscorza/stack_helper
spec/views/questions/show_spec.rb
Ruby
mit
18
master
968
require 'rails_helper' describe "questions/show.html.erb", type: :view do # question must be created (instead builded) because the hashtags are used # in show view, and they are created only when the question is saved. let(:question) { create(:question) } before do assign(:question, question) assign(:u...
github
leonardoscorza/stack_helper
https://github.com/leonardoscorza/stack_helper
spec/views/home/index_spec.rb
Ruby
mit
18
master
774
require 'rails_helper' describe "home/index.html.erb", type: :view do before do assign(:questions, [create(:question)]) render template: "home/index", layout: "layouts/application" end describe "Title tag" do it "displays 'project name'" do expect(rendered).to have_title("StackHelper") end...
github
leonardoscorza/stack_helper
https://github.com/leonardoscorza/stack_helper
spec/views/users/show_spec.rb
Ruby
mit
18
master
649
require 'rails_helper' describe "users/show.html.erb", type: :view do before do assign(:user, build(:user)) render template: "users/show", layout: "layouts/application" end describe "Title tag" do it "displays 'user name - project name'" do expect(rendered).to have_title("Usuário User - StackH...
github
leonardoscorza/stack_helper
https://github.com/leonardoscorza/stack_helper
spec/features/visit_admin_dashboard_spec.rb
Ruby
mit
18
master
557
require 'rails_helper' describe "Visit admin dashboard", type: :feature do subject { visit rails_admin.dashboard_path } context "whit a non admin user" do before do login_as create(:user) subject end it "redirects to root_path" do expect(page).to have_current_path(root_path) end...
github
leonardoscorza/stack_helper
https://github.com/leonardoscorza/stack_helper
spec/models/answer_spec.rb
Ruby
mit
18
master
670
require 'rails_helper' RSpec.describe Answer, type: :model do subject { Answer.new(question_id: 1, user_id: 1, text: "Some text") } describe '#validations' do it 'is valid with valid attributes' do expect(subject).to be_valid end it 'is not valid without an text' do subject.text = nil expect(subje...
github
leonardoscorza/stack_helper
https://github.com/leonardoscorza/stack_helper
spec/models/notification_spec.rb
Ruby
mit
18
master
240
require 'rails_helper' RSpec.describe Notification, type: :model do describe '#associations' do it 'belongs to a user' do assc = Notification.reflect_on_association(:user) expect(assc.macro).to eq(:belongs_to) end end end
github
leonardoscorza/stack_helper
https://github.com/leonardoscorza/stack_helper
spec/models/hashtag_spec.rb
Ruby
mit
18
master
520
require 'rails_helper' RSpec.describe Hashtag, type: :model do subject { Hashtag.new(name: "rails") } describe '#validations' do it 'is valid with valid attributes' do expect(subject).to be_valid end it 'is not valid without an name' do subject.name = nil expect(subject).to_not be_valid end end...
github
leonardoscorza/stack_helper
https://github.com/leonardoscorza/stack_helper
spec/models/user_spec.rb
Ruby
mit
18
master
1,123
require 'rails_helper' RSpec.describe User, type: :model do subject { User.new(name: "Example", email: "foo@bar.com", password: "foobar") } context "when admin is seted" do it "is false by default" do expect(subject.admin).to be_falsey end end describe '#validations' do it 'is valid with valid attribu...
github
leonardoscorza/stack_helper
https://github.com/leonardoscorza/stack_helper
spec/models/question_spec.rb
Ruby
mit
18
master
1,316
require 'rails_helper' RSpec.describe Question, type: :model do #subject { Question.new(user_id: 1, title: "Example", text: "Some text", tag_body: "#ruby #rails") } describe 'validates' do it 'be valid' do expect(create(:question)).to be_valid end describe 'raise record invalid' do it 'when Title ...
github
leonardoscorza/stack_helper
https://github.com/leonardoscorza/stack_helper
spec/factories/questions.rb
Ruby
mit
18
master
750
FactoryGirl.define do factory :question do title "This is the question title" text "This is the question text" * 20 tag_body "#ruby #rails #javascript" user trait :invalid do title nil end factory :question_with_answers do # Create a local variable with the number of answers ...
github
leonardoscorza/stack_helper
https://github.com/leonardoscorza/stack_helper
spec/factories/users.rb
Ruby
mit
18
master
471
FactoryGirl.define do # Each time when a new answer is created in :question_with_answers # (factories/questions.rb), a new user will be created in :answer # (factories/answers.rb). Because an email can be registered only once # (model validation), we need to create always different emails. sequence(:email) { ...
github
binford2k/fingerpuppet
https://github.com/binford2k/fingerpuppet
gem/fingerpuppet.gemspec
Ruby
mit
18
master
1,414
Gem::Specification.new do |s| s.name = "fingerpuppet" s.version = '0.0.4' s.date = "2014-05-09" s.summary = "A simple library and tool to interact with Puppet's REST API without needing Puppet itself installed." s.homepage = "http://github.com/binford2k/f...
github
binford2k/fingerpuppet
https://github.com/binford2k/fingerpuppet
gem/lib/fingerpuppet/restapi.rb
Ruby
mit
18
master
11,267
require 'yaml' require "net/https" module Fingerpuppet class RestAPI attr_accessor :server, :certname def initialize( options={} ) @debug = options[:debug] @curl = options[:curl] @nop = options[:nop] @output = options[:output] @configdir = File.expand_pa...
github
kevinzen/sidekiq-multi-redis-client
https://github.com/kevinzen/sidekiq-multi-redis-client
sidekiq-multi-redis-client.gemspec
Ruby
mit
18
master
915
# -*- encoding: utf-8 -*- require File.expand_path('../lib/sidekiq-multi-redis-client/version', __FILE__) Gem::Specification.new do |gem| gem.authors = ["Kevin Bedell"] gem.email = ["kbedell@gmail.com"] gem.description = gem.summary = "Allow sidekiq clients to send jobs to multiple redis instance...
github
kevinzen/sidekiq-multi-redis-client
https://github.com/kevinzen/sidekiq-multi-redis-client
Rakefile
Ruby
mit
18
master
234
#!/usr/bin/env rake require "bundler/gem_tasks" require 'rake/testtask' Rake::TestTask.new(:test) do |test| test.libs << 'test' #SO MUCH NOISE #test.warning = true test.pattern = 'test/**/test_*.rb' end task :default => :test
github
kevinzen/sidekiq-multi-redis-client
https://github.com/kevinzen/sidekiq-multi-redis-client
test/helper.rb
Ruby
mit
18
master
3,272
ENV['RACK_ENV'] = ENV['RAILS_ENV'] = 'test' if ENV.has_key?("SIMPLECOV") require 'simplecov' SimpleCov.start end require 'minitest/unit' require 'minitest/pride' require 'minitest/autorun' require "sidekiq" require 'sidekiq/util' require 'sidekiq/redis_connection' require 'sidekiq-multi-redis-client' Sidekiq.log...
github
kevinzen/sidekiq-multi-redis-client
https://github.com/kevinzen/sidekiq-multi-redis-client
test/lib/sidekiq/test_redis_selection.rb
Ruby
mit
18
master
3,420
require 'helper' class TestRedisSelection < MiniTest::Unit::TestCase describe 'with real redis' do before do end describe "should correctly work with a single endpoint" do before do setup_one_redis_conn end it 'should know there is only one redis connections' do ...
github
kevinzen/sidekiq-multi-redis-client
https://github.com/kevinzen/sidekiq-multi-redis-client
test/lib/sidekiq/test_failed_connections.rb
Ruby
mit
18
master
458
require 'helper' class TestFailedConnections < MiniTest::Unit::TestCase describe 'with real redis that fails sometimes' do before do end describe "should correctly know when one of the redis conns is bad" do it 'should know there are two redis connections' do setup_redis_one_bad m...
github
kevinzen/sidekiq-multi-redis-client
https://github.com/kevinzen/sidekiq-multi-redis-client
test/lib/sidekiq/test_middleware.rb
Ruby
mit
18
master
912
describe 'multi redis middleware' do before do mock_redis setup_two_redis_conns end after do #unmock_redis end it 'changes the redis client for each call' do redis_1 = Sidekiq.redis { |c| c.client.location } mw = SidekiqMultiRedisClient::Middleware::Client::MultiRedis.new mw....
github
kevinzen/sidekiq-multi-redis-client
https://github.com/kevinzen/sidekiq-multi-redis-client
test/lib/sidekiq/test_configuration.rb
Ruby
mit
18
master
2,345
require 'helper' class TestConfiguration < MiniTest::Unit::TestCase describe 'with real redis' do before do end describe "configuration options should be identifiable" do it 'determines if the job is tagged to use multi_redis_job' do enabled = MultiRedisJob.get_sidekiq_options['multi_redi...
github
kevinzen/sidekiq-multi-redis-client
https://github.com/kevinzen/sidekiq-multi-redis-client
lib/sidekiq-multi-redis-client.rb
Ruby
mit
18
master
281
require 'yaml' if RUBY_VERSION.include?('2.0.0') require 'sidekiq-multi-redis-client/middleware' require 'sidekiq-multi-redis-client/version' require 'sidekiq-multi-redis-client/config' module SidekiqMultiRedisClient def self.config SidekiqMultiRedisClient::Config end end
github
kevinzen/sidekiq-multi-redis-client
https://github.com/kevinzen/sidekiq-multi-redis-client
lib/sidekiq-multi-redis-client/config.rb
Ruby
mit
18
master
1,140
module SidekiqMultiRedisClient class Config def self.multi_redis_job=(multi_redis_job) @multi_redis_job = multi_redis_job end def self.multi_redis_job @multi_redis_job end # Redises? An Array of redis ConnectionPools # def self.redi=(array_of_redis_connection_pools) @c...
github
kevinzen/sidekiq-multi-redis-client
https://github.com/kevinzen/sidekiq-multi-redis-client
lib/sidekiq-multi-redis-client/middleware.rb
Ruby
mit
18
master
473
require 'sidekiq' Sidekiq.configure_server do |config| config.client_middleware do |chain| require 'sidekiq-multi-redis-client/middleware/client/multi_redis' chain.add SidekiqMultiRedisClient::Middleware::Client::MultiRedis end end Sidekiq.configure_client do |config| config.client_middleware do |chain...
github
kevinzen/sidekiq-multi-redis-client
https://github.com/kevinzen/sidekiq-multi-redis-client
lib/sidekiq-multi-redis-client/middleware/client/multi_redis.rb
Ruby
mit
18
master
1,608
require 'digest' module SidekiqMultiRedisClient module Middleware module Client class MultiRedis def call(worker_class, item, queue) klass = worker_class_constantize(worker_class) enabled = klass.get_sidekiq_options['multi_redis_job'] if enabled point_...
github
kevinzen/sidekiq-multi-redis-client
https://github.com/kevinzen/sidekiq-multi-redis-client
lib/sidekiq-multi-redis-client/middleware/server/multi_redis.rb
Ruby
mit
18
master
296
require 'digest' module SidekiqMultiRedisClient module Middleware module Server class MultiRedis def call(worker, item, queue) yield ensure end protected def logger Sidekiq.logger end end end end end
github
jonathanhefner/garden_variety
https://github.com/jonathanhefner/garden_variety
Gemfile
Ruby
mit
18
master
258
source 'https://rubygems.org' gemspec group :development do gem 'sqlite3' end # Use dedicated gem group to load and test in isolation gem 'talent_scout', '~> 1.0', group: [:talent_scout] # To use a debugger # gem 'byebug', group: [:development, :test]
github
jonathanhefner/garden_variety
https://github.com/jonathanhefner/garden_variety
garden_variety.gemspec
Ruby
mit
18
master
823
require_relative "lib/garden_variety/version" Gem::Specification.new do |spec| spec.name = "garden_variety" spec.version = GardenVariety::VERSION spec.authors = ["Jonathan Hefner"] spec.email = ["jonathan@hefner.pro"] spec.homepage = "https://github.com/jonathanhefner/garden_variety" ...
github
jonathanhefner/garden_variety
https://github.com/jonathanhefner/garden_variety
test/test_helper.rb
Ruby
mit
18
master
375
Bundler.load.setup(:default, :development) # exclude :talent_scout group # Configure Rails Environment ENV["RAILS_ENV"] = "test" require File.expand_path("../../test/dummy/config/environment.rb", __FILE__) ActiveRecord::Migrator.migrations_paths = [File.expand_path("../../test/dummy/db/migrate", __FILE__)] require "r...
github
jonathanhefner/garden_variety
https://github.com/jonathanhefner/garden_variety
test/scaffold_generator_test.rb
Ruby
mit
18
master
1,834
require "test_helper" require_relative "generator_test_case" require "generators/garden/scaffold/scaffold_generator" class ScaffoldGeneratorTest < GeneratorTestCase tests Garden::Generators::ScaffoldGenerator def setup super prepare_routes end def test_generates_scaffold generate_scaffold("fruit"...
github
jonathanhefner/garden_variety
https://github.com/jonathanhefner/garden_variety
test/integration_test.rb
Ruby
mit
18
master
8,492
require "test_helper" require "garden_variety" Post.class_eval do validates :title, exclusion: { in: ["BAD!"] } before_destroy{|post| throw(:abort) if post.title == "PERMANENT!" } end PostPolicy.class_eval do class_attribute :allow_all [:index?, :show?, :new?, :create?, :edit?, :update?, :destroy?].each do ...
github
jonathanhefner/garden_variety
https://github.com/jonathanhefner/garden_variety
test/install_generator_test.rb
Ruby
mit
18
master
654
require "test_helper" require_relative "generator_test_case" require "generators/garden/install/install_generator" class InstallGeneratorTest < GeneratorTestCase tests Garden::Generators::InstallGenerator def test_generates_locales run_generator assert_file "config/locales/flash.en.yml" end def test_...
github
jonathanhefner/garden_variety
https://github.com/jonathanhefner/garden_variety
test/generator_test_case.rb
Ruby
mit
18
master
770
require "fileutils" require "timeout" require "test_helper" class GeneratorTestCase < Rails::Generators::TestCase destination File.expand_path("../tmp", __dir__) def setup prepare_destination end private def prepare_routes FileUtils.mkdir_p("#{destination_root}/config") FileUtils.cp("#{__dir__...
github
jonathanhefner/garden_variety
https://github.com/jonathanhefner/garden_variety
test/talent_scout_generator_test.rb
Ruby
mit
18
master
931
return if Bundler.load.dependencies.none?{|dep| dep.name == "talent_scout" } require "test_helper" require_relative "generator_test_case" require "generators/garden/scaffold/scaffold_generator" class TalentScoutGeneratorTest < GeneratorTestCase include ActiveSupport::Testing::Isolation tests Garden::Generators::Sc...
github
jonathanhefner/garden_variety
https://github.com/jonathanhefner/garden_variety
test/controller_test.rb
Ruby
mit
18
master
6,868
require "test_helper" require "garden_variety" class DefaultUsage < ActiveRecord::Base; end class DefaultUsagesController < ActionController::Base include GardenVariety::Controller garden_variety end class NoUsage < ActiveRecord::Base; end class NoUsagesController < ActionController::Base include GardenVarie...
github
jonathanhefner/garden_variety
https://github.com/jonathanhefner/garden_variety
test/talent_scout_test.rb
Ruby
mit
18
master
2,879
return if Bundler.load.dependencies.none?{|dep| dep.name == "talent_scout" } require "test_helper" class TalentScoutTest < Minitest::Test include ActiveSupport::Testing::Isolation def setup # sanity check refute defined?(::TalentScout) refute defined?(::GardenVariety::TalentScout) # enable talent_...
github
jonathanhefner/garden_variety
https://github.com/jonathanhefner/garden_variety
test/dummy/db/schema.rb
Ruby
mit
18
master
944
# This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # Note that this schema.rb definition is the authoritative source for your # dat...
github
jonathanhefner/garden_variety
https://github.com/jonathanhefner/garden_variety
test/dummy/config/application.rb
Ruby
mit
18
master
448
require_relative 'boot' require 'rails/all' Bundler.require(*Rails.groups) require "garden_variety" module Dummy class Application < Rails::Application config.load_defaults Rails::VERSION::STRING.to_f # Settings in config/environments/* take precedence over those specified here. # Application configur...
github
jonathanhefner/garden_variety
https://github.com/jonathanhefner/garden_variety
test/dummy/config/environments/production.rb
Ruby
mit
18
master
3,455
Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. config.cache_classes = true # Eager load code on boot. This eager loads most of Rails and # your application in memory, allowing both threaded web serve...