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
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
lib/hydra_attribute.rb
Ruby
mit
181
master
986
require 'active_record' module HydraAttribute SUPPORTED_BACKEND_TYPES = %w[string text integer float decimal boolean datetime].freeze class << self def config @config ||= Configuration.new end def setup yield config end def identity_map Thread.current[:hydra_attribute] ||= ...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
lib/rails/generators/hydra_attribute/install/install_generator.rb
Ruby
mit
181
master
298
module HydraAttribute module Generators class InstallGenerator < Rails::Generators::Base source_root File.expand_path("../templates", __FILE__) def copy_initializer_file copy_file 'hydra_attribute.txt', 'config/initializers/hydra_attribute.rb' end end end end
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
lib/hydra_attribute/model.rb
Ruby
mit
181
master
1,194
require 'active_record/errors' require 'hydra_attribute/model/validations' require 'hydra_attribute/model/persistence' require 'hydra_attribute/model/mediator' require 'hydra_attribute/model/notifiable' require 'hydra_attribute/model/identity_map' require 'hydra_attribute/model/cacheable' require 'hydra_attribute/model...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
lib/hydra_attribute/configuration.rb
Ruby
mit
181
master
365
module HydraAttribute class Configuration def self.add_setting(name, default_value) attr_writer name class_eval <<-EOS, __FILE__, __LINE__ + 1 def #{name} @#{name} = #{default_value} unless defined?(@#{name}) @#{name} end def #{name}? #{name}.pre...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
lib/hydra_attribute/identity_map.rb
Ruby
mit
181
master
414
# TODO isn't thread safe module HydraAttribute class IdentityMap < Hash # Get value if key exists otherwise set a value # Block has a higher priority then value parameter # # @param [String, Symbol] key # @param [Object] value # @yield # @return [Object] def cache(key, value = nil) ...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
lib/hydra_attribute/hydra_entity_attribute_association.rb
Ruby
mit
181
master
5,642
module HydraAttribute class HydraEntityAttributeAssociation class WrongProxyMethodError < ArgumentError def initialize(method) super("Unknown :#{method} method") end end class AttributeWasNotSelectedError < ArgumentError def initialize(attribute_id) super("Attribute ID #...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
lib/hydra_attribute/active_record.rb
Ruby
mit
181
master
1,582
require 'hydra_attribute/active_record/attribute_methods' require 'hydra_attribute/active_record/migration' require 'hydra_attribute/active_record/relation' require 'hydra_attribute/active_record/scoping' require 'hydra_attribute/active_record/mass_assignment_security' module HydraAttribute module ActiveRecord e...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
lib/hydra_attribute/migrator.rb
Ruby
mit
181
master
4,428
module HydraAttribute class Migrator def initialize(migration) @migration = migration end class << self %w(create drop migrate rollback).each do |method| class_eval <<-EOS, __FILE__, __LINE__ + 1 def #{method}(migration, *args, &block) new(migration).#{method}(*...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
lib/hydra_attribute/hydra_attribute_set.rb
Ruby
mit
181
master
3,658
module HydraAttribute class HydraAttributeSet include ::HydraAttribute::Model define_cached_singleton_method :all_by_hydra_attribute_id, cache_key: :hydra_attribute_id, cache_value: :self, cache_key_cast: :to_i define_cached_singleton_method :all_by_hydra_set_id, c...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
lib/hydra_attribute/hydra_entity.rb
Ruby
mit
181
master
3,171
module HydraAttribute module HydraEntity class RelationDecorator def initialize(entity_type, model_class) @entity_type = entity_type @model_class = model_class end def create(attributes = {}) @model_class.create(attributes.merge(entity_type: @entity_type)) end ...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
lib/hydra_attribute/hydra_value.rb
Ruby
mit
181
master
6,534
module HydraAttribute class HydraValue # This error is raised when +:hydra_attribute_id+ key isn't passed to initialize. # This key is important for determination the type of attribute which this model represents. class HydraAttributeIdIsMissedError < ArgumentError def initialize(msg = 'Key :hydra_...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
lib/hydra_attribute/hydra_set.rb
Ruby
mit
181
master
1,374
module HydraAttribute # TODO add #build_entity and #create_entity methods class HydraSet # This error is raised when called method for attribute which doesn't exist in current hydra set # # @example # Product.hydra_attributes.create(name: 'price', backend_type: 'float') # Product.hydra_attr...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
lib/hydra_attribute/hydra_attribute.rb
Ruby
mit
181
master
1,134
module HydraAttribute class HydraAttribute # This error is raised when created +HydraAttribute::HydraAttribute+ models don't have this ID class UnknownHydraAttributeIdError < ArgumentError end include ::HydraAttribute::Model validates :entity_type, presence: true validates :name, p...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
lib/hydra_attribute/railtie.rb
Ruby
mit
181
master
457
module HydraAttribute class Railtie < Rails::Railtie initializer 'hydra_attribute.active_record' do ActiveSupport.on_load :active_record do ::ActiveRecord::Migration.send(:include, ::HydraAttribute::ActiveRecord::Migration) end end initializer 'hydra_attribute.middleware' do |app| ...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
lib/hydra_attribute/middleware/identity_map.rb
Ruby
mit
181
master
248
module HydraAttribute module Middleware class IdentityMap def initialize(app) @app = app end def call(env) @app.call(env) ensure ::HydraAttribute.identity_map.clear end end end end
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
lib/hydra_attribute/active_record/scoping.rb
Ruby
mit
181
master
346
module HydraAttribute module ActiveRecord module Scoping extend ActiveSupport::Concern module ClassMethods def scoped(options = nil) relation = super(options) relation.singleton_class.send(:include, Relation) unless relation.is_a?(Relation) relation end ...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
lib/hydra_attribute/active_record/attribute_methods.rb
Ruby
mit
181
master
1,705
module HydraAttribute module ActiveRecord module AttributeMethods extend ActiveSupport::Concern # Returns type casted attributes # # @return [Hash] def attributes super.merge(hydra_attributes) end # Returns attributes before type casting # # @return ...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
lib/hydra_attribute/active_record/mass_assignment_security.rb
Ruby
mit
181
master
1,315
module HydraAttribute module ActiveRecord module MassAssignmentSecurity class PermissionSet def initialize(entity, authorizer) @entity = entity @authorizer = authorizer end def deny?(attribute_name) hydra_attribute = hydra_attribute_by_name(attribu...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
lib/hydra_attribute/active_record/relation.rb
Ruby
mit
181
master
591
require 'hydra_attribute/active_record/relation/calculations' require 'hydra_attribute/active_record/relation/query_methods' require 'hydra_attribute/active_record/association_preloader' module HydraAttribute module ActiveRecord module Relation extend ActiveSupport::Concern included do inclu...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
lib/hydra_attribute/active_record/migration.rb
Ruby
mit
181
master
573
module HydraAttribute module ActiveRecord module Migration def create_hydra_entity(name, options = {}, &block) ::HydraAttribute::Migrator.create(self, name, options, &block) end def drop_hydra_entity(name) ::HydraAttribute::Migrator.drop(self, name) end def migrate_...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
lib/hydra_attribute/active_record/association_preloader.rb
Ruby
mit
181
master
4,122
module HydraAttribute module ActiveRecord class AssociationPreloader attr_reader :relation, :records def initialize(relation, records = []) @relation = relation @records = records end def self.run(relation, records) new(relation, records).run end def...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
lib/hydra_attribute/active_record/relation/calculations.rb
Ruby
mit
181
master
522
module HydraAttribute module ActiveRecord module Relation module Calculation extend ActiveSupport::Concern included do attr_accessor :hydra_attribute_performs_calculation end # Notifies +#build_arel+ method that it builds query for calculation def execute_...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
lib/hydra_attribute/active_record/relation/query_methods.rb
Ruby
mit
181
master
6,947
module HydraAttribute module ActiveRecord module Relation module QueryMethods extend ActiveSupport::Concern MULTI_VALUE_METHODS = [:hydra_joins_aliases, :hydra_select_values, :hydra_attributes] included do attr_writer *MULTI_VALUE_METHODS MULTI_VALUE_METHODS.ea...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
lib/hydra_attribute/model/persistence.rb
Ruby
mit
181
master
13,194
module HydraAttribute class RecordNotFound < ::ActiveRecord::RecordNotFound end module Model # @see HydraAttribute::Model::Persistence::ClassMethods ClassMethods for documentation module Persistence extend ActiveSupport::Concern module ClassMethods # Creates +Mutex+ object # ...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
lib/hydra_attribute/model/has_many_through.rb
Ruby
mit
181
master
6,003
module HydraAttribute module Model module HasManyThrough extend ActiveSupport::Concern class Relation def initialize(object, options = {}) @object = object @relation_class = options[:relation_class] @through_class = options[:through_class] @th...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
lib/hydra_attribute/model/cacheable.rb
Ruby
mit
181
master
7,185
module HydraAttribute module Model module Cacheable extend ActiveSupport::Concern included do register_nested_cache :model end module ClassMethods # Finds all records and store them into the cache # # @return [Array<HydraAttribute::Cacheable>] def ...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
lib/hydra_attribute/model/mediator.rb
Ruby
mit
181
master
2,528
module HydraAttribute module Model module Mediator extend ActiveSupport::Concern class << self # Holds all subscriptions # # @return [Hash] def subscriptions @subscriptions ||= Hash.new do |reporters, reporter| reporters[reporter] = Hash.new do |e...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
lib/hydra_attribute/model/identity_map.rb
Ruby
mit
181
master
1,629
module HydraAttribute module Model # @see HydraAttribute::Model::IdentityMap::ClassMethods ClassMethods for documentation module IdentityMap extend ActiveSupport::Concern module ClassMethods # Identity map key # # @return [Symbol] def identity_map_cache_key ...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
lib/hydra_attribute/model/validations.rb
Ruby
mit
181
master
1,252
module HydraAttribute module Model module Validations extend ActiveSupport::Concern include ActiveModel::Validations class UniqueValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) klass = record.class table = record.class.arel_table ...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
lib/hydra_attribute/model/notifiable.rb
Ruby
mit
181
master
490
module HydraAttribute module Model module Notifiable extend ActiveSupport::Concern private # Overwrite for notifying subscribed objects def create notify(:create) { super } end # Overwrite for notifying subscribed objects def update notify(...
github
kostyantyn/hydra_attribute
https://github.com/kostyantyn/hydra_attribute
lib/hydra_attribute/model/dirty.rb
Ruby
mit
181
master
983
module HydraAttribute module Model module Dirty extend ActiveSupport::Concern module ClassMethods # Defines dirty method # # @param [String] column_name # @return [NilClass] def define_attribute_method(column_name) super(column_name) class_e...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
Rakefile
Ruby
mit
180
master
223
namespace :bundler do require "bundler/gem_tasks" end require_relative 'lib/rubyrep' require_relative 'tasks/task_helper' Dir['tasks/**/*.rake'].each { |rake| load rake } load 'sims/performance/performance.rake'
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
rubyrep.gemspec
Ruby
mit
180
master
1,052
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'rubyrep/version' Gem::Specification.new do |spec| spec.name = "rubyrep" spec.version = RR::VERSION spec.authors = ["Arndt Lehmann"] spec.email = ["arndtlehman...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
Gemfile
Ruby
mit
180
master
477
source 'http://rubygems.org' gem 'activerecord', '~> 4.2' gem 'pg', platform: :ruby gem 'mysql2', platform: :ruby gem 'jdbc-postgres', platform: :jruby gem 'jdbc-mysql', platform: :jruby gem 'activerecord-jdbc-adapter', platform: :jruby gem 'activerecord-jdbcpostgresql-adapter', platform: :jruby gem 'activerecord-jd...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
tasks/rspec.rake
Ruby
mit
180
master
1,017
begin require 'rspec' rescue LoadError require 'rubygems' require 'rspec' end begin require 'rspec/core/rake_task' rescue LoadError puts <<-EOS To use rspec for testing you must install rspec gem: gem install rspec EOS exit(0) end task :spec do system "rspec spec" end namespace :spec do desc "Gene...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
tasks/database.rake
Ruby
mit
180
master
17,559
$LOAD_PATH.unshift File.dirname(__FILE__) + "../lib/rubyrep" require 'rake' require 'rubyrep' require_relative 'task_helper.rb' require_relative '../config/test_config' require_relative '../spec/spec_helper' # Creates the databases for the given configuration hash def create_database(config) begin RR::Connectio...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
tasks/task_helper.rb
Ruby
mit
180
master
540
# The standard ActiveRecord#create method ignores primary key attributes. # This module provides a create method that allows manual setting of primary key values. module CreateWithKey def self.included(base) base.extend(ClassMethods) end module ClassMethods # The standard "create" method ignores primary ...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
tasks/deployment.rake
Ruby
mit
180
master
1,041
desc 'Release the website and new gem version' task :deploy => [:check_version, :website, :release] do puts "Remember to create SVN tag:" puts "svn copy svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/trunk " + "svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/tags/REL-#{VERS} " put...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
tasks/redmine_test.rake
Ruby
mit
180
master
1,405
require 'fileutils' def install_redmine(database, name = nil) unless name install_redmine database, 'leftmine' install_redmine database, 'rightmine' else database = database.to_s database.sub!(/^postgres$/, 'postgresql') FileUtils.cd(File.expand_path("~")) unless File.exists?(name) sy...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
tasks/java.rake
Ruby
mit
180
master
1,213
namespace :deploy do desc "Create the java installation package" task :java do jruby_version='9.1.10.0' pkg_name = "rubyrep-#{RR::VERSION}" system "rm -rf /tmp/#{pkg_name}" system "mkdir /tmp/#{pkg_name}" system "git archive master |tar -x -C /tmp/#{pkg_name}" system "curl -o /tmp/#{pkg_na...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
sims/sim_helper.rb
Ruby
mit
180
master
995
# A helper class to print a text progress bar. class ProgressBar # Creates a new progress bar for a task consisting of +max+ steps. # At 100% the progress bar will be +bar_length+ characters wide. def initialize(max_steps, bar_length = 40) @max_steps, @bar_length, @current_progress = max_steps, bar_length, 0 ...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
sims/performance/big_sync_spec.rb
Ruby
mit
180
master
5,525
require 'benchmark' require File.dirname(__FILE__) + '/../../spec/spec_helper.rb' require File.dirname(__FILE__) + '/../sim_helper' include RR describe "Big Sync" do before(:each) do end # Calculates and returns number of records of a given type. # * :session: current Session instance # * :record_type: ty...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
sims/performance/performance.rake
Ruby
mit
180
master
6,907
require 'rake' require 'benchmark' require File.expand_path(File.dirname(__FILE__) + '/../sim_helper') # Prepares the database schema for the performance tests. def prepare_schema session = RR::Session.new [:left, :right].each do |database| c = session.send(database) [:big_scan, :big_rep, :big_rep_backup...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
sims/performance/big_rep_spec.rb
Ruby
mit
180
master
4,052
require 'benchmark' require File.dirname(__FILE__) + '/../../spec/spec_helper.rb' require File.dirname(__FILE__) + '/../sim_helper' include RR describe "Big Rep" do before(:each) do end # Calculates and returns the number of records of the specified table. # * +session+ current Session instance # * +datab...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
sims/performance/big_scan_spec.rb
Ruby
mit
180
master
1,996
require 'benchmark' require File.dirname(__FILE__) + '/../../spec/spec_helper.rb' require File.dirname(__FILE__) + '/../sim_helper' include RR describe "Big Scan" do before(:each) do end # Runs a scan of the big_scan table def run_scan session = Session.new expected_result = {} expected_result[:...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/scan_runner_spec.rb
Ruby
mit
180
master
1,589
require 'spec_helper' include RR describe ScanRunner do before(:each) do end it "should register itself with CommandRunner" do CommandRunner.commands['scan'][:command].should == ScanRunner CommandRunner.commands['scan'][:description].should be_an_instance_of(String) end it "execute should scan the...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/scan_progress_printers_spec.rb
Ruby
mit
180
master
2,532
require 'spec_helper' include RR describe ScanProgressPrinters do before(:each) do end it "report_printers should an empty hash if there are no registered printers" do org_printers = ScanProgressPrinters.printers begin ScanProgressPrinters.instance_eval { class_variable_set :@@progress_printers, ...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/postgresql_support_spec.rb
Ruby
mit
180
master
3,528
require 'spec_helper' include RR describe "PostgreSQL support" do before(:each) do Initializer.configuration = standard_config end after(:each) do end if standard_config.left[:adapter] == 'postgresql' it "should read & write microsecond times" do session = nil begin session = ...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/scan_summary_reporter_spec.rb
Ruby
mit
180
master
2,089
require 'spec_helper' include RR describe ScanReportPrinters::ScanSummaryReporter do it "should register itself with ScanRunner" do RR::ScanReportPrinters.printers.any? do |printer| printer[:printer_class] == ScanReportPrinters::ScanSummaryReporter end.should be true end it "initialize should d...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/two_way_syncer_spec.rb
Ruby
mit
180
master
9,547
require 'spec_helper' include RR describe Syncers::TwoWaySyncer do before(:each) do Initializer.configuration = deep_copy(standard_config) Initializer.configuration.options = {:syncer => :two_way} end it "should register itself" do Syncers::syncers[:two_way].should == Syncers::TwoWaySyncer end ...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/base_runner_spec.rb
Ruby
mit
180
master
8,241
require 'spec_helper' include RR describe BaseRunner do before(:each) do end it "process_options should make options as nil and teturn status as 1 if command line parameters are unknown" do # also verify that an error message is printed $stderr.should_receive(:puts).at_least(1).times runner = BaseR...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/connection_extender_interface.rb
Ruby
mit
180
master
5,738
# encoding: UTF-8 require 'spec_helper' require 'yaml' require 'digest/md5' include RR # All ConnectionExtenders need to pass this spec shared_examples "ConnectionExtender" do before(:each) do end it "primary_key_names should return primary key names ordered as per primary key index" do session = Session....
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/proxied_table_scan_spec.rb
Ruby
mit
180
master
5,584
require 'spec_helper' include RR describe ProxiedTableScan do before(:each) do Initializer.configuration = deep_copy(proxied_config) # Small block size necessary to exercize all code paths in ProxiedTableScan # even when only using tables with very small number of records. Initializer.configuration...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/replication_initializer_spec.rb
Ruby
mit
180
master
19,441
require 'spec_helper' include RR describe ReplicationInitializer do before(:each) do Initializer.configuration = standard_config end after(:each) do end it "initializer should store the session" do session = Session.new initializer = ReplicationInitializer.new session initializer.session.s...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/log_helper_spec.rb
Ruby
mit
180
master
1,169
require 'spec_helper' include RR class MyLogHelper include LogHelper end describe LogHelper do before(:each) do end it "should do nothing if the description fields are small enough" do MyLogHelper.new.fit_description_columns("bla", "blub"). should == %w(bla blub) end it "should cut details to...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/table_scan_helper_spec.rb
Ruby
mit
180
master
1,739
require 'spec_helper' include RR describe TableScanHelper do before(:each) do @scan = Object.new @scan.extend TableScanHelper end it "rank_rows should calculate the correct rank of rows based on their primary keys" do @scan.stub(:primary_key_names).and_return(['first_id', 'second_id']) @scan.ra...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/sync_helper_spec.rb
Ruby
mit
180
master
6,181
require 'spec_helper' include RR describe SyncHelper do before(:each) do Initializer.configuration = standard_config end it "initialize should initialize the correct committer" do sync = TableSync.new(Session.new, 'scanner_records') helper = SyncHelper.new(sync) c = helper.instance_eval {commit...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/command_runner_spec.rb
Ruby
mit
180
master
4,484
require 'spec_helper' include RR describe CommandRunner do before(:each) do @org_commands = CommandRunner.commands CommandRunner.instance_variable_set :@commands, nil end after(:each) do CommandRunner.instance_variable_set :@commands, @org_commands end it "show_version should print the version...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/table_spec_resolver_spec.rb
Ruby
mit
180
master
3,761
require 'spec_helper' include RR describe TableSpecResolver do before(:each) do Initializer.configuration = standard_config @session = Session.new @resolver = TableSpecResolver.new @session end it "initialize should store the session and cache the tables of the session" do @resolver.session.sho...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/task_sweeper_spec.rb
Ruby
mit
180
master
1,024
require 'spec_helper' include RR describe TaskSweeper do before(:each) do end it "should execute the given task" do x = nil TaskSweeper.timeout(1) {|sweeper| x = 1} x.should == 1 end it "should raise exceptions thrown by the task" do lambda { TaskSweeper.timeout(1) {raise "bla"} ...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/generate_runner_spec.rb
Ruby
mit
180
master
2,705
require 'spec_helper' include RR describe GenerateRunner do before(:each) do end it "should register itself with CommandRunner" do CommandRunner.commands['generate'][:command].should == GenerateRunner CommandRunner.commands['generate'][:description].should be_an_instance_of(String) end it "process...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/progress_bar_spec.rb
Ruby
mit
180
master
2,481
require 'spec_helper' include RR include ScanProgressPrinters describe ProgressBar do before(:each) do @org_stdout = $stdout $stdout = StringIO.new @old_arg = ProgressBar.arg end after(:each) do ProgressBar.arg = @old_arg $stdout = @org_stdout end it "arg should store the command line ...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/proxy_row_cursor_spec.rb
Ruby
mit
180
master
2,109
require 'spec_helper' include RR describe ProxyRowCursor do before(:each) do Initializer.configuration = standard_config end it "initialize should super to ProxyCursor" do session = create_mock_proxy_connection 'dummy_table', ['dummy_id'] cursor = ProxyRowCursor.new session, 'dummy_table' curso...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/direct_table_scan_spec.rb
Ruby
mit
180
master
2,023
require 'spec_helper' include RR describe DirectTableScan do before(:each) do Initializer.configuration = standard_config end it "run should compare all the records in the table" do session = Session.new scan = DirectTableScan.new session, 'scanner_records' diff = [] scan.run do |type, row|...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/two_way_replicator_spec.rb
Ruby
mit
180
master
26,650
require 'spec_helper' include RR describe Replicators::TwoWayReplicator do before(:each) do Initializer.configuration = deep_copy(standard_config) Initializer.configuration.options = {:replicator => :two_way} end it "should register itself" do Replicators::replicators[:two_way].should == Replicator...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/uninstall_runner_spec.rb
Ruby
mit
180
master
3,139
require 'spec_helper' include RR describe UninstallRunner do before(:each) do end it "should register itself with CommandRunner" do CommandRunner.commands['uninstall'][:command].should == UninstallRunner CommandRunner.commands['uninstall'][:description].should be_an_instance_of(String) end it "pro...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/database_rake_spec.rb
Ruby
mit
180
master
1,304
require 'spec_helper' load File.dirname(__FILE__) + '/../tasks/database.rake' describe "database.rake" do before(:each) do end it "create_database should create a non-existing database" do RR::ConnectionExtenders.should_receive(:db_connect).and_raise("something") should_receive("`").with("createdb \"du...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/logged_change_spec.rb
Ruby
mit
180
master
14,495
require 'spec_helper' include RR describe LoggedChange do before(:each) do Initializer.configuration = standard_config end it "initialize should store session and database" do session = Session.new loader = LoggedChangeLoader.new session, :left change = LoggedChange.new loader change.sessio...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/table_sync_spec.rb
Ruby
mit
180
master
5,236
require 'spec_helper' include RR describe TableSync do it "sync_options should return the correct table specific sync options" do config = deep_copy(standard_config) old_table_specific_options = config.tables_with_options begin config.options = {:syncer => :bla} config.include_tables 'scanne...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/db_specific_connection_extenders_spec.rb
Ruby
mit
180
master
501
require 'spec_helper' require 'yaml' require 'connection_extender_interface.rb' include RR extenders = [:mysql, :postgres] extenders.each do |extender| describe "#{extender.to_s.capitalize} Connection Extender" do before(:each) do @org_test_db = ENV['RR_TEST_DB'] ENV['RR_TEST_DB'] = extender.to_s...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/replication_helper_spec.rb
Ruby
mit
180
master
7,698
require 'bigdecimal' require 'spec_helper' include RR describe ReplicationHelper do before(:each) do Initializer.configuration = standard_config end it "initialize should initialize the correct committer" do session = Session.new rep_run = ReplicationRun.new(session, TaskSweeper.new(1)) helper...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/postgresql_schema_support_spec.rb
Ruby
mit
180
master
7,614
require 'spec_helper' include RR require File.dirname(__FILE__) + "/../config/test_config.rb" describe "PostgreSQL schema support" do before(:each) do config = deep_copy(standard_config) config.options[:rep_prefix] = 'rx' config.left[:schema_search_path] = 'rr' config.right[:schema_search_path] = '...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/type_casting_cursor_spec.rb
Ruby
mit
180
master
2,155
require File.dirname(__FILE__) + '/spec_helper.rb' include RR describe TypeCastingCursor do before(:each) do Initializer.configuration = standard_config end it "initialize should cache the provided cursor and the retrieved Column objects" do cursor = TypeCastingCursor.new Session.new.left, 'extender_ty...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/proxy_block_cursor_spec.rb
Ruby
mit
180
master
6,650
require 'spec_helper' include RR describe ProxyBlockCursor do before(:each) do @session = create_mock_proxy_connection 'dummy_table', ['dummy_id'] @cursor = ProxyBlockCursor.new @session, 'dummy_table' end it "initialize should super to ProxyCursor" do @cursor.table.should == 'dummy_table' ...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/replication_difference_spec.rb
Ruby
mit
180
master
5,056
require 'spec_helper' include RR describe ReplicationDifference do before(:each) do Initializer.configuration = standard_config end it "initialize should store the loaders" do session = Session.new loaders = LoggedChangeLoaders.new session diff = ReplicationDifference.new loaders diff.loade...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/proxy_runner_spec.rb
Ruby
mit
180
master
2,543
require 'spec_helper' include RR describe ProxyRunner do before(:each) do DRb.stub(:start_service) $stderr.stub(:puts) end it "get_options should return options as nil and status as 1 if command line parameters are unknown" do # also verify that an error message is printed $stderr.should_receiv...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/scan_report_printers_spec.rb
Ruby
mit
180
master
2,378
require 'spec_helper' include RR describe ScanReportPrinters do before(:each) do end it "report_printers should an empty array if there are no registered printers" do org_printers = ScanReportPrinters.printers begin ScanReportPrinters.instance_eval { class_variable_set :@@report_printers, nil } ...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/replication_run_spec.rb
Ruby
mit
180
master
14,517
require 'spec_helper' include RR describe ReplicationRun do before(:each) do Initializer.configuration = standard_config end it "initialize should store the provided session" do session = Session.new sweeper = TaskSweeper.new 1 run = ReplicationRun.new session, sweeper run.session.should ==...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/replication_extenders_spec.rb
Ruby
mit
180
master
900
require 'spec_helper' include RR describe ReplicationExtenders do before(:each) do Initializer.configuration = standard_config @old_cache_status = ConnectionExtenders.use_db_connection_cache(false) end after(:each) do ConnectionExtenders.use_db_connection_cache(@old_cache_status) end it "ext...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/replicators_spec.rb
Ruby
mit
180
master
1,076
require 'spec_helper' include RR describe Replicators do before(:each) do @old_replicators = Replicators.replicators end after(:each) do Replicators.instance_variable_set :@replicators, @old_replicators end it "replicators should return empty hash if nil" do Replicators.instance_variable_set :...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/db_specific_replication_extenders_spec.rb
Ruby
mit
180
master
609
require 'spec_helper' require 'yaml' require 'replication_extender_interface.rb' require 'postgresql_replication.rb' include RR extenders = [:postgres, :mysql] extenders.each do |extender| describe "#{extender.to_s.capitalize} Replication Extender" do before(:each) do @org_test_db = ENV['RR_TEST_DB'] ...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/committers_spec.rb
Ruby
mit
180
master
6,282
require 'spec_helper' include RR describe Committers do before(:each) do @old_committers = Committers.committers end after(:each) do Committers.instance_variable_set :@committers, @old_committers end it "committers should return empty hash if nil" do Committers.instance_variable_set :@commit...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/replication_runner_spec.rb
Ruby
mit
180
master
8,676
require 'spec_helper' include RR describe ReplicationRunner do before(:each) do Initializer.configuration = standard_config end it "should register itself with CommandRunner" do CommandRunner.commands['replicate'][:command].should == ReplicationRunner CommandRunner.commands['replicate'][:descriptio...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/proxy_connection_spec.rb
Ruby
mit
180
master
15,399
require 'spec_helper' include RR describe ProxyConnection do before(:each) do Initializer.configuration = proxied_config @connection = ProxyConnection.new Initializer.configuration.left end it "initialize should connect to the database" do (!!@connection.connection.active?).should == true end ...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/syncers_spec.rb
Ruby
mit
180
master
6,667
require 'spec_helper' include RR describe Syncers do before(:each) do @old_syncers = Syncers.syncers end after(:each) do Syncers.instance_variable_set :@syncers, @old_syncers end it "syncers should return empty hash if nil" do Syncers.instance_variable_set :@syncers, nil Syncers.syncers.sh...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/logged_change_loader_spec.rb
Ruby
mit
180
master
1,974
require 'spec_helper' include RR describe LoggedChangeLoaders do before(:each) do Initializer.configuration = standard_config end it "initializers should create both logged change loaders" do session = Session.new loaders = LoggedChangeLoaders.new(session) loaders[:left].session.should == sessi...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/spec_helper.rb
Ruby
mit
180
master
8,549
begin require 'rspec' rescue LoadError require 'rubygems' gem 'rspec' require 'rspec' end if ENV['COVERAGE'] require 'simplecov' SimpleCov.add_filter 'tasks/*' SimpleCov.start end require 'drb' require 'digest/sha1' $LOAD_PATH.unshift File.join(File.dirname(__FILE__), "..", "lib") $LOAD_PATH.unshift Fi...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/table_scan_spec.rb
Ruby
mit
180
master
1,751
require 'spec_helper' include RR describe TableScan do before(:each) do Initializer.configuration = standard_config end it "initialize should raise exception if table doesn't have primary keys" do session = Session.new lambda {TableScan.new session, 'extender_without_key'} \ .should raise_err...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/postgresql_replication.rb
Ruby
mit
180
master
1,319
require 'spec_helper' require 'yaml' include RR shared_examples "PostgreSQLReplication" do before(:each) do end it "create_replication_trigger should also work if language plpgsql does not yet exist" do session = nil begin session = Session.new session.left.begin_db_transaction unles...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/connection_extenders_registration_spec.rb
Ruby
mit
180
master
5,139
require 'spec_helper' include RR describe ConnectionExtenders do before(:each) do Initializer.configuration = standard_config end it "db_connect should install the already created logger" do configuration = deep_copy(Initializer.configuration) io = StringIO.new logger = ActiveSupport::Logger.ne...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/database_proxy_spec.rb
Ruby
mit
180
master
1,200
require 'spec_helper' include RR describe DatabaseProxy do before(:each) do Initializer.configuration = standard_config end it "initialize should create an empty session regiser" do proxy = DatabaseProxy.new proxy.session_register.should == {} end def create_proxy_and_session proxy = Data...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/session_spec.rb
Ruby
mit
180
master
9,454
require 'spec_helper' require 'yaml' include RR describe Session do # database connection caching is disabled before(:each) do Initializer.configuration = standard_config @old_cache_status = ConnectionExtenders.use_db_connection_cache(false) end after(:each) do ConnectionExtenders.use_db_connect...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/table_sorter_spec.rb
Ruby
mit
180
master
739
require 'spec_helper' include RR describe TableSorter do before(:each) do end it "sort should order the tables correctly" do tables = [ 'scanner_records', 'referencing_table', 'referenced_table', 'scanner_text_key', ] sorter = TableSorter.new Session.new(standard_config), t...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/noisy_connection_spec.rb
Ruby
mit
180
master
2,641
require File.dirname(__FILE__) + '/spec_helper.rb' include RR describe NoisyConnection do before(:each) do Initializer.configuration = proxied_config @connection = ProxyConnection.new Initializer.configuration.left @connection.send(:extend, NoisyConnection) @connection.sweeper = TaskSweeper.new(1) ...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/scan_detail_reporter_spec.rb
Ruby
mit
180
master
3,953
require 'spec_helper' include RR describe ScanReportPrinters::ScanDetailReporter do before(:each) do Initializer.configuration = standard_config end it "should register itself with ScanRunner" do RR::ScanReportPrinters.printers.any? do |printer| printer[:printer_class] == ScanReportPrinters::Scan...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/trigger_mode_switcher_spec.rb
Ruby
mit
180
master
2,785
require 'spec_helper' include RR describe TriggerModeSwitcher do before(:each) do Initializer.configuration = standard_config end it "initialize should save the session and initialize triggers hash" do session = Session.new switcher = TriggerModeSwitcher.new(session) switcher.session.should == ...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/replication_extender_interface.rb
Ruby
mit
180
master
14,956
require 'spec_helper' require 'yaml' include RR # All ReplicationExtenders need to pass this spec shared_examples "ReplicationExtender" do before(:each) do end it "create_replication_trigger created triggers should log data changes" do session = nil begin session = Session.new session.left...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/proxy_cursor_spec.rb
Ruby
mit
180
master
1,917
require 'spec_helper' include RR describe ProxyCursor do before(:each) do Initializer.configuration = proxied_config end it "initialize should store session and table and cache the primary keys of table" do connection = create_mock_proxy_connection 'dummy_table', ['dummy_key'] cursor = ProxyCu...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/configuration_spec.rb
Ruby
mit
180
master
7,044
require 'spec_helper' include RR describe Configuration do before(:each) do end it "initialize should set #left and #right to empty hashes" do config = Configuration.new config.left.should == {} config.right.should == {} end it "initialize should set #options to the default options" do c...
github
rubyrep/rubyrep
https://github.com/rubyrep/rubyrep
spec/initializer_spec.rb
Ruby
mit
180
master
1,125
require 'spec_helper' include RR describe Initializer do it "should have an empty configuration" do Initializer::configuration.should be_an_instance_of(Configuration) end end describe Initializer do before(:each) do Initializer::reset end it "run should yield the configuration object" do Initi...