Permalink
Browse files

test for empty default

  • Loading branch information...
1 parent 910c699 commit 0c38c7ce80369dcd2ea947e1b1eb14af9a9bd038 @funny-falcon committed Jul 21, 2012
Showing with 19 additions and 29 deletions.
  1. +6 −27 Rakefile
  2. +1 −0 spec/fixtures/schema.rb
  3. +12 −2 spec/pg_array_spec.rb
View
@@ -1,17 +1,17 @@
require 'rake'
-require 'rake/testtask'
-require 'rake/rdoctask'
-
-#desc 'Default: run unit tests.'
-#task :default => :test
+require 'rdoc/task'
desc 'Test the postgres_arrays plugin.'
-Rake::TestTask.new(:test) do |t|
+task :test do
Dir.chdir(File.dirname(__FILE__)) do
Process.wait2 spawn('rspec spec')
end
end
+task :default do
+ # nothing
+end
+
desc 'Generate documentation for the postgres_arrays plugin.'
Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
@@ -20,24 +20,3 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_files.include('README')
rdoc.rdoc_files.include('lib/**/*.rb')
end
-
-begin
- require 'jeweler'
- Jeweler::Tasks.new do |gemspec|
- gemspec.name = "ar_pg_array"
- gemspec.summary = "Use power of PostgreSQL Arrays in ActiveRecord"
- gemspec.description = "ar_pg_array includes support of PostgreSQL's int[], float[], text[], timestamptz[] etc. into ActiveRecord. You could define migrations for array columns, query on array columns."
- gemspec.email = "funny.falcon@gmail.com"
- gemspec.homepage = "http://github.com/funny-falcon/activerecord-postgresql-arrays"
- gemspec.authors = ["Sokolov Yura aka funny_falcon"]
- gemspec.add_dependency('activerecord', '>= 3.0.6', '<4.0')
- gemspec.rubyforge_project = 'ar-pg-array'
- end
- Jeweler::GemcutterTasks.new
- Jeweler::RubyforgeTasks.new do |rubyforge|
-
- end
-rescue LoadError
- puts "Jeweler not available. Install it with: gem install jeweler"
-end
-
View
@@ -20,6 +20,7 @@
t.float_array :floats, :default => [1.0, 1.2]
t.decimal_array :decimals, :default => [1.0, 1.2]
t.text_array :texts, :default => [nil, 'Text', 'NULL', 'Text with nil', 'Text with , nil, !"\\', 'nil']
+ t.integer_array :empty_def, :default => []
end
create_table "unrelateds", :force => true do |t|
View
@@ -82,11 +82,21 @@ def ab
bulk.texts.should == [nil, 'Text', 'NULL', 'Text with nil', 'Text with , nil, !"\\', 'nil']
map_times(bulk.times).should ==
map_times(parse_times(%w{2010-01-01 2010-02-01}))
+ bulk.empty_def.should == []
end
it "should be able to insert" do
- bulk = Bulk.new
- bulk.save
+ bulki = Bulk.new
+ bulki.save
+ bulk = Bulk.find(bulki.id)
+ bulk.ints.should == [1, 2]
+ bulk.strings.should == %w{as so}
+ bulk.floats.should == [1.0, 1.2]
+ bulk.decimals.should == [1.0, 1.2]
+ bulk.texts.should == [nil, 'Text', 'NULL', 'Text with nil', 'Text with , nil, !"\\', 'nil']
+ map_times(bulk.times).should ==
+ map_times(parse_times(%w{2010-01-01 2010-02-01}))
+ bulk.empty_def.should == []
bulk.destroy
end

0 comments on commit 0c38c7c

Please sign in to comment.