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 | boltops-tools/aws-inventory | https://github.com/boltops-tools/aws-inventory | spec/lib/aws_inventory/security_group/open_spec.rb | Ruby | mit | 48 | master | 898 | require "spec_helper"
describe AwsInventory::SecurityGroup::Open do
let(:reporter) { AwsInventory::SecurityGroup::Open.new({}) }
it "combine_ports" do
ports = [22]
combined_ports = reporter.combine_ports(ports)
expect(combined_ports).to eq([22])
ports = [80, 443]
combined_ports = reporter.com... |
github | cacheventures/mongoid_includes | https://github.com/cacheventures/mongoid_includes | Rakefile | Ruby | mit | 48 | master | 810 | require 'bundler'
Bundler.setup
require 'rake'
require 'rspec/core/rake_task'
$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
require 'mongoid/includes/version'
task :gem => :build
task :build do
system 'gem build mongoid_includes.gemspec'
end
task :install => :build do
system "sudo gem install mongoid_... |
github | cacheventures/mongoid_includes | https://github.com/cacheventures/mongoid_includes | Gemfile | Ruby | mit | 48 | master | 201 | source 'https://rubygems.org'
gemspec
gem 'bundler'
gem 'rake'
gem 'pry-byebug'
gem 'mongoid', '~> 9'
group :test do
gem 'rspec-given', '~> 3.5'
gem 'simplecov', '~> 0.17.0', require: false
end |
github | cacheventures/mongoid_includes | https://github.com/cacheventures/mongoid_includes | mongoid_includes.gemspec | Ruby | mit | 48 | master | 922 | lib = File.expand_path('../lib/', __FILE__)
$:.unshift lib unless $:.include?(lib)
require 'mongoid/includes/version'
Gem::Specification.new do |s|
s.name = 'mongoid_includes'
s.version = Mongoid::Includes::VERSION
s.licenses = ['MIT']
s.summary = 'Improved eager loading support for Mongoid.'
s.description ... |
github | cacheventures/mongoid_includes | https://github.com/cacheventures/mongoid_includes | spec/spec_helper.rb | Ruby | mit | 48 | master | 1,290 | require 'simplecov'
SimpleCov.start
require 'rspec/given'
require 'pry'
require 'mongoid_includes'
# Load Support files
Dir['./spec/support/**/*.rb'].map do |f|
require f
end
I18n.config.enforce_available_locales = false
# These are used when creating any connection in the test suite.
HOST = ENV['MONGOID_SPEC_HOS... |
github | cacheventures/mongoid_includes | https://github.com/cacheventures/mongoid_includes | spec/mongoid/includes/criteria_spec.rb | Ruby | mit | 48 | master | 865 | require 'spec_helper'
describe Mongoid::Criteria do
Given(:criteria) { Band.includes(:songs, :owner, from: :albums) }
Given(:other_criteria) { Band.includes(:musicians, :albums) }
describe '#merge' do
context 'inclusions are combined properly' do
When(:new_criteria) { criteria.merge(other_criteria) }
... |
github | cacheventures/mongoid_includes | https://github.com/cacheventures/mongoid_includes | spec/mongoid/includes/nested_inclusions_spec.rb | Ruby | mit | 48 | master | 2,417 | require 'spec_helper'
describe Mongoid::Includes::Criteria do
describe '#includes' do
context 'inclusion has additional options' do
Given(:band) { Band.create!(name: 'Pink Floyd') }
Given {
Album.create!(name: 'Wish You Were Here', release: Date.new(1975), owner: band)
Album.create!... |
github | cacheventures/mongoid_includes | https://github.com/cacheventures/mongoid_includes | spec/mongoid/includes/simple_inclusions_spec.rb | Ruby | mit | 48 | master | 21,763 | require 'spec_helper'
describe Mongoid::Includes::Criteria do
describe '#includes' do
let!(:person) do
Person.create(age: 1)
end
context 'when providing a name that is not a relation' do
it 'raises an error' do
expect {
Person.includes(:members)
}.to raise_error(... |
github | cacheventures/mongoid_includes | https://github.com/cacheventures/mongoid_includes | spec/mongoid/includes/inclusions_spec.rb | Ruby | mit | 48 | master | 911 | require 'spec_helper'
describe Mongoid::Includes::Inclusions do
describe '#inclusions' do
Given(:criteria) { Band.includes(:songs, :owner, from: :albums) }
Given(:inclusions) { criteria.inclusions }
context 'adding two different inclusions' do
Given(:other_criteria) { Band.includes(:musicians, :a... |
github | cacheventures/mongoid_includes | https://github.com/cacheventures/mongoid_includes | spec/mongoid/includes/polymorphic_includes_spec.rb | Ruby | mit | 48 | master | 5,902 | require 'spec_helper'
describe Mongoid::Includes::Criteria do
describe '#includes' do
Given(:inclusions) { criteria.inclusions }
context 'multiple inclusions through polymorphic associations' do
Given(:pink_floyd) { Band.create!(name: 'Pink Floyd', musician_ids: [nil, '']) }
Given(:jethro) { Ba... |
github | cacheventures/mongoid_includes | https://github.com/cacheventures/mongoid_includes | spec/mongoid/includes/errors/invalid_polymorphic_includes_spec.rb | Ruby | mit | 48 | master | 743 | require 'spec_helper'
describe Mongoid::Includes::Errors::InvalidPolymorphicIncludes do
describe "#message" do
Given(:error) {
described_class.new(Album, :something, from: :artist)
}
it "contains the problem in the message" do
expect(error.message).to include(
":artist is a polymor... |
github | cacheventures/mongoid_includes | https://github.com/cacheventures/mongoid_includes | spec/mongoid/includes/errors/invalid_includes_spec.rb | Ruby | mit | 48 | master | 693 | require 'spec_helper'
describe Mongoid::Includes::Errors::InvalidIncludes do
describe "#message" do
Given(:error) {
described_class.new(Album, :something, {})
}
it "contains the problem in the message" do
expect(error.message).to include(
"Invalid includes directive: Album.includes... |
github | cacheventures/mongoid_includes | https://github.com/cacheventures/mongoid_includes | spec/support/helpers.rb | Ruby | mit | 48 | master | 573 | module Mongoid
module SpecHelpers
def connection_class
Mongo::Server::ConnectionBase
end
def expect_query(number)
rv = nil
RSpec::Mocks.with_temporary_scope do
if number > 0
expect_any_instance_of(connection_class).to receive(:command_started).exactly(number).times.and... |
github | cacheventures/mongoid_includes | https://github.com/cacheventures/mongoid_includes | spec/support/models/address.rb | Ruby | mit | 48 | master | 813 | class Address
include Mongoid::Document
field :_id, type: String, overwrite: true, default: ->{ street.try(:parameterize) }
attr_accessor :mode
field :address_type
field :number, type: Integer
field :no, type: Integer
field :h, as: :house, type: Integer
field :street
field :city
field :state
fi... |
github | cacheventures/mongoid_includes | https://github.com/cacheventures/mongoid_includes | spec/support/models/game.rb | Ruby | mit | 48 | master | 481 | class Game
include Mongoid::Document
field :high_score, type: Integer, default: 500
field :score, type: Integer, default: 0
field :name
belongs_to :person, index: true, validate: true
belongs_to :parent, class_name: "Game", foreign_key: "parent-id", optional: true
accepts_nested_attributes_for :person... |
github | cacheventures/mongoid_includes | https://github.com/cacheventures/mongoid_includes | spec/support/models/preference.rb | Ruby | mit | 48 | master | 306 | class Preference
include Mongoid::Document
field :name, type: String
field :value, type: String
field :ranking, type: Integer
has_and_belongs_to_many :people, validate: false
validates_length_of :name, minimum: 2, allow_nil: true
scope :posting, ->{ where(:value.in => [ "Posting" ]) }
end |
github | cacheventures/mongoid_includes | https://github.com/cacheventures/mongoid_includes | spec/support/models/node.rb | Ruby | mit | 48 | master | 200 | class Node
include Mongoid::Document
has_and_belongs_to_many :parents, class_name: 'Node', inverse_of: :children
has_and_belongs_to_many :children, class_name: 'Node', inverse_of: :parents
end |
github | cacheventures/mongoid_includes | https://github.com/cacheventures/mongoid_includes | spec/support/models/band.rb | Ruby | mit | 48 | master | 702 | class Band
include Mongoid::Document
include Mongoid::Attributes::Dynamic
field :name, type: String
field :active, type: Mongoid::Boolean, default: true
field :origin, type: String
field :genres, type: Array
field :member_count, type: Integer
field :mems, as: :members, type: Array
field :likes, type:... |
github | cacheventures/mongoid_includes | https://github.com/cacheventures/mongoid_includes | spec/support/models/person.rb | Ruby | mit | 48 | master | 1,759 | class Person
include Mongoid::Document
include Mongoid::Attributes::Dynamic
attr_accessor :mode
class_attribute :somebody_elses_important_class_options
self.somebody_elses_important_class_options = { keep_me_around: true }
field :username, default: -> { "arthurnn#{rand(0..10)}" }
field :title
field :t... |
github | cacheventures/mongoid_includes | https://github.com/cacheventures/mongoid_includes | spec/support/models/post.rb | Ruby | mit | 48 | master | 328 | require_relative './person'
class Post
include Mongoid::Document
include Mongoid::Attributes::Dynamic
field :title, type: String
field :content, type: String
field :rating, type: Integer
field :person_title, type: String, default: ->{ person.title if ivar(:person) }
belongs_to :person, counter_cache: t... |
github | cacheventures/mongoid_includes | https://github.com/cacheventures/mongoid_includes | lib/mongoid_includes.rb | Ruby | mit | 48 | master | 623 | require 'mongoid'
require 'mongoid/includes'
# add english load path by default
I18n.load_path << File.join(File.dirname(__FILE__), 'config', 'locales', 'en.yml')
Mongoid::Contextual::Mongo.send :prepend, Mongoid::Includes::EagerLoad
Mongoid::Contextual::Memory.send :prepend, Mongoid::Includes::EagerLoad
Mongoid::C... |
github | cacheventures/mongoid_includes | https://github.com/cacheventures/mongoid_includes | lib/mongoid/includes/inclusion.rb | Ruby | mit | 48 | master | 2,241 | module Mongoid
module Includes
# Public: Represents a relation that needs to be eager loaded.
class Inclusion < SimpleDelegator
# Public: Convenience getter for the wrapped metadata.
alias_method :metadata, :__getobj__
def initialize(metadata, options = {})
super(metadata)
... |
github | cacheventures/mongoid_includes | https://github.com/cacheventures/mongoid_includes | lib/mongoid/includes/inclusions.rb | Ruby | mit | 48 | master | 1,202 | require 'mongoid/includes/inclusion'
module Mongoid
module Includes
# Public: Collection of relations that need to be eager loaded.
class Inclusions < SimpleDelegator
# Internal: By default, it wraps an empty set.
def initialize(object = [])
super Set.new(object)
end
# Over... |
github | cacheventures/mongoid_includes | https://github.com/cacheventures/mongoid_includes | lib/mongoid/includes/criteria.rb | Ruby | mit | 48 | master | 2,512 | require 'mongoid/includes/errors'
require 'mongoid/includes/inclusions'
module Mongoid
module Includes
# Internal: Adds and overrides methods in Mongoid::Criteria to enhance eager loading.
module Criteria
# Overrides: Get a list of criteria that are to be executed for eager loading.
def inclusi... |
github | cacheventures/mongoid_includes | https://github.com/cacheventures/mongoid_includes | lib/mongoid/includes/eager_load.rb | Ruby | mit | 48 | master | 1,889 | module Mongoid
module Includes
# Public: Adds support for polymorphic and nested eager loading.
module EagerLoad
# Override: Partitions the inclusions into the different types.
def eager_load(docs)
if eager_loadable?
nested_inclusions, inclusions = criteria.inclusions.partition... |
github | cacheventures/mongoid_includes | https://github.com/cacheventures/mongoid_includes | lib/mongoid/includes/association/eager.rb | Ruby | mit | 48 | master | 654 | module Mongoid
module Includes
module Association
# Internal: Patch to the base class for eager load preload functions,
# that interacts with the Mongoid::Includes::Inclusion as @medatada.
module Eager
# Internal: Performs eager load and iterates over the preloaded documents
# ... |
github | cacheventures/mongoid_includes | https://github.com/cacheventures/mongoid_includes | lib/mongoid/includes/errors/invalid_polymorphic_includes.rb | Ruby | mit | 48 | master | 388 | module Mongoid
module Includes
module Errors
# Public: This error is raised when an invalid nested inclusion is
# attempted through a polymorphic relation.
class InvalidPolymorphicIncludes < InvalidIncludes
# Internal: Key of the translation message
def type
:invalid_... |
github | cacheventures/mongoid_includes | https://github.com/cacheventures/mongoid_includes | lib/mongoid/includes/errors/invalid_includes.rb | Ruby | mit | 48 | master | 970 | module Mongoid
module Includes
module Errors
# Public: This error is raised when an invalid include is performed.
class InvalidIncludes < Mongoid::Errors::MongoidError
# Public: Composes a message from the class the includes would be
# performed on, the relations to be included, and ... |
github | voxpupuli/autosign | https://github.com/voxpupuli/autosign | autosign.gemspec | Ruby | apache-2.0 | 48 | master | 1,678 | # frozen_string_literal: true
# Ensure we require the local version and not one we might have installed already
require File.join([__dir__, 'lib', 'autosign', 'version.rb'])
spec = Gem::Specification.new do |s|
s.name = 'autosign'
s.version = Autosign::VERSION
s.author = 'Daniel Dreier'
s.email = 'ddreier@thin... |
github | voxpupuli/autosign | https://github.com/voxpupuli/autosign | Rakefile | Ruby | apache-2.0 | 48 | master | 1,203 | # encoding: utf-8
# frozen_string_literal: true
require 'rubygems'
require 'bundler'
require 'bundler/gem_tasks'
require 'rake/testtask'
require 'rspec/core/rake_task'
require 'cucumber'
require 'cucumber/rake/task'
require 'rdoc/task'
require 'rake/clean'
RSpec::Core::RakeTask.new(:spec) do |t|
t.rspec_opts = '--f... |
github | voxpupuli/autosign | https://github.com/voxpupuli/autosign | spec/spec_helper.rb | Ruby | apache-2.0 | 48 | master | 4,988 | require_relative "../lib/autosign"
#
# require 'coveralls'
# Coveralls.wear!
def fixtures_dir
@fixtures_dir = File.expand_path(File.join(__dir__, 'fixtures'))
end
# Generate X509 CSR (certificate signing request) with SAN (Subject Alternative Name) extension and sign it with the RSA key
# common_name, organization,... |
github | voxpupuli/autosign | https://github.com/voxpupuli/autosign | spec/specs/journal_spec.rb | Ruby | apache-2.0 | 48 | master | 1,262 | require 'spec_helper'
require 'securerandom'
context Autosign::Journal do
let(:settings) { {'journalfile' => '/tmp/test.journal'} }
let(:journal) { Autosign::Journal.new(settings) }
let(:uuid) { SecureRandom.uuid }
let(:validto) { Time.now.to_i + 900 }
let(:data) { {'arbitrary_hey' => 'value'} }
context ... |
github | voxpupuli/autosign | https://github.com/voxpupuli/autosign | spec/specs/decoder_spec.rb | Ruby | apache-2.0 | 48 | master | 1,246 | require 'spec_helper'
context Autosign::Decoder do
describe '.decode_csr' do
let(:csr) { File.read(File.join('fixtures', 'i-7672fe81.pem')) }
it 'Accepts a CSR as the parameter' do
expect { Autosign::Decoder.decode_csr(csr) }.to_not raise_error
end
it 'Extracts the challenge_password and comm... |
github | voxpupuli/autosign | https://github.com/voxpupuli/autosign | spec/specs/validator_spec.rb | Ruby | apache-2.0 | 48 | master | 2,899 | # frozen_string_literal: true
require 'spec_helper'
require 'securerandom'
describe Autosign::Validator do
let(:config_obj) { Autosign::Config.new(settings) }
let(:settings) do
{'config_file' => File.join(fixtures_dir, 'settings_file.yaml') }
end
let(:certname) { 'foo.example.com' }
let(:one_time_toke... |
github | voxpupuli/autosign | https://github.com/voxpupuli/autosign | spec/specs/token_spec.rb | Ruby | apache-2.0 | 48 | master | 3,948 | require 'spec_helper'
require 'securerandom'
context Autosign::Token do
let(:certname) { 'host.example.com' }
let(:reusable) { false }
let(:validfor) { rand(60..604800) }
let(:requester) { 'Autosign::Token rspec_test' }
let(:secret) { 'very_secret' }
let(:token) { Autosign::Token.new(certname, re... |
github | voxpupuli/autosign | https://github.com/voxpupuli/autosign | spec/specs/config_spec.rb | Ruby | apache-2.0 | 48 | master | 955 | require 'spec_helper'
context Autosign::Config do
describe 'basic use case' do
let(:config) { Autosign::Config.new(settings) }
let(:settings) do
{'config_file' => File.join(fixtures_dir, 'settings_file.yaml') }
end
let(:config_file_settings) do
{ 'general' =>
{
'logleve... |
github | voxpupuli/autosign | https://github.com/voxpupuli/autosign | spec/specs/validator/passwordlist_spec.rb | Ruby | apache-2.0 | 48 | master | 1,747 | require 'spec_helper'
require 'securerandom'
require 'autosign/validator/passwordlist'
context Autosign::Validator::Passwordlist do
let(:certname) { 'host.example.com' }
let(:validator) { Autosign::Validator::Passwordlist.new }
before {
# stub configuration
data = { 'general' => {
'loglev... |
github | voxpupuli/autosign | https://github.com/voxpupuli/autosign | spec/specs/validator/jwt_spec.rb | Ruby | apache-2.0 | 48 | master | 2,651 | require 'spec_helper'
require 'securerandom'
require 'autosign/validator/jwt'
context Autosign::Validator::JWT do
let(:certname) { 'host.example.com' }
let(:validator) { Autosign::Validator::JWT.new }
let(:one_time_token) { Autosign::Token.new('foo.example.com', false, 3600, 'rspec_test', 'secret').sign }
let... |
github | voxpupuli/autosign | https://github.com/voxpupuli/autosign | features/support/env.rb | Ruby | apache-2.0 | 48 | master | 447 | require 'aruba/cucumber'
ENV['PATH'] = "#{File.expand_path(__dir__ + '/../../bin')}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
LIB_DIR = File.join(File.expand_path(__dir__),'..','..','lib')
Before do
# Using "announce" causes massive warnings on 1.9.2
@puts = true
@original_rubylib = ENV['RUBYLIB']
ENV['RUBYLIB']... |
github | voxpupuli/autosign | https://github.com/voxpupuli/autosign | features/step_definitions/autosign_steps.rb | Ruby | apache-2.0 | 48 | master | 1,152 | When(/^I get help for "([^"]*)"$/) do |app_name|
@app_name = app_name
step %(I run `#{app_name} help`)
end
Given(/^a pre\-shared key of "([^"]*)"$/) do |presharedkey|
@psk = presharedkey
end
Given(/^a hostname of "([^"]*)"$/) do |host|
@hostname = host
end
Given(/^the current time is (\d+)$/) do |time|
@cu... |
github | voxpupuli/autosign | https://github.com/voxpupuli/autosign | lib/autosign.rb | Ruby | apache-2.0 | 48 | master | 1,157 | require 'rubygems'
require 'multi_json'
require 'autosign/version.rb'
require 'autosign/token.rb'
require 'autosign/config.rb'
require 'autosign/decoder.rb'
require 'autosign/journal.rb'
require 'autosign/validator.rb'
# Add requires for other files you add to your project here, so
# you just need to require this one ... |
github | voxpupuli/autosign | https://github.com/voxpupuli/autosign | lib/autosign/validator.rb | Ruby | apache-2.0 | 48 | master | 2,754 | # frozen_string_literal: true
require 'logging'
module Autosign
module Validator
# @return [Array] - A list of all the validator classes
# @param list [Array] - a list of validators to use, uses the settings list by default
# This returns a list of validators that were specified by the user and the... |
github | voxpupuli/autosign | https://github.com/voxpupuli/autosign | lib/autosign/config.rb | Ruby | apache-2.0 | 48 | master | 8,182 | # frozen_string_literal: true
require 'rbconfig'
require 'securerandom'
require 'deep_merge'
require 'yaml'
module Autosign
# Exceptions namespace for Autosign class
module Exceptions
# Exception representing a general failure during validation
class Validation < RuntimeError
end
# Exception repre... |
github | voxpupuli/autosign | https://github.com/voxpupuli/autosign | lib/autosign/token.rb | Ruby | apache-2.0 | 48 | master | 7,776 | module Autosign
require 'jwt'
require 'multi_json'
require 'securerandom'
# Class modeling JSON Web Tokens as credentials for certificate auto signing.
# See http://jwt.io for more information about JSON web tokens in general.
#
# @return [Autosign::Token] instance of the Autosign::Token class
class To... |
github | voxpupuli/autosign | https://github.com/voxpupuli/autosign | lib/autosign/journal.rb | Ruby | apache-2.0 | 48 | master | 3,907 | require 'logging'
require 'yaml/store'
module Autosign
# Autosign::Journal tracks one-time keys to prevent key re-use.
# Keys are stored in the journal file by UUID.
# The journal uses ruby's yaml/store, which is a YAML version of the PStore
# data store. It is multi-process safe, and blocks until transactions in oth... |
github | voxpupuli/autosign | https://github.com/voxpupuli/autosign | lib/autosign/decoder.rb | Ruby | apache-2.0 | 48 | master | 1,615 | module Autosign
# Class to abstract X509 certificate signing request decoding.
# This class is only expected to be used for class methods.
# The purpose is to extract common fields from CSRs so that individual
# validators don't have to re-implement that logic.
class Decoder
# Extract common name and chal... |
github | voxpupuli/autosign | https://github.com/voxpupuli/autosign | lib/autosign/validator/jwt.rb | Ruby | apache-2.0 | 48 | master | 4,334 | # frozen_string_literal: true
require 'autosign/validator/validator_base'
module Autosign
module Validator
# Validate certificate signing requests using JSON Web Tokens (JWT).
# This is the expected primary validator when using the autosign gem.
# Validation requires that the shared secret used to genera... |
github | voxpupuli/autosign | https://github.com/voxpupuli/autosign | lib/autosign/validator/validator_base.rb | Ruby | apache-2.0 | 48 | master | 7,275 | # frozen_string_literal: true
require 'logging'
module Autosign
module Validator
# Parent class for validation backends. Validator take the
# challenge_password and common name from a certificate signing request,
# and perform some action to determine whether the request is valid.
#
# Validator ... |
github | voxpupuli/autosign | https://github.com/voxpupuli/autosign | lib/autosign/validator/multiplexer.rb | Ruby | apache-2.0 | 48 | master | 4,452 | # frozen_string_literal: true
require 'autosign/validator/validator_base'
require 'English'
module Autosign
module Validator
# The multiplexer validator sends the same request received by the autosign
# executable to one or more external executables. The purpose is to allow
# one or more existing autosig... |
github | voxpupuli/autosign | https://github.com/voxpupuli/autosign | lib/autosign/validator/passwordlist.rb | Ruby | apache-2.0 | 48 | master | 1,417 | # frozen_string_literal: true
require 'autosign/validator/validator_base'
module Autosign
module Validator
# Validate certificate signing requests using a simple password list.
# This is not a very secure or flexible validation scheme, but is provided
# because so many existing autosign policy scripts imp... |
github | tyne/tyne | https://github.com/tyne/tyne | Gemfile | Ruby | mit | 48 | master | 1,685 | source 'https://rubygems.org'
gem 'rails', '~> 3.2.13'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
gem 'libv8', '~> 3.11.8'
gem 'therubyrace... |
github | tyne/tyne | https://github.com/tyne/tyne | Rakefile | Ruby | mit | 48 | master | 269 | #!/usr/bin/env rake
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
Tyne::Application.load_tasks |
github | tyne/tyne | https://github.com/tyne/tyne | Guardfile | Ruby | mit | 48 | master | 1,392 | # A sample Guardfile
# More info at https://github.com/guard/guard#readme
guard :jasmine, :all_on_start => false do
watch(%r{spec/javascripts/spec\.(js\.coffee|js|coffee)$}) { 'spec/javascripts' }
watch(%r{spec/javascripts/.+_spec\.(js\.coffee|js|coffee)$})
watch(%r{spec/javascripts/fixtures/.+$})
watch(%r{app... |
github | tyne/tyne | https://github.com/tyne/tyne | spec/spec_helper.rb | Ruby | mit | 48 | master | 1,759 | require 'rubygems'
require 'simplecov'
require 'coveralls'
Coveralls.wear!("rails")
SimpleCov.start do
add_filter "/spec/"
add_filter "/vendor/gems/"
end
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'capybara/rails'
require 'capybara/rspe... |
github | tyne/tyne | https://github.com/tyne/tyne | spec/models/issue_spec.rb | Ruby | mit | 48 | master | 3,979 | require 'spec_helper'
describe Issue do
it { should have_many :labels }
let(:user) { User.create!(:name => "Foo", :username => "Foo", :uid => "foo", :token => "foo") }
let(:project) { user.projects.create!(:key => "Foo", :name => "Foo") }
let(:issue) { create(:issue, :project => project) }
describe :votabl... |
github | tyne/tyne | https://github.com/tyne/tyne | spec/models/vote_spec.rb | Ruby | mit | 48 | master | 310 | require 'spec_helper'
describe Vote do
describe :associations do
it { should belong_to :user }
it { should belong_to :votable }
end
describe :security do
it { should allow_mass_assignment_of :weight }
end
describe :validations do
it { should validate_presence_of :user }
end
end |
github | tyne/tyne | https://github.com/tyne/tyne | spec/models/issue_label_spec.rb | Ruby | mit | 48 | master | 458 | require 'spec_helper'
describe IssueLabel do
describe :validations do
let(:project) { projects(:tyne) }
let(:other_project) { projects(:bluffr) }
let(:issue) { project.issues.first }
it "does not allow you to add labels from other projects" do
bar = other_project.labels.create!(:name => "Bar")... |
github | tyne/tyne | https://github.com/tyne/tyne | spec/models/sprint_spec.rb | Ruby | mit | 48 | master | 593 | require 'spec_helper'
describe Sprint do
let(:user) { create(:user) }
let(:project) { create(:project, :user => user) }
describe :start do
it "should create an positive activity entry for each sprint" do
issues = create_list(:issue, 5, :project => project)
sprint = project.sprints.build(:name =... |
github | tyne/tyne | https://github.com/tyne/tyne | spec/models/team_member_spec.rb | Ruby | mit | 48 | master | 274 | require 'spec_helper'
describe TeamMember do
describe :is_admin? do
it "should return true of the team has admin privileges" do
subject.stub(:team).and_return(stub_model(Team, :admin_privileges => true))
subject.is_admin?.should be_true
end
end
end |
github | tyne/tyne | https://github.com/tyne/tyne | spec/models/organization_membership_spec.rb | Ruby | mit | 48 | master | 285 | require 'spec_helper'
describe OrganizationMembership do
describe :associations do
it { should belong_to :organization }
it { should belong_to :user }
end
describe :validations do
it { should validate_uniqueness_of(:user_id).scoped_to(:organization_id) }
end
end |
github | tyne/tyne | https://github.com/tyne/tyne | spec/models/user_spec.rb | Ruby | mit | 48 | master | 396 | require 'spec_helper'
describe User do
describe :initialisation do
it "should build a new dashboard for every new user" do
described_class.new.dashboards.length.should == 1
end
end
describe :default_dashboard do
it "should default to the first dashboard" do
user = described_class.new
... |
github | tyne/tyne | https://github.com/tyne/tyne | spec/models/project_spec.rb | Ruby | mit | 48 | master | 1,210 | require 'spec_helper'
describe Project do
it { should have_many :teams }
it { should have_many :labels }
it "should have an owner and a contributor team" do
user = stub_model(User)
project = user.projects.create!(:key => "FOO", :name => "Foo")
teams = project.teams
owners = teams.detect { |x| x.... |
github | tyne/tyne | https://github.com/tyne/tyne | spec/cells/pagination_cell_spec.rb | Ruby | mit | 48 | master | 213 | require 'spec_helper'
describe PaginationCell do
subject { cell(:pagination) }
describe :show do
it "should render the view" do
subject.should_receive(:render)
subject.show
end
end
end |
github | tyne/tyne | https://github.com/tyne/tyne | spec/cells/notification_cell_spec.rb | Ruby | mit | 48 | master | 879 | require 'spec_helper'
describe NotificationCell do
subject { cell(:notification) }
context :cell do
describe '#show' do
it "should render the view" do
subject.should_receive(:render)
subject.show
end
end
end
context :views do
describe 'show' do
subject { render_c... |
github | tyne/tyne | https://github.com/tyne/tyne | spec/cells/backlog_sidebar_cell_spec.rb | Ruby | mit | 48 | master | 696 | require 'spec_helper'
describe BacklogSidebarCell do
subject { cell(:backlog_sidebar) }
describe :search do
it "should render the view" do
subject.stub_chain(:controller, :current_user, :id)
subject.should_receive(:render)
subject.search
end
end
describe :filter do
it "should re... |
github | tyne/tyne | https://github.com/tyne/tyne | spec/cells/votes_cell_spec.rb | Ruby | mit | 48 | master | 1,114 | require 'spec_helper'
describe VotesCell do
let(:user) { User.create!(:name => 'Foo', :username => 'Foo', :uid => 'foo', :token => 'foo') }
let(:project) { user.projects.create!(:key => 'Foo', :name => 'Foo') }
let(:issue) { Issue.create!(:summary => 'Foo', :project_id => project.id, :issue_type_id => 1) }
su... |
github | tyne/tyne | https://github.com/tyne/tyne | spec/cells/pod_cell_spec.rb | Ruby | mit | 48 | master | 1,801 | require 'spec_helper'
describe PodCell do
subject { cell(:pod) }
context :cell do
describe '#collapsable' do
before :each do
subject.stub(:render)
end
it 'should render the view' do
subject.should_receive(:render)
subject.collapsable 'My title'
end
it 's... |
github | tyne/tyne | https://github.com/tyne/tyne | spec/cells/issue_cell_spec.rb | Ruby | mit | 48 | master | 323 | require 'spec_helper'
describe IssueCell do
subject { cell(:issue) }
describe :create do
it "should render the view" do
expected = "path_to_dialog"
subject.should_receive(:render)
subject.create(expected)
subject.instance_variable_get(:@dialog_path).should == expected
end
end
e... |
github | tyne/tyne | https://github.com/tyne/tyne | spec/factories/user.rb | Ruby | mit | 48 | master | 268 | FactoryGirl.define do
factory :user do
name "Test"
username "test"
uid 123456
token "foo"
gravatar_id "foo"
end
factory :bob, :class => "User" do
name "Bob"
username "bob"
uid 1337
token "bob"
gravatar_id "bob"
end
end |
github | tyne/tyne | https://github.com/tyne/tyne | spec/factories/issue.rb | Ruby | mit | 48 | master | 232 | FactoryGirl.define do
factory :issue do
summary "Foo"
description "Bar"
issue_type { IssueType.first }
number 1
project
estimate { Issue::VALID_ESTIMATES[rand(0...Issue::VALID_ESTIMATES.count)] }
end
end |
github | tyne/tyne | https://github.com/tyne/tyne | spec/views/issues/show.html.erb_spec.rb | Ruby | mit | 48 | master | 922 | require 'spec_helper'
describe "issues/show.html.erb" do
let(:user) { create(:user, :username => "Foo") }
let(:project) { create(:project, :user => user, :key => "Foo") }
let(:issue) { create(:issue, :project => project, :reported_by => user, :number => 1) }
before :each do
assign(:issue, issue)
view.... |
github | tyne/tyne | https://github.com/tyne/tyne | spec/views/sprints/index.html.erb_spec.rb | Ruby | mit | 48 | master | 1,212 | require 'spec_helper'
describe "sprints/index.html.erb" do
let(:user) { stub_model(User, :username => "Foo") }
let(:project) { stub_model(Project, :user => user, :key => "Foo") }
let(:sprint) { stub_model(Sprint, :project => project) }
let(:issue) { stub_model(Issue, :project => project, :issue_type => stub_mo... |
github | tyne/tyne | https://github.com/tyne/tyne | spec/views/sprints/current.html.erb_spec.rb | Ruby | mit | 48 | master | 850 | require 'spec_helper'
describe "sprints/current.html.erb" do
let(:sprint) { sprints(:alpha) }
before :each do
assign(:sprint, sprint)
end
context "when collaborator" do
before :each do
view.stub(:is_collaborator?) { true }
end
it "renders a finish button" do
render
rendered.... |
github | tyne/tyne | https://github.com/tyne/tyne | spec/mailers/issue_mailer_spec.rb | Ruby | mit | 48 | master | 1,894 | require "spec_helper"
describe IssueMailer do
let(:issue) { issues(:foo) }
describe :issue_raised do
it "adds a background process for every contributor but the reporter" do
expect do
IssueMailer.send_issue_raised(issue.id)
end.to change(Sidekiq::Extensions::DelayedMailer.jobs, :size).by(1... |
github | tyne/tyne | https://github.com/tyne/tyne | spec/audit_formatters/audit_formatter_base_spec.rb | Ruby | mit | 48 | master | 330 | require 'spec_helper'
describe AuditFormatter::Base do
subject do
described_class.new(nil)
end
it "should have an abstract method for the base class" do
expect do
subject.format
end.to raise_error NotImplementedError
expect do
subject.icon
end.to raise_error NotImplementedError
... |
github | tyne/tyne | https://github.com/tyne/tyne | spec/audit_formatters/comment_audit_formatter_spec.rb | Ruby | mit | 48 | master | 517 | require 'spec_helper'
describe CommentAuditFormatter do
before :each do
Rails.application.config.stub(:assets_dir).and_return('/')
end
it "should format an comment audit" do
issue = issues(:foo)
comment = issue.comments.create(:message => "Foo") do |c|
c.user = issue.project.user
end
a... |
github | tyne/tyne | https://github.com/tyne/tyne | spec/audit_formatters/issue_audit_formatter_spec.rb | Ruby | mit | 48 | master | 1,357 | require 'spec_helper'
describe IssueAuditFormatter do
before :each do
Rails.application.config.stub(:assets_dir).and_return('/')
end
it "should format an issue audit" do
issue = create(:issue, :description => "baz")
audit = issue.audits.first
audit.stub(:user).and_return(issue.project.user)
... |
github | tyne/tyne | https://github.com/tyne/tyne | spec/markdown_preprocessors/issue_auto_link_spec.rb | Ruby | mit | 48 | master | 869 | require 'spec_helper'
describe MarkdownPreprocessors::IssueAutoLink do
it "should create project internal links" do
project = projects(:tyne)
issue = project.issues.first
subject.process("Foo ##{issue.number} Bar", project).should == "Foo [##{issue.number}](/Tobscher/TYNE/issues/#{issue.number}) Bar"
e... |
github | tyne/tyne | https://github.com/tyne/tyne | spec/helpers/teams_helper_spec.rb | Ruby | mit | 48 | master | 1,181 | require 'spec_helper'
describe TeamsHelper do
before :each do
@john = User.create!(:name => "John", :username => "John", :uid => "j", :token => "foo")
@bob = User.create!(:name => "Bob", :username => "Bob", :uid => "b", :token => "foo")
@sally = User.create!(:name => "Sally", :username => "Sally", :uid =... |
github | tyne/tyne | https://github.com/tyne/tyne | spec/helpers/application_helper_spec.rb | Ruby | mit | 48 | master | 607 | require 'spec_helper'
describe ApplicationHelper do
describe :markup_to_html do
it "should convert markdown into html" do
markdown = <<EOS
* Foo
* Bar
* Baz
EOS
content = helper.markup_to_html(markdown)
content.should have_selector("li", :count => 3)
end
end
describe :path_to_issue do
... |
github | tyne/tyne | https://github.com/tyne/tyne | spec/helpers/avatar_helper_spec.rb | Ruby | mit | 48 | master | 541 | require 'spec_helper'
describe AvatarHelper do
let(:user) { create(:user) }
let(:no_gravatar_user) { create(:user, :gravatar_id => nil) }
describe :avatar do
it "should return an image tag for the user's gravatar account" do
avatar = helper.avatar(user)
avatar.should =~ /img/
avatar.should... |
github | tyne/tyne | https://github.com/tyne/tyne | spec/helpers/issues_helper_spec.rb | Ruby | mit | 48 | master | 4,073 | require 'spec_helper'
describe IssuesHelper do
let(:user) { User.new(:name => "Foo", :username => "Foo") }
let(:issue) { Issue.new }
describe :issue_type do
it "should render a tag with the name of the reporter" do
issue.stub_chain(:issue_type, :name).and_return("Bug")
content = helper.issue_ty... |
github | tyne/tyne | https://github.com/tyne/tyne | spec/support/shared_examples_for_votable.rb | Ruby | mit | 48 | master | 2,060 | shared_examples_for :votable do
before :each do
subject.votes.destroy_all
end
describe :associations do
it { should have_many :votes }
end
describe '#upvotes' do
it 'should return the sum of all positive vote weights' do
user = User.last
weights = [-10, 1, 2, 3]
weights.each {|... |
github | tyne/tyne | https://github.com/tyne/tyne | spec/support/authentication.rb | Ruby | mit | 48 | master | 1,354 | shared_context 'authenticated' do
before :each do
@nickname = 'test'
OmniAuth.config.test_mode = true
OmniAuth.config.mock_auth[:github] = OmniAuth::AuthHash.new({
:provider => 'github',
:uid => '123545',
:info => { 'name' => 'test', :email => 'me@example.com', :nickname => ... |
github | tyne/tyne | https://github.com/tyne/tyne | spec/support/inputs.rb | Ruby | mit | 48 | master | 422 | module InputExampleGroup
extend ActiveSupport::Concern
include RSpec::Rails::HelperExampleGroup
def input_for(object, attribute_name, options={})
helper.simple_form_for object, url: '' do |f|
f.input attribute_name, options
end
end
end
RSpec.configure do |config|
config.include InputExampleGr... |
github | tyne/tyne | https://github.com/tyne/tyne | spec/inputs/datepicker_input_spec.rb | Ruby | mit | 48 | master | 295 | require 'spec_helper'
describe :datepicker do
before :each do
concat input_for(:foo, :start_date, :as => :datepicker)
end
it "should render an input" do
assert_select 'input[type="text"]'
end
it "should render an input" do
assert_select 'input[type="hidden"]'
end
end |
github | tyne/tyne | https://github.com/tyne/tyne | spec/inputs/suggest_input_spec.rb | Ruby | mit | 48 | master | 286 | require 'spec_helper'
describe :datepicker do
before :each do
concat input_for(:foo, :user, :as => :suggest)
end
it "should render an input" do
assert_select 'input[type="text"]'
end
it "should render an input" do
assert_select 'input[type="hidden"]'
end
end |
github | tyne/tyne | https://github.com/tyne/tyne | spec/controllers/projects_controller_spec.rb | Ruby | mit | 48 | master | 4,547 | require 'spec_helper'
describe ProjectsController do
its (:is_admin_area?) { should be_false }
context :not_logged_in do
it "should not allow any actions" do
post :create
response.should redirect_to login_path(:redirect_url => projects_path)
delete :destroy, :id => 1
response.should r... |
github | tyne/tyne | https://github.com/tyne/tyne | spec/controllers/team_members_controller_spec.rb | Ruby | mit | 48 | master | 2,642 | require 'spec_helper'
describe TeamMembersController do
its (:is_admin_area?) { should be_true }
context :private_project do
let(:user) { users(:tobscher) }
let(:project) { projects(:bluffr) }
before :each do
controller.stub(:current_user).and_return(user)
end
describe :privacy do
... |
github | tyne/tyne | https://github.com/tyne/tyne | spec/controllers/issues_controller_spec.rb | Ruby | mit | 48 | master | 10,330 | require 'spec_helper'
describe IssuesController do
context :private_project do
let(:user) { users(:tobscher) }
let(:project) { projects(:bluffr) }
let(:issue) { issues(:qux) }
before :each do
controller.stub(:current_user).and_return(user)
end
describe :privacy do
it "should res... |
github | tyne/tyne | https://github.com/tyne/tyne | spec/controllers/sprints_controller_spec.rb | Ruby | mit | 48 | master | 5,656 | require 'spec_helper'
describe SprintsController do
context :private_project do
let(:user) { users(:tobscher) }
let(:project) { projects(:bluffr) }
before :each do
controller.stub(:current_user).and_return(user)
end
describe :privacy do
it "should respond with 404 if user has no acc... |
github | tyne/tyne | https://github.com/tyne/tyne | spec/controllers/teams_controller_spec.rb | Ruby | mit | 48 | master | 1,769 | require 'spec_helper'
describe TeamsController do
its (:is_admin_area?) { should be_true }
context :private_project do
let(:user) { users(:tobscher) }
let(:project) { projects(:bluffr) }
before :each do
controller.stub(:current_user).and_return(user)
end
describe :privacy do
it "... |
github | tyne/tyne | https://github.com/tyne/tyne | spec/controllers/comments_controller_spec.rb | Ruby | mit | 48 | master | 1,191 | require 'spec_helper'
describe CommentsController do
context :private_project do
let(:user) { users(:tobscher) }
let(:project) { projects(:bluffr) }
let(:issue) { issues(:qux) }
before :each do
controller.stub(:current_user).and_return(user)
end
describe :privacy do
it "should r... |
github | tyne/tyne | https://github.com/tyne/tyne | spec/controllers/reports_controller_spec.rb | Ruby | mit | 48 | master | 1,978 | require 'spec_helper'
describe ReportsController do
context :private_project do
let(:user) { users(:tobscher) }
let(:project) { projects(:bluffr) }
before :each do
controller.stub(:current_user).and_return(user)
end
describe :privacy do
it "should respond with 404 if user has no acc... |
github | tyne/tyne | https://github.com/tyne/tyne | spec/controllers/dashboards_controller_spec.rb | Ruby | mit | 48 | master | 786 | require 'spec_helper'
describe DashboardsController do
context :not_logged_in do
it "should not allow any actions" do
get :index
response.should redirect_to login_path(:redirect_url => dashboards_path)
end
end
context :logged_in do
let(:user) { users(:tobscher) }
before :each do
... |
github | tyne/tyne | https://github.com/tyne/tyne | spec/controllers/sessions_controller_spec.rb | Ruby | mit | 48 | master | 1,854 | require 'spec_helper'
describe SessionsController do
before :each do
subject.stub(:current_user).and_return(User.new)
end
describe :destroy do
it "should clear the session" do
subject.session[:user_id] = :bar
delete :destroy
subject.session[:user_id].should be_nil
end
it "sh... |
github | tyne/tyne | https://github.com/tyne/tyne | spec/controllers/users_controller_spec.rb | Ruby | mit | 48 | master | 1,257 | require 'spec_helper'
describe UsersController do
let(:user) { users(:tobscher) }
before :each do
controller.stub(:current_user).and_return(user)
end
describe :overview do
it "should render the user page" do
get :overview, :user => user.username
response.should render_template("users/over... |
github | tyne/tyne | https://github.com/tyne/tyne | spec/controllers/labels_controller_spec.rb | Ruby | mit | 48 | master | 1,928 | require 'spec_helper'
describe LabelsController do
context :private_project do
let(:user) { users(:tobscher) }
let(:project) { projects(:bluffr) }
before :each do
controller.stub(:current_user).and_return(user)
end
describe :privacy do
it "responds with 404 if user has no access to ... |
github | tyne/tyne | https://github.com/tyne/tyne | spec/lib/auth_processor_spec.rb | Ruby | mit | 48 | master | 1,824 | require 'spec_helper'
describe AuthProcessor do
let(:auth_details) do
{
'uid' => "1",
'info' => {
'name' => "Foo",
'nickname' => "Bar",
'email' => "foo@bar.com"
},
'credentials' => {
'token' => "123456"
},
'extra' => {
'raw_info' => ... |
github | tyne/tyne | https://github.com/tyne/tyne | spec/lib/extensions/active_record/relation_spec.rb | Ruby | mit | 48 | master | 782 | require 'spec_helper'
describe ActiveRecord::Relation do
subject do
Project.scoped
end
describe :cache_key do
context :empty do
before :each do
subject.stub(:empty?).and_return(true)
end
it "should include empty in the cache key" do
subject.cache_key.should =~ /empty/
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.