Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

test for empty default

  • Loading branch information...
commit 0c38c7ce80369dcd2ea947e1b1eb14af9a9bd038 1 parent 910c699
Sokolov Yura authored July 21, 2012
33  Rakefile
... ...
@@ -1,17 +1,17 @@
1 1
 require 'rake'
2  
-require 'rake/testtask'
3  
-require 'rake/rdoctask'
4  
-
5  
-#desc 'Default: run unit tests.'
6  
-#task :default => :test
  2
+require 'rdoc/task'
7 3
 
8 4
 desc 'Test the postgres_arrays plugin.'
9  
-Rake::TestTask.new(:test) do |t|
  5
+task :test do
10 6
   Dir.chdir(File.dirname(__FILE__)) do
11 7
     Process.wait2 spawn('rspec spec')
12 8
   end
13 9
 end
14 10
 
  11
+task :default do
  12
+  # nothing
  13
+end
  14
+
15 15
 desc 'Generate documentation for the postgres_arrays plugin.'
16 16
 Rake::RDocTask.new(:rdoc) do |rdoc|
17 17
   rdoc.rdoc_dir = 'rdoc'
@@ -20,24 +20,3 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
20 20
   rdoc.rdoc_files.include('README')
21 21
   rdoc.rdoc_files.include('lib/**/*.rb')
22 22
 end
23  
-
24  
-begin
25  
-  require 'jeweler'
26  
-  Jeweler::Tasks.new do |gemspec|
27  
-    gemspec.name = "ar_pg_array"
28  
-    gemspec.summary = "Use power of PostgreSQL Arrays in ActiveRecord"
29  
-    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."
30  
-    gemspec.email = "funny.falcon@gmail.com"
31  
-    gemspec.homepage = "http://github.com/funny-falcon/activerecord-postgresql-arrays"
32  
-    gemspec.authors = ["Sokolov Yura aka funny_falcon"]
33  
-    gemspec.add_dependency('activerecord', '>= 3.0.6', '<4.0')
34  
-    gemspec.rubyforge_project = 'ar-pg-array'
35  
-  end
36  
-  Jeweler::GemcutterTasks.new
37  
-  Jeweler::RubyforgeTasks.new do |rubyforge|
38  
-    
39  
-  end
40  
-rescue LoadError
41  
-  puts "Jeweler not available. Install it with: gem install jeweler"
42  
-end
43  
-
1  spec/fixtures/schema.rb
@@ -20,6 +20,7 @@
20 20
     t.float_array :floats,     :default => [1.0, 1.2]
21 21
     t.decimal_array :decimals, :default => [1.0, 1.2]
22 22
     t.text_array :texts, :default => [nil, 'Text', 'NULL', 'Text with nil', 'Text with , nil, !"\\', 'nil']
  23
+    t.integer_array :empty_def, :default => []
23 24
   end
24 25
 
25 26
   create_table "unrelateds", :force => true do |t|
14  spec/pg_array_spec.rb
@@ -82,11 +82,21 @@ def ab
82 82
       bulk.texts.should == [nil, 'Text', 'NULL', 'Text with nil', 'Text with , nil, !"\\', 'nil']
83 83
       map_times(bulk.times).should == 
84 84
           map_times(parse_times(%w{2010-01-01 2010-02-01}))
  85
+      bulk.empty_def.should == []
85 86
     end
86 87
 
87 88
     it "should be able to insert" do
88  
-      bulk = Bulk.new
89  
-      bulk.save
  89
+      bulki = Bulk.new
  90
+      bulki.save
  91
+      bulk = Bulk.find(bulki.id)
  92
+      bulk.ints.should == [1, 2]
  93
+      bulk.strings.should == %w{as so}
  94
+      bulk.floats.should == [1.0, 1.2]
  95
+      bulk.decimals.should == [1.0, 1.2]
  96
+      bulk.texts.should == [nil, 'Text', 'NULL', 'Text with nil', 'Text with , nil, !"\\', 'nil']
  97
+      map_times(bulk.times).should ==
  98
+          map_times(parse_times(%w{2010-01-01 2010-02-01}))
  99
+      bulk.empty_def.should == []
90 100
       bulk.destroy
91 101
     end
92 102
 

0 notes on commit 0c38c7c

Please sign in to comment.
Something went wrong with that request. Please try again.