do_oracle 0.10.3-java → 0.10.4-java

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog.markdown CHANGED
@@ -1,3 +1,16 @@
1
+ ## 0.10.4 2011-04-28
2
+
3
+ New features
4
+ * Add save point to transactions (all)
5
+ * JRuby 1.9 mode support (encodings etc.)
6
+
7
+ Bugfixes
8
+ * Fix bug when using nested transactions in concurrent scenarios (all)
9
+ * Use column aliases instead of names (jruby)
10
+
11
+ Other
12
+ * Switch back to RSpec
13
+
1
14
  ## 0.10.3 2011-01-30
2
15
  * No changes
3
16
 
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2007 - 2010 Yehuda Katz, Dirkjan Bussink, Raimonds Simanovskis
1
+ Copyright (c) 2007 - 2011 Yehuda Katz, Dirkjan Bussink, Raimonds Simanovskis
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.markdown CHANGED
@@ -18,10 +18,6 @@ An example of usage:
18
18
  @reader = @connection.create_command('SELECT * FROM users').execute_reader
19
19
  @reader.next!
20
20
 
21
- In the future, the `Connection` constructor will be able to be passed either a
22
- DataObjects-style URL or JDBC style URL, when using do\_oracle on JRuby. However,
23
- this feature is not currently working reliably and is a known issue.
24
-
25
21
  ## Requirements
26
22
 
27
23
  This driver is provided for the following platforms:
@@ -62,7 +58,7 @@ For more information, see the Oracle driver wiki page:
62
58
  ## Developers
63
59
 
64
60
  Follow the above installation instructions. Additionally, you'll need:
65
- * `bacon` gem for running specs.
61
+ * `rspec` gem for running specs.
66
62
  * `YARD` gem for generating documentation.
67
63
 
68
64
  See the DataObjects wiki for more comprehensive information on installing and
@@ -95,10 +91,7 @@ To run specs without compiling extensions first:
95
91
 
96
92
  To run individual specs:
97
93
 
98
- rake spec TEST=spec/connection_spec.rb
99
-
100
- (Note that the `rake` task uses a `TEST` parameter, not `SPEC`. This is because
101
- the `Rake::TestTask` is used for executing the Bacon specs).
94
+ rake spec SPEC=spec/connection_spec.rb
102
95
 
103
96
  ## License
104
97
 
data/Rakefile CHANGED
@@ -1,5 +1,7 @@
1
1
  require 'pathname'
2
- require 'rubygems'
2
+ require 'bundler'
3
+ Bundler::GemHelper.install_tasks
4
+
3
5
  require 'rake'
4
6
  require 'rake/clean'
5
7
 
@@ -15,51 +17,14 @@ BINARY_VERSION = '10.2.0.4.0'
15
17
 
16
18
  CLEAN.include(%w[ {tmp,pkg}/ **/*.{o,so,bundle,jar,log,a,gem,dSYM,obj,pdb,exp,DS_Store,rbc,db} ext/do_oracle/Makefile ext-java/target ])
17
19
 
18
- begin
19
- gem 'jeweler', '~> 1.4'
20
- require 'jeweler'
21
-
22
- Jeweler::Tasks.new do |gem|
23
- gem.name = 'do_oracle'
24
- gem.version = DataObjects::Oracle::VERSION
25
- gem.summary = 'DataObjects Oracle Driver'
26
- gem.description = 'Implements the DataObjects API for Oracle'
27
- gem.platform = Gem::Platform::RUBY
28
- gem.files = Dir['lib/**/*.rb', 'spec/**/*.rb', 'tasks/**/*.rake',
29
- 'ext/**/*.{rb,c,h}', 'LICENSE', 'Rakefile',
30
- '*.{markdown,rdoc,txt,yml}']
31
- gem.extra_rdoc_files = FileList['README*', 'ChangeLog*', 'INSTALL.markdown',
32
- 'LICENSE']
33
- gem.test_files = FileList['spec/**/*.rb']
34
-
35
- # rake-compiler should generate gemspecs for other platforms (e.g. 'java')
36
- # and modify dependencies and extensions appropriately
37
- gem.extensions << 'ext/do_oracle/extconf.rb'
38
-
39
- gem.add_dependency 'data_objects', DataObjects::Oracle::VERSION
40
- gem.add_dependency 'ruby-oci8', '~>2.0'
41
-
42
- gem.add_development_dependency 'bacon', '~>1.1'
43
- gem.add_development_dependency 'rake-compiler', '= 0.7.0'
44
20
 
45
- gem.has_rdoc = false
46
- gem.rubyforge_project = 'dorb'
47
- gem.authors = [ 'Raimonds Simanovskis' ]
48
- gem.email = 'raimonds.simanovskis@gmail.com'
21
+ if JRUBY
22
+ Rake::Task['build'].clear_actions if Rake::Task.task_defined?('build')
23
+ Rake::Task['install'].clear_actions if Rake::Task.task_defined?('install')
24
+ task :build => [ :java, :gem ]
25
+ task :install do
26
+ sh "#{Config::CONFIG['RUBY_INSTALL_NAME']} -S gem install pkg/do_oracle-#{DataObjects::Oracle::VERSION}-java.gem"
49
27
  end
50
-
51
- if JRUBY
52
- Rake::Task['build'].clear_actions if Rake::Task.task_defined?('build')
53
- Rake::Task['install'].clear_actions if Rake::Task.task_defined?('install')
54
- task :build => [ :java, :gem ]
55
- task :install do
56
- sh "#{Config::CONFIG['RUBY_INSTALL_NAME']} -S gem install pkg/do_oracle-#{DataObjects::Oracle::VERSION}-java.gem"
57
- end
58
- end
59
-
60
- Jeweler::GemcutterTasks.new
61
-
62
- FileList['tasks/**/*.rake'].each { |task| import task }
63
- rescue LoadError
64
- puts 'Jeweler (or a dependency) not available. Install it with: gem install jeweler'
65
28
  end
29
+
30
+ FileList['tasks/**/*.rake'].each { |task| import task }
data/lib/do_oracle.rb CHANGED
@@ -21,12 +21,19 @@ end
21
21
  require 'do_oracle/version'
22
22
 
23
23
  if RUBY_PLATFORM =~ /java/
24
+
25
+ module DataObjects
26
+ module Oracle
27
+ JDBC_DRIVER = 'oracle.jdbc.OracleDriver'
28
+ end
29
+ end
30
+
24
31
  # Oracle JDBC driver (ojdbc14.jar or ojdbc5.jar) file should be in JRUBY_HOME/lib or should be in Java class path
25
32
  # Register Oracle JDBC driver
26
33
  begin
27
34
  java.sql.DriverManager.registerDriver Java::oracle.jdbc.OracleDriver.new
28
35
  rescue NameError => e
29
- raise ConnectionError, "Cannot load Oracle JDBC driver, put it (ojdbc14.jar or ojdbc5.jar) in JRUBY_HOME/lib or in the java extension directory or include in Java class path or call jruby with the option -J-Djava.ext.dirs=/path/to/directory/with/oracle/jars"
36
+ raise LoadError, "Cannot load Oracle JDBC driver, put it (ojdbc14.jar or ojdbc5.jar) in JRUBY_HOME/lib or in the java extension directory or include in Java class path or call jruby with the option -J-Djava.ext.dirs=/path/to/directory/with/oracle/jars"
30
37
  end
31
38
  # JDBC driver has transactions implementation in Java
32
39
 
Binary file
@@ -1,5 +1,5 @@
1
1
  module DataObjects
2
2
  module Oracle
3
- VERSION = '0.10.3'
3
+ VERSION = '0.10.4'
4
4
  end
5
5
  end
data/spec/command_spec.rb CHANGED
@@ -1,13 +1,13 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper'))
4
- require 'data_objects/spec/command_spec'
4
+ require 'data_objects/spec/shared/command_spec'
5
5
 
6
6
  describe DataObjects::Oracle::Command do
7
- behaves_like 'a Command'
7
+ it_should_behave_like 'a Command'
8
8
 
9
9
  if JRUBY
10
- behaves_like 'a Command with async'
10
+ it_should_behave_like 'a Command with async'
11
11
  else
12
12
  describe 'running queries in parallel' do
13
13
 
@@ -1,21 +1,21 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper'))
4
- require 'data_objects/spec/connection_spec'
4
+ require 'data_objects/spec/shared/connection_spec'
5
5
 
6
6
  describe DataObjects::Oracle::Connection do
7
7
 
8
- before do
9
- @driver = CONFIG.scheme
10
- @user = CONFIG.user
8
+ before :all do
9
+ @driver = CONFIG.scheme
10
+ @user = CONFIG.user
11
11
  @password = CONFIG.pass
12
- @host = CONFIG.host
13
- @port = CONFIG.port
12
+ @host = CONFIG.host
13
+ @port = CONFIG.port
14
14
  @database = CONFIG.database
15
15
  end
16
16
 
17
- behaves_like 'a Connection'
18
- behaves_like 'a Connection with authentication support'
19
- # FIXME: behaves_like 'a Connection with JDBC URL support' if JRUBY
20
- behaves_like 'a Connection via JDNI' if JRUBY
17
+ it_should_behave_like 'a Connection'
18
+ it_should_behave_like 'a Connection with authentication support'
19
+ it_should_behave_like 'a Connection with JDBC URL support' if JRUBY
20
+ it_should_behave_like 'a Connection via JDNI' if JRUBY
21
21
  end
@@ -1,10 +1,10 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  # require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper'))
4
- # require 'data_objects/spec/encoding_spec'
4
+ # require 'data_objects/spec/shared/encoding_spec'
5
5
  #
6
6
  # describe DataObjects::Oracle::Connection do
7
- # behaves_like 'a driver supporting different encodings'
7
+ # it_should_behave_like 'a driver supporting different encodings'
8
8
  # end
9
9
 
10
10
 
data/spec/reader_spec.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper'))
4
- require 'data_objects/spec/reader_spec'
4
+ require 'data_objects/spec/shared/reader_spec'
5
5
 
6
6
  describe DataObjects::Oracle::Reader do
7
- behaves_like 'a Reader'
7
+ it_should_behave_like 'a Reader'
8
8
  end
data/spec/result_spec.rb CHANGED
@@ -1,23 +1,26 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper'))
4
- require 'data_objects/spec/result_spec'
4
+ require 'data_objects/spec/shared/result_spec'
5
5
 
6
6
  describe DataObjects::Oracle::Result do
7
- behaves_like 'a Result'
8
- end
9
-
10
- def current_sequence_value(seq_name)
11
- reader = @connection.create_command("SELECT #{seq_name}.currval FROM dual").execute_reader
12
- reader.next!
13
- value = reader.values.first
14
- reader.close
15
- value
7
+ it_should_behave_like 'a Result'
16
8
  end
17
9
 
18
10
  describe DataObjects::Oracle::Result do
11
+ #include DataObjectsSpecHelpers
12
+
13
+ def current_sequence_value(seq_name)
14
+ reader = @connection.create_command("SELECT #{seq_name}.currval FROM dual").execute_reader
15
+ reader.next!
16
+ value = reader.values.first
17
+ reader.close
18
+ value
19
+ end
19
20
 
20
- setup_test_environment(false)
21
+ before :all do
22
+ setup_test_environment(false)
23
+ end
21
24
 
22
25
  describe 'without using RETURNING' do
23
26
 
@@ -31,7 +34,7 @@ describe DataObjects::Oracle::Result do
31
34
  @connection.close
32
35
  end
33
36
 
34
- it 'should respond to #affected_rows' do @result.should.respond_to(:affected_rows) end
37
+ it { @result.should respond_to(:affected_rows) }
35
38
 
36
39
  describe 'affected_rows' do
37
40
 
@@ -41,12 +44,12 @@ describe DataObjects::Oracle::Result do
41
44
 
42
45
  end
43
46
 
44
- it 'should respond to #insert_id' do @result.should.respond_to(:insert_id) end
47
+ it { @result.should respond_to(:insert_id) }
45
48
 
46
49
  describe 'insert_id' do
47
50
 
48
51
  it 'should return nil' do
49
- @result.insert_id.should.be.nil
52
+ @result.insert_id.should be_nil
50
53
  end
51
54
 
52
55
  it 'should be retrievable through currval' do
@@ -70,7 +73,7 @@ describe DataObjects::Oracle::Result do
70
73
  @connection.close
71
74
  end
72
75
 
73
- it 'should respond to #affected_rows' do @result.should.respond_to(:affected_rows) end
76
+ it { @result.should respond_to(:affected_rows) }
74
77
 
75
78
  describe 'affected_rows' do
76
79
 
@@ -80,7 +83,7 @@ describe DataObjects::Oracle::Result do
80
83
 
81
84
  end
82
85
 
83
- it 'should respond to #insert_id' do @result.should.respond_to(:insert_id) end
86
+ it { @result.should respond_to(:insert_id) }
84
87
 
85
88
  describe 'insert_id' do
86
89
 
data/spec/spec_helper.rb CHANGED
@@ -2,6 +2,7 @@ $TESTING=true
2
2
  JRUBY = RUBY_PLATFORM =~ /java/
3
3
 
4
4
  require 'rubygems'
5
+ require 'rspec'
5
6
  require 'date'
6
7
  require 'ostruct'
7
8
  require 'fileutils'
@@ -18,12 +19,14 @@ repo_root = File.expand_path('../../..', __FILE__)
18
19
  end
19
20
 
20
21
  require 'data_objects'
21
- require 'data_objects/spec/bacon'
22
+ require 'data_objects/spec/setup'
23
+ require 'data_objects/spec/lib/pending_helpers'
22
24
  require 'do_oracle'
23
25
 
24
26
  DataObjects::Oracle.logger = DataObjects::Logger.new(STDOUT, :off)
25
27
  at_exit { DataObjects.logger.flush }
26
28
 
29
+
27
30
  # Set default time zone in MRI if not set in environment
28
31
  # as otherwise wrong time zone is set for database connection
29
32
  ENV['TZ'] ||= 'EET' unless JRUBY
@@ -36,9 +39,12 @@ CONFIG.host = ENV['DO_ORACLE_HOST'] || 'localhost'
36
39
  CONFIG.port = ENV['DO_ORACLE_PORT'] || '1521'
37
40
  CONFIG.database = ENV['DO_ORACLE_DATABASE'] || '/orcl'
38
41
 
39
- CONFIG.uri = ENV["DO_ORACLE_SPEC_URI"] ||"#{CONFIG.scheme}://#{CONFIG.user}:#{CONFIG.pass}@#{CONFIG.host}:#{CONFIG.port}#{CONFIG.database}"
40
- CONFIG.sleep = "BEGIN SYS.DBMS_LOCK.sleep(seconds => 1); END;"
41
- CONFIG.testsql = "SELECT 1 FROM dual"
42
+ CONFIG.driver = 'oracle'
43
+ CONFIG.jdbc_driver = DataObjects::Oracle.const_get('JDBC_DRIVER') rescue nil
44
+ CONFIG.uri = ENV["DO_ORACLE_SPEC_URI"] ||"#{CONFIG.scheme}://#{CONFIG.user}:#{CONFIG.pass}@#{CONFIG.host}:#{CONFIG.port}#{CONFIG.database}"
45
+ CONFIG.jdbc_uri = "jdbc:oracle:thin:#{CONFIG.user}/#{CONFIG.pass}@//#{CONFIG.host}:#{CONFIG.port}#{CONFIG.database}"
46
+ CONFIG.sleep = "BEGIN SYS.DBMS_LOCK.sleep(seconds => 1); END;"
47
+ CONFIG.testsql = "SELECT 1 FROM dual"
42
48
 
43
49
  module DataObjectsSpecHelpers
44
50
 
@@ -191,4 +197,7 @@ module DataObjectsSpecHelpers
191
197
 
192
198
  end
193
199
 
194
- include DataObjectsSpecHelpers
200
+ RSpec.configure do |config|
201
+ config.include(DataObjectsSpecHelpers)
202
+ config.include(DataObjects::Spec::PendingHelpers)
203
+ end
@@ -1,8 +1,8 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
4
- require 'data_objects/spec/typecast/array_spec'
4
+ require 'data_objects/spec/shared/typecast/array_spec'
5
5
 
6
6
  describe 'DataObjects::Oracle with Array' do
7
- behaves_like 'supporting Array'
7
+ it_should_behave_like 'supporting Array'
8
8
  end
@@ -1,9 +1,9 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
4
- require 'data_objects/spec/typecast/bigdecimal_spec'
4
+ require 'data_objects/spec/shared/typecast/bigdecimal_spec'
5
5
 
6
6
  describe 'DataObjects::Oracle with BigDecimal' do
7
- behaves_like 'supporting BigDecimal'
8
- behaves_like 'supporting BigDecimal autocasting'
7
+ it_should_behave_like 'supporting BigDecimal'
8
+ it_should_behave_like 'supporting BigDecimal autocasting'
9
9
  end
@@ -1,9 +1,9 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
4
- require 'data_objects/spec/typecast/boolean_spec'
4
+ require 'data_objects/spec/shared/typecast/boolean_spec'
5
5
 
6
6
  describe 'DataObjects::Oracle with Boolean' do
7
- behaves_like 'supporting Boolean'
8
- behaves_like 'supporting Boolean autocasting'
7
+ it_should_behave_like 'supporting Boolean'
8
+ it_should_behave_like 'supporting Boolean autocasting'
9
9
  end
@@ -1,11 +1,14 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
4
- require 'data_objects/spec/typecast/byte_array_spec'
4
+ require 'data_objects/spec/shared/typecast/byte_array_spec'
5
5
 
6
6
  describe 'DataObjects::Oracle with ByteArray' do
7
+ include DataObjectsSpecHelpers
7
8
 
8
- setup_test_environment
9
+ before :all do
10
+ setup_test_environment
11
+ end
9
12
 
10
13
  before do
11
14
  @connection = DataObjects::Connection.new(CONFIG.uri)
@@ -30,7 +33,7 @@ describe 'DataObjects::Oracle with ByteArray' do
30
33
  end
31
34
 
32
35
  it 'should return the correctly typed result' do
33
- @values.first.should.be.kind_of(::Extlib::ByteArray)
36
+ @values.first.should be_kind_of(::Extlib::ByteArray)
34
37
  end
35
38
 
36
39
  it 'should return the correct result' do
@@ -54,7 +57,7 @@ describe 'DataObjects::Oracle with ByteArray' do
54
57
  end
55
58
 
56
59
  it 'should return the correctly typed result' do
57
- @values.first.should.be.kind_of(::Extlib::ByteArray)
60
+ @values.first.should be_kind_of(::Extlib::ByteArray)
58
61
  end
59
62
 
60
63
  it 'should return the correct result' do
@@ -1,11 +1,15 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
4
- require 'data_objects/spec/typecast/class_spec'
4
+ require 'data_objects/spec/shared/typecast/class_spec'
5
5
 
6
6
  describe 'DataObjects::Oracle with Class' do
7
7
 
8
- setup_test_environment
8
+ include DataObjectsSpecHelpers
9
+
10
+ before :all do
11
+ setup_test_environment
12
+ end
9
13
 
10
14
  before do
11
15
  @connection = DataObjects::Connection.new(CONFIG.uri)
@@ -32,7 +36,7 @@ describe 'DataObjects::Oracle with Class' do
32
36
  end
33
37
 
34
38
  it 'should return the correctly typed result' do
35
- @values.first.should.be.kind_of(Class)
39
+ @values.first.should be_kind_of(Class)
36
40
  end
37
41
 
38
42
  it 'should return the correct result' do
@@ -1,11 +1,11 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
4
- require 'data_objects/spec/typecast/date_spec'
4
+ require 'data_objects/spec/shared/typecast/date_spec'
5
5
 
6
6
  describe 'DataObjects::Oracle with Date' do
7
- behaves_like 'supporting Date'
7
+ it_should_behave_like 'supporting Date'
8
8
 
9
9
  # Oracle will cast DATE type to Time
10
- # behaves_like 'supporting Date autocasting'
10
+ # it_should_behave_like 'supporting Date autocasting'
11
11
  end
@@ -1,9 +1,9 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
4
- require 'data_objects/spec/typecast/datetime_spec'
4
+ require 'data_objects/spec/shared/typecast/datetime_spec'
5
5
 
6
6
  describe 'DataObjects::Oracle with DateTime' do
7
- behaves_like 'supporting DateTime'
8
- # behaves_like 'supporting DateTime autocasting'
7
+ it_should_behave_like 'supporting DateTime'
8
+ # it_should_behave_like 'supporting DateTime autocasting'
9
9
  end
@@ -1,16 +1,20 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
4
- require 'data_objects/spec/typecast/float_spec'
4
+ require 'data_objects/spec/shared/typecast/float_spec'
5
5
 
6
6
  describe 'DataObjects::Oracle with Float' do
7
- behaves_like 'supporting Float'
8
- # behaves_like 'supporting Float autocasting'
7
+ it_should_behave_like 'supporting Float'
8
+ # it_should_behave_like 'supporting Float autocasting'
9
9
  end
10
10
 
11
11
  describe 'DataObjects::Oracle with Float supporting Float autocasting' do
12
12
 
13
- setup_test_environment
13
+ include DataObjectsSpecHelpers
14
+
15
+ before :all do
16
+ setup_test_environment
17
+ end
14
18
 
15
19
  before do
16
20
  @connection = DataObjects::Connection.new(CONFIG.uri)
@@ -35,13 +39,13 @@ describe 'DataObjects::Oracle with Float supporting Float autocasting' do
35
39
  end
36
40
 
37
41
  it 'should return the correctly typed result' do
38
- @values.first.should.be.kind_of(Float)
39
- @values.last.should.be.kind_of(Float)
42
+ @values.first.should be_kind_of(Float)
43
+ @values.last.should be_kind_of(Float)
40
44
  end
41
45
 
42
46
  it 'should return the correct result' do
43
- @values.first.should.be.close(13.4, 0.000001)
44
- @values.last.should.be.close(10.23, 0.000001)
47
+ @values.first.should be_within(0.000001).of(13.4)
48
+ @values.last.should be_within(0.000001).of(10.23)
45
49
  end
46
50
 
47
51
  end
@@ -1,8 +1,8 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
4
- require 'data_objects/spec/typecast/integer_spec'
4
+ require 'data_objects/spec/shared/typecast/integer_spec'
5
5
 
6
6
  describe 'DataObjects::Oracle with Integer' do
7
- behaves_like 'supporting Integer'
7
+ it_should_behave_like 'supporting Integer'
8
8
  end
@@ -1,10 +1,10 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
4
- require 'data_objects/spec/typecast/nil_spec'
4
+ require 'data_objects/spec/shared/typecast/nil_spec'
5
5
 
6
6
  describe 'DataObjects::Oracle with Nil' do
7
- behaves_like 'supporting Nil'
8
- behaves_like 'supporting writing an Nil'
9
- behaves_like 'supporting Nil autocasting'
7
+ it_should_behave_like 'supporting Nil'
8
+ it_should_behave_like 'supporting writing an Nil'
9
+ it_should_behave_like 'supporting Nil autocasting'
10
10
  end
@@ -1,8 +1,8 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
4
- require 'data_objects/spec/typecast/other_spec'
4
+ require 'data_objects/spec/shared/typecast/other_spec'
5
5
 
6
6
  describe 'DataObjects::H2 with other (unknown) type' do
7
- behaves_like 'supporting other (unknown) type'
7
+ it_should_behave_like 'supporting other (unknown) type'
8
8
  end
@@ -1,8 +1,8 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
4
- require 'data_objects/spec/typecast/range_spec'
4
+ require 'data_objects/spec/shared/typecast/range_spec'
5
5
 
6
6
  describe 'DataObjects::Oracle with Range' do
7
- behaves_like 'supporting Range'
7
+ it_should_behave_like 'supporting Range'
8
8
  end
@@ -1,15 +1,19 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
4
- require 'data_objects/spec/typecast/string_spec'
4
+ require 'data_objects/spec/shared/typecast/string_spec'
5
5
 
6
6
  # describe 'DataObjects::Oracle with String' do
7
- # behaves_like 'supporting String'
7
+ # it_should_behave_like 'supporting String'
8
8
  # end
9
9
 
10
10
  describe 'DataObjects::Oracle with String' do
11
11
 
12
- setup_test_environment
12
+ include DataObjectsSpecHelpers
13
+
14
+ before :all do
15
+ setup_test_environment
16
+ end
13
17
 
14
18
  before do
15
19
  @connection = DataObjects::Connection.new(CONFIG.uri)
@@ -34,7 +38,7 @@ describe 'DataObjects::Oracle with String' do
34
38
  end
35
39
 
36
40
  it 'should return the correctly typed result' do
37
- @values.first.should.be.kind_of(String)
41
+ @values.first.should be_kind_of(String)
38
42
  end
39
43
 
40
44
  it 'should return the correct result' do
@@ -58,11 +62,11 @@ describe 'DataObjects::Oracle with String' do
58
62
  end
59
63
 
60
64
  it 'should return the correctly typed result' do
61
- @values.first.should.be.kind_of(String)
65
+ @values.first.should be_kind_of(String)
62
66
  end
63
67
 
64
68
  it 'should return the correct result' do
65
- @values.first.to_f.should.be.close(13.4, 0.000001)
69
+ @values.first.to_f.should be_within(0.000001).of(13.4)
66
70
  end
67
71
 
68
72
  end
@@ -83,7 +87,7 @@ describe 'DataObjects::Oracle with String' do
83
87
 
84
88
  it 'should return the correct entry' do
85
89
  # Some of the drivers starts autoincrementation from 0 not 1
86
- @values.first.should.satisfy { |val| val == 1 or val == 2 }
90
+ @values.first.should satisfy { |val| val == 1 or val == 2 }
87
91
  end
88
92
 
89
93
  end
@@ -92,7 +96,11 @@ end
92
96
 
93
97
  describe 'DataObjects::Oracle with Text' do
94
98
 
95
- setup_test_environment
99
+ include DataObjectsSpecHelpers
100
+
101
+ before :all do
102
+ setup_test_environment
103
+ end
96
104
 
97
105
  before do
98
106
  @connection = DataObjects::Connection.new(CONFIG.uri)
@@ -117,7 +125,7 @@ describe 'DataObjects::Oracle with Text' do
117
125
  end
118
126
 
119
127
  it 'should return the correctly typed result' do
120
- @values.first.should.be.kind_of(String)
128
+ @values.first.should be_kind_of(String)
121
129
  end
122
130
 
123
131
  it 'should return the correct result' do
@@ -1,15 +1,19 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
4
- require 'data_objects/spec/typecast/time_spec'
4
+ require 'data_objects/spec/shared/typecast/time_spec'
5
5
 
6
6
  describe 'DataObjects::Oracle with Time' do
7
- behaves_like 'supporting Time'
7
+ it_should_behave_like 'supporting Time'
8
8
  end
9
9
 
10
10
  describe 'DataObjects::Oracle with Time' do
11
11
 
12
- setup_test_environment
12
+ include DataObjectsSpecHelpers
13
+
14
+ before :all do
15
+ setup_test_environment
16
+ end
13
17
 
14
18
  before do
15
19
  @connection = DataObjects::Connection.new(CONFIG.uri)
@@ -34,7 +38,7 @@ describe 'DataObjects::Oracle with Time' do
34
38
  end
35
39
 
36
40
  it 'should return the correctly typed result' do
37
- @values.first.should.be.kind_of(Time)
41
+ @values.first.should be_kind_of(Time)
38
42
  end
39
43
 
40
44
  it 'should return the correct result' do
@@ -49,18 +53,18 @@ end
49
53
 
50
54
  describe 'DataObjects::Oracle session time zone' do
51
55
 
52
- after do
53
- @connection.close
54
- end
55
-
56
56
  describe 'set from environment' do
57
57
 
58
58
  before do
59
- pending "set TZ environment shell variable before running this test" unless ENV['TZ']
60
59
  @connection = DataObjects::Connection.new(CONFIG.uri)
61
60
  end
62
61
 
62
+ after do
63
+ @connection.close
64
+ end
65
+
63
66
  it "should have time zone from environment" do
67
+ pending "set TZ environment shell variable before running this test" unless ENV['TZ']
64
68
  @reader = @connection.create_command("SELECT sessiontimezone FROM dual").execute_reader
65
69
  @reader.next!
66
70
  @reader.values.first.should == ENV['TZ']
@@ -74,6 +78,10 @@ describe 'DataObjects::Oracle session time zone' do
74
78
  @connection = DataObjects::Connection.new(CONFIG.uri+"?time_zone=CET")
75
79
  end
76
80
 
81
+ after do
82
+ @connection.close
83
+ end
84
+
77
85
  it "should have time zone from connection option" do
78
86
  @reader = @connection.create_command("SELECT sessiontimezone FROM dual").execute_reader
79
87
  @reader.next!
data/tasks/compile.rake CHANGED
@@ -3,24 +3,22 @@ begin
3
3
  require 'rake/extensiontask'
4
4
  require 'rake/javaextensiontask'
5
5
 
6
- # Hack to avoid "allocator undefined for Proc" issue when unpacking Gems:
7
- # gemspec provided by Jeweler uses Rake::FileList for files, test_files and
8
- # extra_rdoc_files, and procs cannot be marshalled.
9
6
  def gemspec
10
- @clean_gemspec ||= eval("#{Rake.application.jeweler.gemspec.to_ruby}") # $SAFE = 3\n
7
+ @clean_gemspec ||= Gem::Specification::load(File.expand_path('../../do_oracle.gemspec', __FILE__))
11
8
  end
12
9
 
13
- Rake::ExtensionTask.new('do_oracle', gemspec) do |ext|
10
+ unless JRUBY
11
+ Rake::ExtensionTask.new('do_oracle', gemspec) do |ext|
14
12
 
15
- ext.lib_dir = "lib/#{gemspec.name}"
13
+ ext.lib_dir = "lib/#{gemspec.name}"
16
14
 
17
- # automatically add build options to avoid need of manual input
18
- if RUBY_PLATFORM =~ /mswin|mingw/ then
19
- else
20
- ext.cross_compile = true
21
- ext.cross_platform = ['x86-mingw32', 'x86-mswin32-60']
15
+ # automatically add build options to avoid need of manual input
16
+ if RUBY_PLATFORM =~ /mswin|mingw/ then
17
+ else
18
+ ext.cross_compile = true
19
+ ext.cross_platform = ['x86-mingw32', 'x86-mswin32-60']
20
+ end
22
21
  end
23
-
24
22
  end
25
23
 
26
24
  Rake::JavaExtensionTask.new('do_oracle', gemspec) do |ext|
@@ -34,7 +32,7 @@ begin
34
32
  # Gem::Specification API.
35
33
  gem.dependencies.delete_if { |d| d.name == 'ruby-oci8'}
36
34
 
37
- gem.add_dependency "do_jdbc", '0.10.3'
35
+ gem.add_dependency "do_jdbc", '0.10.4'
38
36
  end
39
37
  end
40
38
  rescue LoadError
data/tasks/spec.rake CHANGED
@@ -1,23 +1,12 @@
1
- require 'rake/testtask'
1
+ require 'rspec/core/rake_task'
2
2
 
3
- spec_defaults = lambda do |spec|
4
- spec.libs << 'lib' << 'spec'
5
- spec.pattern = 'spec/**/*_spec.rb'
6
- spec.verbose = true
3
+ RSpec::Core::RakeTask.new(:spec => [:clean, :compile]) do |spec|
4
+ spec.pattern = './spec/**/*_spec.rb'
5
+ spec.skip_bundler = true
7
6
  end
8
7
 
9
- Rake::TestTask.new(:spec => [ :clean, :compile ], &spec_defaults)
10
- Rake::TestTask.new(:spec_no_compile, &spec_defaults)
11
-
12
- begin
13
- require 'rcov/rcovtask'
14
- Rcov::RcovTask.new do |spec|
15
- spec.libs << 'spec'
16
- spec.pattern = 'spec/**/*_spec.rb'
17
- spec.verbose = true
18
- end
19
- rescue LoadError
20
- task :rcov do
21
- abort 'RCov is not available. In order to run rcov, you must: gem install rcov'
22
- end
8
+ RSpec::Core::RakeTask.new(:rcov => [:clean, :compile]) do |rcov|
9
+ rcov.pattern = "./spec/**/*_spec.rb"
10
+ rcov.rcov = true
11
+ rcov.rcov_opts = File.read('spec/rcov.opts').split(/\s+/)
23
12
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: do_oracle
3
3
  version: !ruby/object:Gem::Version
4
- hash: 49
4
+ hash: 63
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 10
9
- - 3
10
- version: 0.10.3
9
+ - 4
10
+ version: 0.10.4
11
11
  platform: java
12
12
  authors:
13
13
  - Raimonds Simanovskis
@@ -15,71 +15,70 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-30 00:00:00 +01:00
18
+ date: 2011-03-29 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
- name: data_objects
23
- prerelease: false
24
22
  requirement: &id001 !ruby/object:Gem::Requirement
25
23
  none: false
26
24
  requirements:
27
25
  - - "="
28
26
  - !ruby/object:Gem::Version
29
- hash: 49
27
+ hash: 63
30
28
  segments:
31
29
  - 0
32
30
  - 10
33
- - 3
34
- version: 0.10.3
31
+ - 4
32
+ version: 0.10.4
35
33
  type: :runtime
34
+ name: data_objects
35
+ prerelease: false
36
36
  version_requirements: *id001
37
37
  - !ruby/object:Gem::Dependency
38
- name: bacon
39
- prerelease: false
40
38
  requirement: &id002 !ruby/object:Gem::Requirement
41
39
  none: false
42
40
  requirements:
43
41
  - - ~>
44
42
  - !ruby/object:Gem::Version
45
- hash: 13
43
+ hash: 9
46
44
  segments:
47
- - 1
48
- - 1
49
- version: "1.1"
45
+ - 2
46
+ - 5
47
+ version: "2.5"
50
48
  type: :development
49
+ name: rspec
50
+ prerelease: false
51
51
  version_requirements: *id002
52
52
  - !ruby/object:Gem::Dependency
53
- name: rake-compiler
54
- prerelease: false
55
53
  requirement: &id003 !ruby/object:Gem::Requirement
56
54
  none: false
57
55
  requirements:
58
- - - "="
56
+ - - ~>
59
57
  - !ruby/object:Gem::Version
60
- hash: 3
58
+ hash: 5
61
59
  segments:
62
60
  - 0
63
61
  - 7
64
- - 0
65
- version: 0.7.0
62
+ version: "0.7"
66
63
  type: :development
64
+ name: rake-compiler
65
+ prerelease: false
67
66
  version_requirements: *id003
68
67
  - !ruby/object:Gem::Dependency
69
- name: do_jdbc
70
- prerelease: false
71
68
  requirement: &id004 !ruby/object:Gem::Requirement
72
69
  none: false
73
70
  requirements:
74
71
  - - "="
75
72
  - !ruby/object:Gem::Version
76
- hash: 49
73
+ hash: 63
77
74
  segments:
78
75
  - 0
79
76
  - 10
80
- - 3
81
- version: 0.10.3
77
+ - 4
78
+ version: 0.10.4
82
79
  type: :runtime
80
+ name: do_jdbc
81
+ prerelease: false
83
82
  version_requirements: *id004
84
83
  description: Implements the DataObjects API for Oracle
85
84
  email: raimonds.simanovskis@gmail.com
@@ -88,14 +87,21 @@ executables: []
88
87
  extensions: []
89
88
 
90
89
  extra_rdoc_files:
91
- - README.markdown
92
90
  - ChangeLog.markdown
93
91
  - INSTALL.markdown
94
92
  - LICENSE
93
+ - README.markdown
95
94
  files:
95
+ - ChangeLog.markdown
96
+ - INSTALL.markdown
97
+ - LICENSE
98
+ - README.markdown
99
+ - Rakefile
100
+ - ext/do_oracle/do_oracle.c
101
+ - ext/do_oracle/extconf.rb
102
+ - lib/do_oracle.rb
96
103
  - lib/do_oracle/transaction.rb
97
104
  - lib/do_oracle/version.rb
98
- - lib/do_oracle.rb
99
105
  - spec/command_spec.rb
100
106
  - spec/connection_spec.rb
101
107
  - spec/encoding_spec.rb
@@ -120,21 +126,14 @@ files:
120
126
  - tasks/release.rake
121
127
  - tasks/retrieve.rake
122
128
  - tasks/spec.rake
123
- - ext/do_oracle/extconf.rb
124
- - ext/do_oracle/do_oracle.c
125
- - LICENSE
126
- - Rakefile
127
- - ChangeLog.markdown
128
- - INSTALL.markdown
129
- - README.markdown
130
129
  - lib/do_oracle/do_oracle.jar
131
- has_rdoc: false
130
+ has_rdoc: true
132
131
  homepage:
133
132
  licenses: []
134
133
 
135
134
  post_install_message:
136
- rdoc_options:
137
- - --charset=UTF-8
135
+ rdoc_options: []
136
+
138
137
  require_paths:
139
138
  - lib
140
139
  required_ruby_version: !ruby/object:Gem::Requirement