ardb 0.24.0 → 0.25.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -20,6 +20,25 @@ class Ardb::Adapter::Base
20
20
  def create_db(*args); raise NotImplementedError; end
21
21
  def drop_db(*args); raise NotImplementedError; end
22
22
 
23
+ def migrate_db
24
+ verbose = ENV["MIGRATE_QUIET"].nil?
25
+ version = ENV["MIGRATE_VERSION"] ? ENV["MIGRATE_VERSION"].to_i : nil
26
+ migrations_path = Ardb.config.migrations_path
27
+
28
+ if defined?(ActiveRecord::Migration::CommandRecorder)
29
+ require 'ardb/migration_helpers'
30
+ ActiveRecord::Migration::CommandRecorder.class_eval do
31
+ include Ardb::MigrationHelpers::RecorderMixin
32
+ end
33
+ end
34
+
35
+ ActiveRecord::Migrator.migrations_path = migrations_path
36
+ ActiveRecord::Migration.verbose = verbose
37
+ ActiveRecord::Migrator.migrate(migrations_path, version) do |migration|
38
+ ENV["MIGRATE_SCOPE"].blank? || (ENV["MIGRATE_SCOPE"] == migration.scope)
39
+ end
40
+ end
41
+
23
42
  def drop_tables(*args); raise NotImplementedError; end
24
43
 
25
44
  def load_schema
@@ -17,21 +17,43 @@ module Ardb
17
17
 
18
18
  module InstanceMethods
19
19
 
20
- attr_accessor :drop_tables_called_count, :load_schema_called_count
20
+ attr_accessor :drop_tables_called_count
21
+ attr_accessor :dump_schema_called_count, :load_schema_called_count
21
22
  attr_accessor :drop_db_called_count, :create_db_called_count
23
+ attr_accessor :migrate_db_called_count
22
24
 
23
25
  def drop_tables_called_count
24
26
  @drop_tables_called_count ||= 0
25
27
  end
26
28
 
29
+ def drop_tables_called?
30
+ self.drop_tables_called_count > 0
31
+ end
32
+
27
33
  def drop_tables(*args, &block)
28
34
  self.drop_tables_called_count += 1
29
35
  end
30
36
 
37
+ def dump_schema_called_count
38
+ @dump_schema_called_count ||= 0
39
+ end
40
+
41
+ def dump_schema_called?
42
+ self.dump_schema_called_count > 0
43
+ end
44
+
45
+ def dump_schema(*args, &block)
46
+ self.dump_schema_called_count += 1
47
+ end
48
+
31
49
  def load_schema_called_count
32
50
  @load_schema_called_count ||= 0
33
51
  end
34
52
 
53
+ def load_schema_called?
54
+ self.load_schema_called_count > 0
55
+ end
56
+
35
57
  def load_schema(*args, &block)
36
58
  self.load_schema_called_count += 1
37
59
  end
@@ -40,6 +62,10 @@ module Ardb
40
62
  @drop_db_called_count ||= 0
41
63
  end
42
64
 
65
+ def drop_db_called?
66
+ self.drop_db_called_count > 0
67
+ end
68
+
43
69
  def drop_db(*args, &block)
44
70
  self.drop_db_called_count += 1
45
71
  end
@@ -48,10 +74,26 @@ module Ardb
48
74
  @create_db_called_count ||= 0
49
75
  end
50
76
 
77
+ def create_db_called?
78
+ self.create_db_called_count > 0
79
+ end
80
+
51
81
  def create_db(*args, &block)
52
82
  self.create_db_called_count += 1
53
83
  end
54
84
 
85
+ def migrate_db_called_count
86
+ @migrate_db_called_count ||= 0
87
+ end
88
+
89
+ def migrate_db_called?
90
+ self.migrate_db_called_count > 0
91
+ end
92
+
93
+ def migrate_db(*args, &block)
94
+ self.migrate_db_called_count += 1
95
+ end
96
+
55
97
  end
56
98
 
57
99
  end
@@ -0,0 +1,104 @@
1
+ module Ardb
2
+
3
+ module HasSlug
4
+
5
+ DEFAULT_ATTRIBUTE = :slug
6
+ DEFAULT_PREPROCESSOR = :downcase
7
+ DEFAULT_SEPARATOR = '-'.freeze
8
+
9
+ def self.included(klass)
10
+ klass.class_eval do
11
+ extend ClassMethods
12
+ include InstanceMethods
13
+
14
+ @ardb_has_slug_config = {}
15
+
16
+ end
17
+ end
18
+
19
+ module ClassMethods
20
+
21
+ def has_slug(options = nil)
22
+ options ||= {}
23
+ raise(ArgumentError, "a source must be provided") unless options[:source]
24
+
25
+ @ardb_has_slug_config.merge!({
26
+ :attribute => options[:attribute] || DEFAULT_ATTRIBUTE,
27
+ :source_proc => options[:source].to_proc,
28
+ :preprocessor_proc => (options[:preprocessor] || DEFAULT_PREPROCESSOR).to_proc,
29
+ :separator => options[:separator] || DEFAULT_SEPARATOR,
30
+ :allow_underscores => !!options[:allow_underscores]
31
+ })
32
+
33
+ # since the slug isn't written till an after callback we can't always
34
+ # validate presence of it
35
+ validates_presence_of(self.ardb_has_slug_config[:attribute], :on => :update)
36
+ validates_uniqueness_of(self.ardb_has_slug_config[:attribute], {
37
+ :case_sensitive => true,
38
+ :scope => options[:unique_scope]
39
+ })
40
+
41
+ after_create :ardb_has_slug_generate_slug
42
+ after_update :ardb_has_slug_generate_slug
43
+ end
44
+
45
+ def ardb_has_slug_config
46
+ @ardb_has_slug_config
47
+ end
48
+
49
+ end
50
+
51
+ module InstanceMethods
52
+
53
+ private
54
+
55
+ def reset_slug
56
+ self.send("#{self.class.ardb_has_slug_config[:attribute]}=", nil)
57
+ end
58
+
59
+ def ardb_has_slug_generate_slug
60
+ attr_name = self.class.ardb_has_slug_config[:attribute]
61
+ slug_source = if !self.send(attr_name) || self.send(attr_name).to_s.empty?
62
+ self.instance_eval(&self.class.ardb_has_slug_config[:source_proc])
63
+ else
64
+ self.send(attr_name)
65
+ end
66
+
67
+ generated_slug = Slug.new(slug_source, {
68
+ :preprocessor => self.class.ardb_has_slug_config[:preprocessor_proc],
69
+ :separator => self.class.ardb_has_slug_config[:separator],
70
+ :allow_underscores => self.class.ardb_has_slug_config[:allow_underscores]
71
+ })
72
+ return if self.send(attr_name) == generated_slug
73
+ self.send("#{attr_name}=", generated_slug)
74
+ self.update_column(attr_name, generated_slug)
75
+ end
76
+
77
+ end
78
+
79
+ module Slug
80
+ DEFAULT_PREPROCESSOR = proc{ |slug| slug } # no-op
81
+
82
+ def self.new(string, options = nil)
83
+ options ||= {}
84
+ preprocessor = options[:preprocessor] || DEFAULT_PREPROCESSOR
85
+ separator = options[:separator] || DEFAULT_SEPARATOR
86
+ allow_underscores = options[:allow_underscores]
87
+ regexp_escaped_sep = Regexp.escape(separator)
88
+
89
+ slug = preprocessor.call(string.to_s)
90
+ # Turn unwanted chars into the separator
91
+ slug.gsub!(/[^\w#{regexp_escaped_sep}]+/, separator)
92
+ # Turn underscores into the separator, unless allowing
93
+ slug.gsub!(/_/, separator) unless allow_underscores
94
+ # No more than one of the separator in a row.
95
+ slug.gsub!(/#{regexp_escaped_sep}{2,}/, separator)
96
+ # Remove leading/trailing separator.
97
+ slug.gsub!(/\A#{regexp_escaped_sep}|#{regexp_escaped_sep}\z/, '')
98
+ slug
99
+ end
100
+ end
101
+
102
+ end
103
+
104
+ end
@@ -3,19 +3,21 @@ require 'ardb/runner'
3
3
 
4
4
  class Ardb::Runner::CreateCommand
5
5
 
6
- def initialize
6
+ def initialize(out_io = nil, err_io = nil)
7
+ @out_io = out_io || $stdout
8
+ @err_io = err_io || $stderr
7
9
  @adapter = Ardb::Adapter.send(Ardb.config.db.adapter)
8
10
  end
9
11
 
10
12
  def run
11
13
  begin
12
14
  @adapter.create_db
13
- $stdout.puts "created #{Ardb.config.db.adapter} db `#{Ardb.config.db.database}`"
15
+ @out_io.puts "created #{Ardb.config.db.adapter} db `#{Ardb.config.db.database}`"
14
16
  rescue Ardb::Runner::CmdError => e
15
17
  raise e
16
- rescue Exception => e
17
- $stderr.puts e
18
- $stderr.puts "error creating #{Ardb.config.db.database.inspect} database"
18
+ rescue StandardError => e
19
+ @err_io.puts e
20
+ @err_io.puts "error creating #{Ardb.config.db.database.inspect} database"
19
21
  raise Ardb::Runner::CmdFail
20
22
  end
21
23
  end
@@ -3,19 +3,21 @@ require 'ardb/runner'
3
3
 
4
4
  class Ardb::Runner::DropCommand
5
5
 
6
- def initialize
6
+ def initialize(out_io = nil, err_io = nil)
7
+ @out_io = out_io || $stdout
8
+ @err_io = err_io || $stderr
7
9
  @adapter = Ardb::Adapter.send(Ardb.config.db.adapter)
8
10
  end
9
11
 
10
12
  def run
11
13
  begin
12
14
  @adapter.drop_db
13
- $stdout.puts "dropped #{Ardb.config.db.adapter} db `#{Ardb.config.db.database}`"
15
+ @out_io.puts "dropped #{Ardb.config.db.adapter} db `#{Ardb.config.db.database}`"
14
16
  rescue Ardb::Runner::CmdError => e
15
17
  raise e
16
- rescue Exception => e
17
- $stderr.puts e
18
- $stderr.puts "error dropping #{Ardb.config.db.database.inspect} database"
18
+ rescue StandardError => e
19
+ @err_io.puts e
20
+ @err_io.puts "error dropping #{Ardb.config.db.database.inspect} database"
19
21
  raise Ardb::Runner::CmdFail
20
22
  end
21
23
  end
@@ -1,47 +1,28 @@
1
1
  require 'fileutils'
2
2
  require 'active_record'
3
3
  require 'ardb/runner'
4
- require 'ardb/migration_helpers'
5
4
 
6
5
  class Ardb::Runner::MigrateCommand
7
6
 
8
- attr_reader :migrations_path, :version, :verbose
9
-
10
- def initialize
7
+ def initialize(out_io = nil, err_io = nil)
8
+ @out_io = out_io || $stdout
9
+ @err_io = err_io || $stderr
11
10
  @adapter = Ardb::Adapter.send(Ardb.config.db.adapter)
12
- @migrations_path = Ardb.config.migrations_path
13
- @version = ENV["VERSION"] ? ENV["VERSION"].to_i : nil
14
- @verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : true
15
11
  end
16
12
 
17
13
  def run
18
14
  begin
19
15
  Ardb.init
20
- migrate_the_db
16
+ @adapter.migrate_db
17
+ @adapter.dump_schema
21
18
  rescue Ardb::Runner::CmdError => e
22
19
  raise e
23
- rescue Exception => e
24
- $stderr.puts "error migrating #{Ardb.config.db.database.inspect} database"
25
- $stderr.puts e
26
- $stderr.puts e.backtrace
20
+ rescue StandardError => e
21
+ @err_io.puts "error migrating #{Ardb.config.db.database.inspect} database"
22
+ @err_io.puts e
23
+ @err_io.puts e.backtrace
27
24
  raise Ardb::Runner::CmdFail
28
25
  end
29
26
  end
30
27
 
31
- def migrate_the_db
32
- if defined?(ActiveRecord::Migration::CommandRecorder)
33
- ActiveRecord::Migration::CommandRecorder.class_eval do
34
- include Ardb::MigrationHelpers::RecorderMixin
35
- end
36
- end
37
-
38
- ActiveRecord::Migrator.migrations_path = @migrations_path
39
- ActiveRecord::Migration.verbose = @verbose
40
- ActiveRecord::Migrator.migrate(@migrations_path, @version) do |migration|
41
- ENV["SCOPE"].blank? || (ENV["SCOPE"] == migration.scope)
42
- end
43
-
44
- @adapter.dump_schema
45
- end
46
-
47
28
  end
@@ -16,9 +16,42 @@ module Ardb::TestHelpers
16
16
  Ardb.adapter.load_schema
17
17
  end
18
18
 
19
- def reset_db!
20
- Ardb.adapter.drop_db
19
+ def create_db!
21
20
  Ardb.adapter.create_db
21
+ end
22
+
23
+ def create_db
24
+ @create_db ||= begin
25
+ self.create_db!
26
+ true
27
+ end
28
+ end
29
+
30
+ def drop_db!
31
+ Ardb.adapter.drop_db
32
+ end
33
+
34
+ def drop_db
35
+ @drop_db ||= begin
36
+ self.drop_db!
37
+ true
38
+ end
39
+ end
40
+
41
+ def migrate_db!
42
+ Ardb.adapter.migrate_db
43
+ end
44
+
45
+ def migrate_db
46
+ @migrate_db ||= begin
47
+ self.migrate_db!
48
+ true
49
+ end
50
+ end
51
+
52
+ def reset_db!
53
+ self.drop_db!
54
+ self.create_db!
22
55
  self.load_schema
23
56
  end
24
57
 
@@ -16,7 +16,7 @@ module Ardb
16
16
 
17
17
  module ClassMethods
18
18
 
19
- def use_db_default_attrs
19
+ def ardb_use_db_default_attrs
20
20
  @ardb_use_db_default_attrs
21
21
  end
22
22
 
@@ -35,7 +35,7 @@ module Ardb
35
35
  # this allows the attr to be defaulted by the DB, this keeps
36
36
  # activerecord from adding the attr into the sql `INSERT`, which will
37
37
  # make the DB default its value
38
- unchanged_names = self.class.use_db_default_attrs.reject do |name|
38
+ unchanged_names = self.class.ardb_use_db_default_attrs.reject do |name|
39
39
  self.send("#{name}_changed?")
40
40
  end
41
41
  unchanged_names.each{ |name| @attributes.delete(name) }
@@ -1,3 +1,3 @@
1
1
  module Ardb
2
- VERSION = "0.24.0"
2
+ VERSION = "0.25.0"
3
3
  end
@@ -13,7 +13,7 @@ class Ardb::Adapter::Base
13
13
  should have_readers :config_settings, :database
14
14
  should have_readers :ruby_schema_path, :sql_schema_path
15
15
  should have_imeths :foreign_key_add_sql, :foreign_key_drop_sql
16
- should have_imeths :create_db, :drop_db
16
+ should have_imeths :create_db, :drop_db, :migrate_db
17
17
  should have_imeths :load_schema, :load_ruby_schema, :load_sql_schema
18
18
  should have_imeths :dump_schema, :dump_ruby_schema, :dump_sql_schema
19
19
 
@@ -51,6 +51,43 @@ class Ardb::Adapter::Base
51
51
 
52
52
  end
53
53
 
54
+ class MigrateDbTests < UnitTests
55
+ desc "`migrate_db`"
56
+ setup do
57
+ ENV["MIGRATE_VERSION"] = Factory.integer.to_s if Factory.boolean
58
+ ENV["MIGRATE_QUIET"] = Factory.boolean.to_s if Factory.boolean
59
+
60
+ @migrator_called_with = []
61
+ Assert.stub(ActiveRecord::Migrator, :migrate) do |*args|
62
+ @migrator_called_with = args
63
+ end
64
+
65
+ @adapter.migrate_db
66
+ end
67
+
68
+ should "add the Ardb MigrationHelper Recorder to the ActiveRecord Command Recorder" do
69
+ exp = Ardb::MigrationHelpers::RecorderMixin
70
+ assert_includes exp, ActiveRecord::Migration::CommandRecorder
71
+ end
72
+
73
+ should "set the ActiveRecord Migrator's migrations path" do
74
+ exp = Ardb.config.migrations_path
75
+ assert_equal exp, ActiveRecord::Migrator.migrations_path
76
+ end
77
+
78
+ should "set the ActiveRecord Migration's verbose" do
79
+ exp = ENV["MIGRATE_QUIET"].nil?
80
+ assert_equal exp, ActiveRecord::Migration.verbose
81
+ end
82
+
83
+ should "call the ActiveRecord Migrator's migrate" do
84
+ version = ENV.key?("MIGRATE_VERSION") ? ENV["MIGRATE_VERSION"].to_i : nil
85
+ exp = [Ardb.config.migrations_path, version]
86
+ assert_equal exp, @migrator_called_with
87
+ end
88
+
89
+ end
90
+
54
91
  class LoadAndDumpSchemaTests < UnitTests
55
92
  setup do
56
93
  @orig_stdout = $stdout.dup
@@ -14,9 +14,16 @@ module Ardb::AdapterSpy
14
14
  end
15
15
  subject{ @adapter }
16
16
 
17
- should have_accessors :drop_tables_called_count, :load_schema_called_count
17
+ should have_accessors :drop_tables_called_count
18
+ should have_accessors :dump_schema_called_count, :load_schema_called_count
18
19
  should have_accessors :drop_db_called_count, :create_db_called_count
19
- should have_imeths :drop_tables, :load_schema, :drop_db, :create_db
20
+ should have_accessors :migrate_db_called_count
21
+ should have_imeths :drop_tables_called?, :drop_tables
22
+ should have_imeths :dump_schema_called?, :dump_schema
23
+ should have_imeths :load_schema_called?, :load_schema
24
+ should have_imeths :drop_db_called?, :drop_db
25
+ should have_imeths :create_db_called?, :create_db
26
+ should have_imeths :migrate_db_called?, :migrate_db
20
27
 
21
28
  should "included the record spy instance methods" do
22
29
  assert_includes Ardb::AdapterSpy::InstanceMethods, subject.class
@@ -24,23 +31,43 @@ module Ardb::AdapterSpy
24
31
 
25
32
  should "default all call counts to zero" do
26
33
  assert_equal 0, subject.drop_tables_called_count
34
+ assert_equal 0, subject.dump_schema_called_count
27
35
  assert_equal 0, subject.load_schema_called_count
28
36
  assert_equal 0, subject.drop_db_called_count
29
37
  assert_equal 0, subject.create_db_called_count
38
+ assert_equal 0, subject.migrate_db_called_count
30
39
  end
31
40
 
32
- should "add a call count when each method is called" do
41
+ should "know if and how many times a method is called" do
42
+ assert_equal false, subject.drop_tables_called?
33
43
  subject.drop_tables
34
44
  assert_equal 1, subject.drop_tables_called_count
45
+ assert_equal true, subject.drop_tables_called?
35
46
 
47
+ assert_equal false, subject.dump_schema_called?
48
+ subject.dump_schema
49
+ assert_equal 1, subject.dump_schema_called_count
50
+ assert_equal true, subject.dump_schema_called?
51
+
52
+ assert_equal false, subject.load_schema_called?
36
53
  subject.load_schema
37
54
  assert_equal 1, subject.load_schema_called_count
55
+ assert_equal true, subject.load_schema_called?
38
56
 
57
+ assert_equal false, subject.drop_db_called?
39
58
  subject.drop_db
40
59
  assert_equal 1, subject.drop_db_called_count
60
+ assert_equal true, subject.drop_db_called?
41
61
 
62
+ assert_equal false, subject.create_db_called?
42
63
  subject.create_db
43
64
  assert_equal 1, subject.create_db_called_count
65
+ assert_equal true, subject.create_db_called?
66
+
67
+ assert_equal false, subject.migrate_db_called?
68
+ subject.migrate_db
69
+ assert_equal 1, subject.migrate_db_called_count
70
+ assert_equal true, subject.migrate_db_called?
44
71
  end
45
72
 
46
73
  end
@@ -0,0 +1,308 @@
1
+ require 'assert'
2
+ require 'ardb/has_slug'
3
+
4
+ require 'ardb/record_spy'
5
+
6
+ module Ardb::HasSlug
7
+
8
+ class UnitTests < Assert::Context
9
+ desc "Ardb::HasSlug"
10
+ setup do
11
+ source_attribute = @source_attribute = Factory.string.to_sym
12
+ slug_attribute = @slug_attribute = Factory.string.to_sym
13
+ @record_class = Ardb::RecordSpy.new do
14
+ include Ardb::HasSlug
15
+ attr_accessor source_attribute, slug_attribute
16
+ attr_reader :slug_db_column_name, :slug_db_column_value
17
+
18
+ def update_column(name, value)
19
+ @slug_db_column_name = name
20
+ @slug_db_column_value = value
21
+ end
22
+ end
23
+ end
24
+ subject{ @record_class }
25
+
26
+ NON_WORD_CHARS = ((' '..'/').to_a + (':'..'@').to_a + ('['..'`').to_a +
27
+ ('{'..'~').to_a - ['-', '_']).freeze
28
+
29
+ should have_imeths :has_slug
30
+ should have_imeths :ardb_has_slug_config
31
+
32
+ should "know its default attribute, preprocessor and separator" do
33
+ assert_equal :slug, DEFAULT_ATTRIBUTE
34
+ assert_equal :downcase, DEFAULT_PREPROCESSOR
35
+ assert_equal '-', DEFAULT_SEPARATOR
36
+ end
37
+
38
+ should "not have any has-slug config by default" do
39
+ assert_equal({}, subject.ardb_has_slug_config)
40
+ end
41
+
42
+ should "default the has slug config using `has_slug`" do
43
+ subject.has_slug :source => @source_attribute
44
+ string = Factory.string
45
+ record = subject.new.tap{ |r| r.send("#{@source_attribute}=", string) }
46
+
47
+ assert_equal DEFAULT_ATTRIBUTE, subject.ardb_has_slug_config[:attribute]
48
+ assert_equal DEFAULT_SEPARATOR, subject.ardb_has_slug_config[:separator]
49
+ assert_false subject.ardb_has_slug_config[:allow_underscores]
50
+
51
+ source_proc = subject.ardb_has_slug_config[:source_proc]
52
+ assert_instance_of Proc, source_proc
53
+ exp = record.send(@source_attribute)
54
+ assert_equal exp, record.instance_eval(&source_proc)
55
+
56
+ upcase_string = string.upcase
57
+ preprocessor_proc = subject.ardb_has_slug_config[:preprocessor_proc]
58
+ assert_instance_of Proc, preprocessor_proc
59
+ exp = upcase_string.send(DEFAULT_PREPROCESSOR)
60
+ assert_equal exp, preprocessor_proc.call(upcase_string)
61
+ end
62
+
63
+ should "allow customizing the has slug config using `has_slug`" do
64
+ separator = NON_WORD_CHARS.choice
65
+ allow_underscore = Factory.boolean
66
+ subject.has_slug({
67
+ :attribute => @slug_attribute,
68
+ :source => @source_attribute,
69
+ :preprocessor => :upcase,
70
+ :separator => separator,
71
+ :allow_underscores => allow_underscore
72
+ })
73
+
74
+ assert_equal @slug_attribute, subject.ardb_has_slug_config[:attribute]
75
+ assert_equal separator, subject.ardb_has_slug_config[:separator]
76
+ assert_equal allow_underscore, subject.ardb_has_slug_config[:allow_underscores]
77
+
78
+ value = Factory.string.downcase
79
+ preprocessor_proc = subject.ardb_has_slug_config[:preprocessor_proc]
80
+ assert_instance_of Proc, preprocessor_proc
81
+ assert_equal value.upcase, preprocessor_proc.call(value)
82
+ end
83
+
84
+ should "add validations using `has_slug`" do
85
+ subject.has_slug :source => @source_attribute
86
+
87
+ validation = subject.validations.find{ |v| v.type == :presence }
88
+ assert_not_nil validation
89
+ assert_equal [subject.ardb_has_slug_config[:attribute]], validation.columns
90
+ assert_equal :update, validation.options[:on]
91
+
92
+ validation = subject.validations.find{ |v| v.type == :uniqueness }
93
+ assert_not_nil validation
94
+ assert_equal [subject.ardb_has_slug_config[:attribute]], validation.columns
95
+ assert_equal true, validation.options[:case_sensitive]
96
+ assert_nil validation.options[:scope]
97
+ end
98
+
99
+ should "allow customizing its validations using `has_slug`" do
100
+ unique_scope = Factory.string.to_sym
101
+ subject.has_slug({
102
+ :source => @source_attribute,
103
+ :unique_scope => unique_scope
104
+ })
105
+
106
+ validation = subject.validations.find{ |v| v.type == :uniqueness }
107
+ assert_not_nil validation
108
+ assert_equal unique_scope, validation.options[:scope]
109
+ end
110
+
111
+ should "add callbacks using `has_slug`" do
112
+ subject.has_slug :source => @source_attribute
113
+
114
+ callback = subject.callbacks.find{ |v| v.type == :after_create }
115
+ assert_not_nil callback
116
+ assert_equal [:ardb_has_slug_generate_slug], callback.args
117
+
118
+ callback = subject.callbacks.find{ |v| v.type == :after_update }
119
+ assert_not_nil callback
120
+ assert_equal [:ardb_has_slug_generate_slug], callback.args
121
+ end
122
+
123
+ should "raise an argument error if `has_slug` isn't passed a source" do
124
+ assert_raises(ArgumentError){ subject.has_slug }
125
+ end
126
+
127
+ end
128
+
129
+ class InitTests < UnitTests
130
+ desc "when init"
131
+ setup do
132
+ @preprocessor = [:downcase, :upcase, :capitalize].choice
133
+ @separator = NON_WORD_CHARS.choice
134
+ @allow_underscores = Factory.boolean
135
+ @record_class.has_slug({
136
+ :attribute => @slug_attribute,
137
+ :source => @source_attribute,
138
+ :preprocessor => @preprocessor,
139
+ :separator => @separator,
140
+ :allow_underscores => @allow_underscores,
141
+ })
142
+
143
+ @record = @record_class.new
144
+
145
+ # create a string that has mixed case and an underscore so we can test
146
+ # that it uses the preprocessor and allow underscores options when
147
+ # generating a slug
148
+ @source_value = "#{Factory.string.downcase}_#{Factory.string.upcase}"
149
+ @record.send("#{@source_attribute}=", @source_value)
150
+ end
151
+ subject{ @record }
152
+
153
+ should "reset its slug using `reset_slug`" do
154
+ subject.send("#{@slug_attribute}=", Factory.slug)
155
+ assert_not_nil subject.send(@slug_attribute)
156
+ subject.instance_eval{ reset_slug }
157
+ assert_nil subject.send(@slug_attribute)
158
+ end
159
+
160
+ should "default its slug attribute using `ardb_has_slug_generate_slug`" do
161
+ subject.instance_eval{ ardb_has_slug_generate_slug }
162
+
163
+ exp = Slug.new(@source_value, {
164
+ :preprocessor => @preprocessor.to_proc,
165
+ :separator => @separator,
166
+ :allow_underscores => @allow_underscores
167
+ })
168
+ assert_equal exp, subject.send(@slug_attribute)
169
+ assert_equal @slug_attribute, subject.slug_db_column_name
170
+ assert_equal exp, subject.slug_db_column_value
171
+ end
172
+
173
+ should "slug its slug attribute value if set using `ardb_has_slug_generate_slug`" do
174
+ @record.send("#{@slug_attribute}=", @source_value)
175
+ # change the source attr to some random value, to avoid a false positive
176
+ @record.send("#{@source_attribute}=", Factory.string)
177
+ subject.instance_eval{ ardb_has_slug_generate_slug }
178
+
179
+ exp = Slug.new(@source_value, {
180
+ :preprocessor => @preprocessor.to_proc,
181
+ :separator => @separator,
182
+ :allow_underscores => @allow_underscores
183
+ })
184
+ assert_equal exp, subject.send(@slug_attribute)
185
+ assert_equal @slug_attribute, subject.slug_db_column_name
186
+ assert_equal exp, subject.slug_db_column_value
187
+ end
188
+
189
+ should "slug its source even if its already a valid slug using `ardb_has_slug_generate_slug`" do
190
+ slug_source = Factory.slug
191
+ @record.send("#{@source_attribute}=", slug_source)
192
+ # ensure the preprocessor doesn't change our source
193
+ Assert.stub(slug_source, @preprocessor){ slug_source }
194
+
195
+ subject.instance_eval{ ardb_has_slug_generate_slug }
196
+
197
+ exp = Slug.new(slug_source, {
198
+ :preprocessor => @preprocessor.to_proc,
199
+ :separator => @separator,
200
+ :allow_underscores => @allow_underscores
201
+ })
202
+ assert_equal exp, subject.send(@slug_attribute)
203
+ assert_equal @slug_attribute, subject.slug_db_column_name
204
+ assert_equal exp, subject.slug_db_column_value
205
+ end
206
+
207
+ should "not set its slug if it hasn't changed using `ardb_has_slug_generate_slug`" do
208
+ generated_slug = Slug.new(@source_value, {
209
+ :preprocessor => @preprocessor.to_proc,
210
+ :separator => @separator,
211
+ :allow_underscores => @allow_underscores
212
+ })
213
+ @record.send("#{@slug_attribute}=", generated_slug)
214
+ subject.instance_eval{ ardb_has_slug_generate_slug }
215
+
216
+ assert_nil subject.slug_db_column_name
217
+ assert_nil subject.slug_db_column_value
218
+ end
219
+
220
+ end
221
+
222
+ class SlugTests < UnitTests
223
+ desc "Slug"
224
+ subject{ Slug }
225
+
226
+ should have_imeths :new
227
+
228
+ should "know its default preprocessor" do
229
+ assert_instance_of Proc, Slug::DEFAULT_PREPROCESSOR
230
+ string = Factory.string
231
+ assert_same string, Slug::DEFAULT_PREPROCESSOR.call(string)
232
+ end
233
+
234
+ should "not change strings that are made up of valid chars" do
235
+ string = Factory.string
236
+ assert_equal string, subject.new(string)
237
+ string = "#{Factory.string}-#{Factory.string.upcase}"
238
+ assert_equal string, subject.new(string)
239
+ end
240
+
241
+ should "turn invalid chars into a separator" do
242
+ string = Factory.integer(3).times.map do
243
+ "#{Factory.string(3)}#{NON_WORD_CHARS.choice}#{Factory.string(3)}"
244
+ end.join(NON_WORD_CHARS.choice)
245
+ assert_equal string.gsub(/[^\w]+/, '-'), subject.new(string)
246
+ end
247
+
248
+ should "allow passing a custom preprocessor proc" do
249
+ string = "#{Factory.string}-#{Factory.string.upcase}"
250
+ slug = subject.new(string, :preprocessor => :downcase.to_proc)
251
+ assert_equal string.downcase, slug
252
+
253
+ preprocessor = proc{ |s| s.gsub(/[A-Z]/, 'a') }
254
+ slug = subject.new(string, :preprocessor => preprocessor)
255
+ assert_equal preprocessor.call(string), slug
256
+ end
257
+
258
+ should "allow passing a custom separator" do
259
+ separator = NON_WORD_CHARS.choice
260
+
261
+ invalid_char = (NON_WORD_CHARS - [separator]).choice
262
+ string = "#{Factory.string}#{invalid_char}#{Factory.string}"
263
+ slug = subject.new(string, :separator => separator)
264
+ assert_equal string.gsub(/[^\w]+/, separator), slug
265
+
266
+ # it won't change the separator in the strings
267
+ string = "#{Factory.string}#{separator}#{Factory.string}"
268
+ assert_equal string, subject.new(string, :separator => separator)
269
+
270
+ # it will change the default separator now
271
+ string = "#{Factory.string}-#{Factory.string}"
272
+ slug = subject.new(string, :separator => separator)
273
+ assert_equal string.gsub('-', separator), slug
274
+ end
275
+
276
+ should "change underscores into its separator unless allowed" do
277
+ string = "#{Factory.string}_#{Factory.string}"
278
+ assert_equal string.gsub('_', '-'), subject.new(string)
279
+
280
+ slug = subject.new(string, :allow_underscores => false)
281
+ assert_equal string.gsub('_', '-'), slug
282
+
283
+ assert_equal string, subject.new(string, :allow_underscores => true)
284
+ end
285
+
286
+ should "not allow multiple separators in a row" do
287
+ string = "#{Factory.string}--#{Factory.string}"
288
+ assert_equal string.gsub(/-{2,}/, '-'), subject.new(string)
289
+
290
+ # remove separators that were added from changing invalid chars
291
+ invalid_chars = (Factory.integer(3) + 1).times.map{ NON_WORD_CHARS.choice }.join
292
+ string = "#{Factory.string}#{invalid_chars}#{Factory.string}"
293
+ assert_equal string.gsub(/[^\w]+/, '-'), subject.new(string)
294
+ end
295
+
296
+ should "remove leading and trailing separators" do
297
+ string = "-#{Factory.string}-#{Factory.string}-"
298
+ assert_equal string[1..-2], subject.new(string)
299
+
300
+ # remove separators that were added from changing invalid chars
301
+ invalid_char = NON_WORD_CHARS.choice
302
+ string = "#{invalid_char}#{Factory.string}-#{Factory.string}#{invalid_char}"
303
+ assert_equal string[1..-2], subject.new(string)
304
+ end
305
+
306
+ end
307
+
308
+ end
@@ -1,7 +1,7 @@
1
1
  require 'assert'
2
2
  require 'ardb/runner/connect_command'
3
3
 
4
- class Ardb::Runner::CreateCommand
4
+ class Ardb::Runner::ConnectCommand
5
5
 
6
6
  class UnitTests < Assert::Context
7
7
  desc "Ardb::Runner::ConnectCommand"
@@ -1,4 +1,5 @@
1
1
  require 'assert'
2
+ require 'ardb/adapter_spy'
2
3
  require 'ardb/runner/create_command'
3
4
 
4
5
  class Ardb::Runner::CreateCommand
@@ -6,12 +7,61 @@ class Ardb::Runner::CreateCommand
6
7
  class UnitTests < Assert::Context
7
8
  desc "Ardb::Runner::CreateCommand"
8
9
  setup do
9
- @cmd = Ardb::Runner::CreateCommand.new
10
+ @command_class = Ardb::Runner::CreateCommand
10
11
  end
11
- subject{ @cmd }
12
+
13
+ end
14
+
15
+ class InitTests < UnitTests
16
+ desc "when init"
17
+ setup do
18
+ @adapter_spy = Class.new{ include Ardb::AdapterSpy }.new
19
+ Assert.stub(Ardb::Adapter, Ardb.config.db.adapter.to_sym){ @adapter_spy }
20
+
21
+ # provide an output and error IO to avoid using $stdout/$stderr in tests
22
+ out_io = err_io = StringIO.new
23
+ @command = @command_class.new(out_io, err_io)
24
+ end
25
+ subject{ @command }
12
26
 
13
27
  should have_imeths :run
14
28
 
15
29
  end
16
30
 
31
+ class RunTests < InitTests
32
+ desc "and run"
33
+ setup do
34
+ @command.run
35
+ end
36
+
37
+ should "create the db via the adapter" do
38
+ assert_equal true, @adapter_spy.create_db_called?
39
+ end
40
+
41
+ end
42
+
43
+ class RunWithCmdErrorTests < InitTests
44
+ desc "and run with command errors"
45
+ setup do
46
+ Assert.stub(@adapter_spy, :create_db){ raise Ardb::Runner::CmdError.new }
47
+ end
48
+
49
+ should "not handle the error" do
50
+ assert_raises(Ardb::Runner::CmdError){ subject.run }
51
+ end
52
+
53
+ end
54
+
55
+ class RunWithUnspecifiedErrorTests < InitTests
56
+ desc "and run with a standard error"
57
+ setup do
58
+ Assert.stub(@adapter_spy, :create_db){ raise StandardError.new }
59
+ end
60
+
61
+ should "raise a CmdFail error" do
62
+ assert_raises(Ardb::Runner::CmdFail){ subject.run }
63
+ end
64
+
65
+ end
66
+
17
67
  end
@@ -1,4 +1,5 @@
1
1
  require 'assert'
2
+ require 'ardb/adapter_spy'
2
3
  require 'ardb/runner/drop_command'
3
4
 
4
5
  class Ardb::Runner::DropCommand
@@ -6,12 +7,62 @@ class Ardb::Runner::DropCommand
6
7
  class UnitTests < Assert::Context
7
8
  desc "Ardb::Runner::DropCommand"
8
9
  setup do
9
- @cmd = Ardb::Runner::DropCommand.new
10
+ @command_class = Ardb::Runner::DropCommand
10
11
  end
11
- subject{ @cmd }
12
+
13
+ end
14
+
15
+ class InitTests < UnitTests
16
+ desc "when init"
17
+ setup do
18
+ @adapter_spy = Class.new{ include Ardb::AdapterSpy }.new
19
+ Assert.stub(Ardb::Adapter, Ardb.config.db.adapter.to_sym){ @adapter_spy }
20
+
21
+ # provide an output and error IO to avoid using $stdout/$stderr in tests
22
+ out_io = err_io = StringIO.new
23
+ @command = @command_class.new(out_io, err_io)
24
+ end
25
+ subject{ @command }
12
26
 
13
27
  should have_imeths :run
14
28
 
15
29
  end
16
30
 
31
+ class RunTests < InitTests
32
+ desc "and run"
33
+ setup do
34
+ @command.run
35
+ end
36
+
37
+ should "drop the db via the adapter" do
38
+ assert_equal true, @adapter_spy.drop_db_called?
39
+ end
40
+
41
+ end
42
+
43
+ class RunWithCmdErrorTests < InitTests
44
+ desc "and run with command errors"
45
+ setup do
46
+ Assert.stub(@adapter_spy, :drop_db){ raise Ardb::Runner::CmdError.new }
47
+ end
48
+
49
+ should "not handle the error" do
50
+ assert_raises(Ardb::Runner::CmdError){ subject.run }
51
+ end
52
+
53
+ end
54
+
55
+ class RunWithUnspecifiedErrorTests < InitTests
56
+ desc "and run with a standard error"
57
+ setup do
58
+ Assert.stub(@adapter_spy, :drop_db){ raise StandardError.new }
59
+ end
60
+
61
+ should "raise a CmdFail error" do
62
+ assert_raises(Ardb::Runner::CmdFail){ subject.run }
63
+ end
64
+
65
+ end
66
+
17
67
  end
68
+
@@ -1,4 +1,5 @@
1
1
  require 'assert'
2
+ require 'ardb/adapter_spy'
2
3
  require 'ardb/runner/migrate_command'
3
4
 
4
5
  class Ardb::Runner::MigrateCommand
@@ -6,54 +7,64 @@ class Ardb::Runner::MigrateCommand
6
7
  class UnitTests < Assert::Context
7
8
  desc "Ardb::Runner::MigrateCommand"
8
9
  setup do
9
- @cmd = Ardb::Runner::MigrateCommand.new
10
+ @command_class = Ardb::Runner::MigrateCommand
10
11
  end
11
- subject{ @cmd }
12
12
 
13
- should have_readers :migrations_path, :version, :verbose
13
+ end
14
+
15
+ class InitTests < UnitTests
16
+ desc "when init"
17
+ setup do
18
+ @adapter_spy = Class.new{ include Ardb::AdapterSpy }.new
19
+ Assert.stub(Ardb::Adapter, Ardb.config.db.adapter.to_sym){ @adapter_spy }
14
20
 
15
- should "use the config's migrations path" do
16
- assert_equal Ardb.config.migrations_path, subject.migrations_path
21
+ @ardb_init_called = false
22
+ Assert.stub(Ardb, :init){ @ardb_init_called = true }
23
+
24
+ # provide an output and error IO to avoid using $stdout/$stderr in tests
25
+ out_io = err_io = StringIO.new
26
+ @command = @command_class.new(out_io, err_io)
17
27
  end
28
+ subject{ @command }
29
+
30
+ should have_imeths :run
18
31
 
19
- should "not target a specific version by default" do
20
- assert_nil subject.version
32
+ end
33
+
34
+ class RunTests < InitTests
35
+ desc "and run"
36
+ setup do
37
+ @command.run
21
38
  end
22
39
 
23
- should "be verbose by default" do
24
- assert subject.verbose
40
+ should "initialize Ardb, migrate the db and dump schema via the adapter" do
41
+ assert_equal true, @ardb_init_called
42
+ assert_equal true, @adapter_spy.migrate_db_called?
43
+ assert_equal true, @adapter_spy.dump_schema_called?
25
44
  end
26
45
 
27
46
  end
28
47
 
29
- class VersionTests < UnitTests
30
- desc "with a version ENV setting"
48
+ class RunWithCmdErrorTests < InitTests
49
+ desc "and run with command errors"
31
50
  setup do
32
- ENV["VERSION"] = '12345'
33
- @cmd = Ardb::Runner::MigrateCommand.new
34
- end
35
- teardown do
36
- ENV["VERSION"] = nil
51
+ Assert.stub(@adapter_spy, :migrate_db){ raise Ardb::Runner::CmdError.new }
37
52
  end
38
53
 
39
- should "should target the given version" do
40
- assert_equal 12345, subject.version
54
+ should "not handle the error" do
55
+ assert_raises(Ardb::Runner::CmdError){ subject.run }
41
56
  end
42
57
 
43
58
  end
44
59
 
45
- class VerboseTests < UnitTests
46
- desc "with a verbose ENV setting"
60
+ class RunWithUnspecifiedErrorTests < InitTests
61
+ desc "and run with a standard error"
47
62
  setup do
48
- ENV["VERBOSE"] = 'no'
49
- @cmd = Ardb::Runner::MigrateCommand.new
50
- end
51
- teardown do
52
- ENV["VERBOSE"] = nil
63
+ Assert.stub(@adapter_spy, :migrate_db){ raise StandardError.new }
53
64
  end
54
65
 
55
- should "turn off verbose mode if not set to 'true'" do
56
- assert_not subject.verbose
66
+ should "raise a CmdFail error" do
67
+ assert_raises(Ardb::Runner::CmdFail){ subject.run }
57
68
  end
58
69
 
59
70
  end
@@ -1,4 +1,5 @@
1
1
  require 'assert'
2
+ require 'ardb/adapter_spy'
2
3
  require 'ardb/test_helpers'
3
4
 
4
5
  module Ardb::TestHelpers
@@ -7,7 +8,9 @@ module Ardb::TestHelpers
7
8
  desc "Ardb test helpers"
8
9
  subject{ Ardb::TestHelpers }
9
10
 
10
- should have_imeths :drop_tables, :load_schema, :reset_db, :reset_db!
11
+ should have_imeths :drop_tables, :load_schema
12
+ should have_imeths :create_db!, :create_db, :drop_db!, :drop_db
13
+ should have_imeths :migrate_db!, :migrate_db, :reset_db, :reset_db!
11
14
 
12
15
  end
13
16
 
@@ -45,6 +48,69 @@ module Ardb::TestHelpers
45
48
 
46
49
  end
47
50
 
51
+ class CreateDbTests < UsageTests
52
+ desc "create db method"
53
+
54
+ should "tell the adapter to create the db only once" do
55
+ assert_equal 0, @adapter_spy.create_db_called_count
56
+ subject.create_db
57
+ assert_equal 1, @adapter_spy.create_db_called_count
58
+ subject.create_db
59
+ assert_equal 1, @adapter_spy.create_db_called_count
60
+ end
61
+
62
+ should "force the adapter to create a db" do
63
+ assert_equal 0, @adapter_spy.create_db_called_count
64
+ subject.create_db!
65
+ assert_equal 1, @adapter_spy.create_db_called_count
66
+ subject.create_db!
67
+ assert_equal 2, @adapter_spy.create_db_called_count
68
+ end
69
+
70
+ end
71
+
72
+ class DropDbTests < UsageTests
73
+ desc "drop db methods"
74
+
75
+ should "tell the adapter to drop the db only once" do
76
+ assert_equal 0, @adapter_spy.drop_db_called_count
77
+ subject.drop_db
78
+ assert_equal 1, @adapter_spy.drop_db_called_count
79
+ subject.drop_db
80
+ assert_equal 1, @adapter_spy.drop_db_called_count
81
+ end
82
+
83
+ should "force the adapter to drop a db" do
84
+ assert_equal 0, @adapter_spy.drop_db_called_count
85
+ subject.drop_db!
86
+ assert_equal 1, @adapter_spy.drop_db_called_count
87
+ subject.drop_db!
88
+ assert_equal 2, @adapter_spy.drop_db_called_count
89
+ end
90
+
91
+ end
92
+
93
+ class MigrateDbTests < UsageTests
94
+ desc "migrate db methods"
95
+
96
+ should "tell the adapter to migrate the db only once" do
97
+ assert_equal 0, @adapter_spy.migrate_db_called_count
98
+ subject.migrate_db
99
+ assert_equal 1, @adapter_spy.migrate_db_called_count
100
+ subject.migrate_db
101
+ assert_equal 1, @adapter_spy.migrate_db_called_count
102
+ end
103
+
104
+ should "force the adapter to migrate a db" do
105
+ assert_equal 0, @adapter_spy.migrate_db_called_count
106
+ subject.migrate_db!
107
+ assert_equal 1, @adapter_spy.migrate_db_called_count
108
+ subject.migrate_db!
109
+ assert_equal 2, @adapter_spy.migrate_db_called_count
110
+ end
111
+
112
+ end
113
+
48
114
  class ResetDbTests < UsageTests
49
115
  desc "reset db methods"
50
116
 
@@ -15,36 +15,36 @@ module Ardb::UseDbDefault
15
15
  end
16
16
  subject{ @record_class }
17
17
 
18
- should have_imeths :use_db_default, :use_db_default_attrs
18
+ should have_imeths :use_db_default, :ardb_use_db_default_attrs
19
19
 
20
20
  should "know its use db default attrs" do
21
- assert_equal [], subject.use_db_default_attrs
21
+ assert_equal [], subject.ardb_use_db_default_attrs
22
22
  end
23
23
 
24
24
  should "add use db default attributes using `use_db_default`" do
25
25
  attr_name = Factory.string
26
26
  subject.use_db_default(attr_name)
27
- assert_includes attr_name, subject.use_db_default_attrs
27
+ assert_includes attr_name, subject.ardb_use_db_default_attrs
28
28
 
29
29
  attr_names = [Factory.string, Factory.string.to_sym]
30
30
  subject.use_db_default(*attr_names)
31
31
  attr_names.each do |attr_name|
32
- assert_includes attr_name.to_s, subject.use_db_default_attrs
32
+ assert_includes attr_name.to_s, subject.ardb_use_db_default_attrs
33
33
  end
34
34
  end
35
35
 
36
36
  should "not add duplicate attributes using `use_db_default`" do
37
37
  attr_name = Factory.string
38
38
  subject.use_db_default(attr_name)
39
- assert_equal [attr_name], subject.use_db_default_attrs
39
+ assert_equal [attr_name], subject.ardb_use_db_default_attrs
40
40
 
41
41
  subject.use_db_default(attr_name)
42
- assert_equal [attr_name], subject.use_db_default_attrs
42
+ assert_equal [attr_name], subject.ardb_use_db_default_attrs
43
43
 
44
44
  more_attr_names = [attr_name, Factory.string]
45
45
  subject.use_db_default(*more_attr_names)
46
46
  exp = ([attr_name] + more_attr_names).uniq
47
- assert_equal exp, subject.use_db_default_attrs
47
+ assert_equal exp, subject.ardb_use_db_default_attrs
48
48
  end
49
49
 
50
50
  should "add an around create callback" do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ardb
3
3
  version: !ruby/object:Gem::Version
4
- hash: 127
4
+ hash: 123
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 24
8
+ - 25
9
9
  - 0
10
- version: 0.24.0
10
+ version: 0.25.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Kelly Redding
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2015-10-22 00:00:00 Z
19
+ date: 2015-12-03 00:00:00 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  requirement: &id001 !ruby/object:Gem::Requirement
@@ -118,6 +118,7 @@ files:
118
118
  - lib/ardb/adapter/sqlite.rb
119
119
  - lib/ardb/adapter_spy.rb
120
120
  - lib/ardb/cli.rb
121
+ - lib/ardb/has_slug.rb
121
122
  - lib/ardb/migration_helpers.rb
122
123
  - lib/ardb/record_spy.rb
123
124
  - lib/ardb/relation_spy.rb
@@ -141,6 +142,7 @@ files:
141
142
  - test/unit/adapter_spy_tests.rb
142
143
  - test/unit/ardb_tests.rb
143
144
  - test/unit/config_tests.rb
145
+ - test/unit/has_slug_tests.rb
144
146
  - test/unit/migration_helpers_tests.rb
145
147
  - test/unit/record_spy_tests.rb
146
148
  - test/unit/relation_spy_tests.rb
@@ -194,7 +196,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
194
196
  requirements: []
195
197
 
196
198
  rubyforge_project:
197
- rubygems_version: 1.8.25
199
+ rubygems_version: 1.8.29
198
200
  signing_key:
199
201
  specification_version: 3
200
202
  summary: Activerecord database tools.
@@ -208,6 +210,7 @@ test_files:
208
210
  - test/unit/adapter_spy_tests.rb
209
211
  - test/unit/ardb_tests.rb
210
212
  - test/unit/config_tests.rb
213
+ - test/unit/has_slug_tests.rb
211
214
  - test/unit/migration_helpers_tests.rb
212
215
  - test/unit/record_spy_tests.rb
213
216
  - test/unit/relation_spy_tests.rb