From 69a5d043570381f65b13c93878b352859edaa94c Mon Sep 17 00:00:00 2001 From: Dan McClain Date: Fri, 14 Jun 2013 08:18:46 -0400 Subject: [PATCH] Splits up schema dumper range specs --- spec/schema_dumper/range_spec.rb | 89 --------------------- spec/schema_dumper/ranges/daterange_spec.rb | 18 +++++ spec/schema_dumper/ranges/int4range_spec.rb | 18 +++++ spec/schema_dumper/ranges/int8range_spec.rb | 18 +++++ spec/schema_dumper/ranges/numrange_spec.rb | 18 +++++ spec/schema_dumper/ranges/tsrange_spec.rb | 18 +++++ spec/schema_dumper/ranges/tstzrange_spec.rb | 17 ++++ 7 files changed, 107 insertions(+), 89 deletions(-) delete mode 100644 spec/schema_dumper/range_spec.rb create mode 100644 spec/schema_dumper/ranges/daterange_spec.rb create mode 100644 spec/schema_dumper/ranges/int4range_spec.rb create mode 100644 spec/schema_dumper/ranges/int8range_spec.rb create mode 100644 spec/schema_dumper/ranges/numrange_spec.rb create mode 100644 spec/schema_dumper/ranges/tsrange_spec.rb create mode 100644 spec/schema_dumper/ranges/tstzrange_spec.rb diff --git a/spec/schema_dumper/range_spec.rb b/spec/schema_dumper/range_spec.rb deleted file mode 100644 index a4942b1..0000000 --- a/spec/schema_dumper/range_spec.rb +++ /dev/null @@ -1,89 +0,0 @@ -require 'spec_helper' - -describe 'range schema dump' do - let!(:connection) { ActiveRecord::Base.connection } - after { connection.drop_table :testings } - context 'Numeric ranges' do - it 'correctly generates numrange column statements' do - stream = StringIO.new - connection.create_table :testings do |t| - t.numrange :range - end - - ActiveRecord::SchemaDumper.dump(connection, stream) - output = stream.string - - output.should match /t\.numrange "range"/ - end - end - - context 'Date ranges' do - it 'correctly generates daterange column statements' do - stream = StringIO.new - connection.create_table :testings do |t| - t.daterange :range - end - - ActiveRecord::SchemaDumper.dump(connection, stream) - output = stream.string - - output.should match /t\.daterange "range"/ - end - end - - context 'Int4 ranges' do - it 'correctly generates int4range column statements' do - stream = StringIO.new - connection.create_table :testings do |t| - t.int4range :range - end - - ActiveRecord::SchemaDumper.dump(connection, stream) - output = stream.string - - output.should match /t\.int4range "range"/ - end - end - - context 'Int8 ranges' do - it 'correctly generates int8range column statements' do - stream = StringIO.new - connection.create_table :testings do |t| - t.int8range :range - end - - ActiveRecord::SchemaDumper.dump(connection, stream) - output = stream.string - - output.should match /t\.int8range "range"/ - end - end - - context 'Timestamp (without time zone) ranges' do - it 'correctly generates tsrange column statements' do - stream = StringIO.new - connection.create_table :testings do |t| - t.tsrange :range - end - - ActiveRecord::SchemaDumper.dump(connection, stream) - output = stream.string - - output.should match /t\.tsrange "range"/ - end - end - - context 'Timestamp (with time zone) ranges' do - it 'correctly generates tstzrange column statements' do - stream = StringIO.new - connection.create_table :testings do |t| - t.tstzrange :range - end - - ActiveRecord::SchemaDumper.dump(connection, stream) - output = stream.string - - output.should match /t\.tstzrange "range"/ - end - end -end diff --git a/spec/schema_dumper/ranges/daterange_spec.rb b/spec/schema_dumper/ranges/daterange_spec.rb new file mode 100644 index 0000000..6bdd48a --- /dev/null +++ b/spec/schema_dumper/ranges/daterange_spec.rb @@ -0,0 +1,18 @@ +require 'spec_helper' + +describe 'daterange schema dump' do + let!(:connection) { ActiveRecord::Base.connection } + after { connection.drop_table :testings } + + it 'correctly generates daterange column statements' do + stream = StringIO.new + connection.create_table :testings do |t| + t.daterange :range + end + + ActiveRecord::SchemaDumper.dump(connection, stream) + output = stream.string + + output.should match /t\.daterange "range"/ + end +end diff --git a/spec/schema_dumper/ranges/int4range_spec.rb b/spec/schema_dumper/ranges/int4range_spec.rb new file mode 100644 index 0000000..94c615f --- /dev/null +++ b/spec/schema_dumper/ranges/int4range_spec.rb @@ -0,0 +1,18 @@ +require 'spec_helper' + +describe 'intrange schema dump' do + let!(:connection) { ActiveRecord::Base.connection } + after { connection.drop_table :testings } + + it 'correctly generates int4range column statements' do + stream = StringIO.new + connection.create_table :testings do |t| + t.int4range :range + end + + ActiveRecord::SchemaDumper.dump(connection, stream) + output = stream.string + + output.should match /t\.int4range "range"/ + end +end diff --git a/spec/schema_dumper/ranges/int8range_spec.rb b/spec/schema_dumper/ranges/int8range_spec.rb new file mode 100644 index 0000000..f1cb880 --- /dev/null +++ b/spec/schema_dumper/ranges/int8range_spec.rb @@ -0,0 +1,18 @@ +require 'spec_helper' + +describe 'int8range schema dump' do + let!(:connection) { ActiveRecord::Base.connection } + after { connection.drop_table :testings } + + it 'correctly generates int8range column statements' do + stream = StringIO.new + connection.create_table :testings do |t| + t.int8range :range + end + + ActiveRecord::SchemaDumper.dump(connection, stream) + output = stream.string + + output.should match /t\.int8range "range"/ + end +end diff --git a/spec/schema_dumper/ranges/numrange_spec.rb b/spec/schema_dumper/ranges/numrange_spec.rb new file mode 100644 index 0000000..3b58c73 --- /dev/null +++ b/spec/schema_dumper/ranges/numrange_spec.rb @@ -0,0 +1,18 @@ +require 'spec_helper' + +describe 'numrange schema dump' do + let!(:connection) { ActiveRecord::Base.connection } + after { connection.drop_table :testings } + + it 'correctly generates numrange column statements' do + stream = StringIO.new + connection.create_table :testings do |t| + t.numrange :range + end + + ActiveRecord::SchemaDumper.dump(connection, stream) + output = stream.string + + output.should match /t\.numrange "range"/ + end +end diff --git a/spec/schema_dumper/ranges/tsrange_spec.rb b/spec/schema_dumper/ranges/tsrange_spec.rb new file mode 100644 index 0000000..6316de1 --- /dev/null +++ b/spec/schema_dumper/ranges/tsrange_spec.rb @@ -0,0 +1,18 @@ +require 'spec_helper' + +describe 'tsrange schema dump' do + let!(:connection) { ActiveRecord::Base.connection } + after { connection.drop_table :testings } + + it 'correctly generates tsrange column statements' do + stream = StringIO.new + connection.create_table :testings do |t| + t.tsrange :range + end + + ActiveRecord::SchemaDumper.dump(connection, stream) + output = stream.string + + output.should match /t\.tsrange "range"/ + end +end diff --git a/spec/schema_dumper/ranges/tstzrange_spec.rb b/spec/schema_dumper/ranges/tstzrange_spec.rb new file mode 100644 index 0000000..e132096 --- /dev/null +++ b/spec/schema_dumper/ranges/tstzrange_spec.rb @@ -0,0 +1,17 @@ +require 'spec_helper' + +describe 'tstzrange schema dump' do + let!(:connection) { ActiveRecord::Base.connection } + after { connection.drop_table :testings } + it 'correctly generates tstzrange column statements' do + stream = StringIO.new + connection.create_table :testings do |t| + t.tstzrange :range + end + + ActiveRecord::SchemaDumper.dump(connection, stream) + output = stream.string + + output.should match /t\.tstzrange "range"/ + end +end