ruby-plsql-spec 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 926bc9ee745cd69cd401e19559efaa9aaa8552d1
4
- data.tar.gz: 2bcf1b8dccdee59d09314d134f59548aa5b15769
3
+ metadata.gz: eb057d0e12aaf9194746fbb62601ae2f987b709d
4
+ data.tar.gz: 6058606e45a1678505269b28d1c8faa5e85b69fc
5
5
  SHA512:
6
- metadata.gz: 3a9bafcfdb0f06cc4ba1ac6e1eee08a0cabf941bb3dde968cacb3aa7fd24fa33cc041c6288dc2caa237bc972bce05f259424bb61724c9a18fc88d93d87c2abe4
7
- data.tar.gz: 65645390db2b2bef19893a6307e9bd6f0579c6e83bb4549bfcbb7a667d5d51d45d559fef65d59e611b6f1c9f4a53a5bf011c09d914c229afb326f7bd40f3b588
6
+ metadata.gz: 5fca2fda487b606d324b1b504d73c98170614da3c112a2b176b824199849469ce55985db4d121966d81f665df65d2a9dbf25c3023d267c7dbf47f19048947bd9
7
+ data.tar.gz: beac1a3e4474a804043360ec3252975f9fe11e7816ccdac7e0bc6a14038e3a68bd8ea341f558f54ab78a17222a8b4c753f85cccc37fb89e1428e3ac3516767dd
@@ -0,0 +1,38 @@
1
+ sudo: required
2
+
3
+ env:
4
+ global:
5
+ - ORACLE_COOKIE=sqldev
6
+ - ORACLE_FILE=oracle11g/xe/oracle-xe-11.2.0-1.0.x86_64.rpm.zip
7
+ - ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
8
+ - NLS_LANG=AMERICAN_AMERICA.AL32UTF8
9
+ - ORACLE_BASE=/u01/app/oracle
10
+ - LD_LIBRARY_PATH=$ORACLE_HOME/lib
11
+ - PATH=$PATH:$ORACLE_HOME/jdbc/lib
12
+ - DATABASE_VERSION=11.2.0.2
13
+ - ORACLE_SID=XE
14
+ - DATABASE_NAME=XE
15
+ # - JRUBY_OPTS='--ng'
16
+ - ORA_SDTZ='Europe/London' #Needed as a client parameter
17
+ - TZ='Europe/London' #Needed as a DB Server parameter
18
+
19
+ before_install:
20
+ - chmod +x .travis/oracle/download.sh
21
+ - chmod +x .travis/oracle/install.sh
22
+ - chmod +x .travis/setup_accounts.sh
23
+
24
+ install:
25
+ - .travis/oracle/download.sh
26
+ - .travis/oracle/install.sh
27
+ - .travis/setup_accounts.sh
28
+ - bundle install --without=development
29
+
30
+ language: ruby
31
+ rvm:
32
+ - 2.3.1
33
+ - 2.3.0
34
+ - 2.2.4
35
+ - 1.9.3
36
+ - jruby-1.7.9
37
+ - jruby-9.0.5.0
38
+ - jruby-9.1.0.0
@@ -0,0 +1,5 @@
1
+ Copyright (c) 2013, Christopher Bandy
2
+
3
+ Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
4
+
5
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
@@ -0,0 +1,64 @@
1
+ [![Build](https://travis-ci.org/cbandy/travis-oracle.svg?branch=master)](https://travis-ci.org/cbandy/travis-oracle)
2
+
3
+ Use [Oracle Database Express Edition][] in your builds on [Travis CI][].
4
+
5
+ [Oracle Database Express Edition]: http://www.oracle.com/technetwork/database/database-technologies/express-edition/overview/index.html
6
+ [Travis CI]: https://travis-ci.org/
7
+
8
+
9
+ Usage
10
+ -----
11
+
12
+ To use this tool, you must have an Oracle account with which you have accepted
13
+ the current license agreement for [Oracle Database Express Edition][].
14
+
15
+ 1. Add your Oracle username and password to your build [environment variables][],
16
+ either as hidden repository settings or encrypted variables:
17
+
18
+ | Variable Name | Value |
19
+ | -------------------------- | ------------- |
20
+ | `ORACLE_LOGIN_ssousername` | your username |
21
+ | `ORACLE_LOGIN_password` | your password |
22
+
23
+ 2. Add the version information to your build environment variables:
24
+
25
+ ```yaml
26
+ - ORACLE_COOKIE=sqldev
27
+ - ORACLE_FILE=oracle11g/xe/oracle-xe-11.2.0-1.0.x86_64.rpm.zip
28
+ - ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
29
+ - ORACLE_SID=XE
30
+ ```
31
+
32
+ 3. Download and extract the [latest release][] into your project. For example,
33
+
34
+ ```shell
35
+ wget 'https://github.com/cbandy/travis-oracle/archive/v2.0.0.tar.gz'
36
+ mkdir -p .travis/oracle
37
+ tar xz --strip-components 1 -C .travis/oracle -f v2.0.0.tar.gz
38
+ ```
39
+
40
+ 4. Enable [`sudo`](https://docs.travis-ci.com/user/workers/standard-infrastructure/):
41
+
42
+ ```yaml
43
+ sudo: required
44
+ ```
45
+
46
+ 5. Finally, execute the extracted scripts as part of your build, usually
47
+ during [`before_install`](https://docs.travis-ci.com/user/customizing-the-build/#The-Build-Lifecycle):
48
+
49
+ ```yaml
50
+ - .travis/oracle/download.sh
51
+ - .travis/oracle/install.sh
52
+ ```
53
+
54
+ [SQL\*Plus][] is installed to `$ORACLE_HOME/bin/sqlplus`, and the current user
55
+ has both normal and DBA access without a password, i.e. `/` and `/ AS SYSDBA`.
56
+
57
+ [OCI][] and [OCCI][] libraries and header files are in `$ORACLE_HOME/lib` and
58
+ `$ORACLE_HOME/rdbms/public`, respectively.
59
+
60
+ [environment variables]: https://docs.travis-ci.com/user/environment-variables/
61
+ [latest release]: https://github.com/cbandy/travis-oracle/releases/latest
62
+ [OCCI]: http://www.oracle.com/pls/topic/lookup?ctx=xe112&id=LNCPP
63
+ [OCI]: http://www.oracle.com/pls/topic/lookup?ctx=xe112&id=LNOCI
64
+ [SQL\*Plus]: http://www.oracle.com/pls/topic/lookup?ctx=xe112&id=SQPUG
@@ -0,0 +1,100 @@
1
+ // vim: set et sw=2 ts=2:
2
+ "use strict";
3
+ var env = process.env;
4
+ var Promise = require('bluebird');
5
+ var Phantom = Promise.promisifyAll(require('node-phantom-simple'));
6
+ var PhantomError = require('node-phantom-simple/headless_error');
7
+
8
+ Phantom.createAsync({ parameters: { 'ssl-protocol': 'tlsv1' } }).then(function (browser) {
9
+ browser = Promise.promisifyAll(browser, { suffix: 'Promise' });
10
+
11
+ // Configure the browser, open a tab
12
+ return browser
13
+ .addCookiePromise({'name': 'oraclelicense', 'value': "accept-" + env['ORACLE_COOKIE'] + "-cookie", 'domain': '.oracle.com' })
14
+ .then(function () {
15
+ return browser.createPagePromise();
16
+ })
17
+ .then(function (page) {
18
+ page = Promise.promisifyAll(page, { suffix: 'Promise' });
19
+
20
+ // Configure the tab
21
+ page.onResourceError = console.error.bind(console);
22
+ return page
23
+ .setPromise('settings.userAgent', env['USER_AGENT']) // PhantomJS configures the UA per tab
24
+
25
+ // Request the file, wait for the login page
26
+ .then(function () {
27
+ return page.openPromise("https://edelivery.oracle.com/akam/otn/linux/" + env['ORACLE_FILE']).then(function (status) {
28
+ if (status != 'success') throw "Unable to connect to oracle.com";
29
+ return page.waitForSelectorPromise('input[type=password]', 5000);
30
+ })
31
+ .catch(PhantomError, function (err) {
32
+ return page.getPromise('plainText').then(function (text) {
33
+ console.error("Unable to load login page. Last response was:\n" + text);
34
+ throw err;
35
+ });
36
+ });
37
+ })
38
+
39
+ // Export cookies for cURL
40
+ .then(function () {
41
+ return page.getPromise('cookies').then(function (cookies) {
42
+ var data = "";
43
+ for (var i = 0; i < cookies.length; ++i) {
44
+ var cookie = cookies[i];
45
+ data += cookie.domain + "\tTRUE\t" + cookie.path + "\t"
46
+ + (cookie.secure ? "TRUE" : "FALSE") + "\t0\t"
47
+ + cookie.name + "\t" + cookie.value + "\n";
48
+ }
49
+ return Promise.promisifyAll(require('fs')).writeFileAsync(env['COOKIES'], data);
50
+ });
51
+ })
52
+
53
+ // Submit the login form using cURL
54
+ .then(function () {
55
+ return page.evaluatePromise(function () {
56
+ var $form = jQuery(document.forms[0]);
57
+ return {
58
+ action: $form.prop('action'),
59
+ data: $form.serialize()
60
+ };
61
+ })
62
+ .then(function (form) {
63
+ return browser.exitPromise().then(function () {
64
+ for (var key in env) {
65
+ if (key.indexOf('ORACLE_LOGIN_') == 0 && env.hasOwnProperty(key)) {
66
+ var name = key.substr(13) + '=';
67
+ form.data = form.data.replace(name, name + env[key]);
68
+ }
69
+ }
70
+
71
+ var cmd = ['curl', [
72
+ '--cookie', env['COOKIES'],
73
+ '--cookie-jar', env['COOKIES'],
74
+ '--data', '@-',
75
+ '--location',
76
+ '--output', require('path').basename(env['ORACLE_FILE']),
77
+ '--user-agent', env['USER_AGENT'],
78
+ form.action
79
+ ]];
80
+
81
+ console.info("Executing %j", cmd);
82
+
83
+ var child_process = require('child_process');
84
+ var child = child_process.spawn.apply(child_process, cmd.concat({ stdio: ['pipe', 1, 2] }));
85
+ child.on('exit', process.exit);
86
+ child.stdin.end(form.data);
87
+ });
88
+ });
89
+ })
90
+ .catch(function (err) {
91
+ console.error(err);
92
+ browser.on('exit', function () { process.exit(1); });
93
+ browser.exit();
94
+ });
95
+ });
96
+ })
97
+ .catch(function (err) {
98
+ console.error(err);
99
+ process.exit(1);
100
+ });
@@ -0,0 +1,16 @@
1
+ #!/bin/sh -e
2
+
3
+ [ -n "$ORACLE_COOKIE" ] || { echo "Missing ORACLE_COOKIE environment variable!"; exit 1; }
4
+ [ -n "$ORACLE_FILE" ] || { echo "Missing ORACLE_FILE environment variable!"; exit 1; }
5
+
6
+ cd "$(dirname "$(readlink -f "$0")")"
7
+
8
+ npm install bluebird node-phantom-simple
9
+
10
+ export COOKIES='cookies.txt'
11
+ export USER_AGENT='Mozilla/5.0'
12
+
13
+ echo > "$COOKIES"
14
+ chmod 600 "$COOKIES"
15
+
16
+ exec node download.js
@@ -0,0 +1,32 @@
1
+ #!/bin/sh -e
2
+
3
+ [ -n "$ORACLE_FILE" ] || { echo "Missing ORACLE_FILE environment variable!"; exit 1; }
4
+ [ -n "$ORACLE_HOME" ] || { echo "Missing ORACLE_HOME environment variable!"; exit 1; }
5
+
6
+ ORACLE_RPM="$(basename $ORACLE_FILE .zip)"
7
+
8
+ cd "$(dirname "$(readlink -f "$0")")"
9
+
10
+ sudo apt-get -qq update
11
+ sudo apt-get --no-install-recommends -qq install bc libaio1 rpm unzip
12
+
13
+ df -B1 /dev/shm | awk 'END { if ($1 != "shmfs" && $1 != "tmpfs" || $2 < 2147483648) exit 1 }' ||
14
+ ( sudo rm -r /dev/shm && sudo mkdir /dev/shm && sudo mount -t tmpfs shmfs -o size=2G /dev/shm )
15
+
16
+ test -f /sbin/chkconfig ||
17
+ ( echo '#!/bin/sh' | sudo tee /sbin/chkconfig > /dev/null && sudo chmod u+x /sbin/chkconfig )
18
+
19
+ test -d /var/lock/subsys || sudo mkdir /var/lock/subsys
20
+
21
+ unzip -j "$(basename $ORACLE_FILE)" "*/$ORACLE_RPM"
22
+ sudo rpm --install --nodeps --nopre "$ORACLE_RPM"
23
+
24
+ echo 'OS_AUTHENT_PREFIX=""' | sudo tee -a "$ORACLE_HOME/config/scripts/init.ora" > /dev/null
25
+ sudo usermod -aG dba $USER
26
+
27
+ ( echo ; echo ; echo travis ; echo travis ; echo n ) | sudo AWK='/usr/bin/awk' /etc/init.d/oracle-xe configure
28
+
29
+ "$ORACLE_HOME/bin/sqlplus" -L -S / AS SYSDBA <<SQL
30
+ CREATE USER $USER IDENTIFIED EXTERNALLY;
31
+ GRANT CONNECT, RESOURCE TO $USER;
32
+ SQL
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+
3
+ set -ev
4
+
5
+ "$ORACLE_HOME/bin/sqlplus" -L -S / AS SYSDBA <<SQL
6
+ @@spec/support/unlock_and_setup_hr_user.sql
7
+ SQL
data/Gemfile CHANGED
@@ -3,12 +3,18 @@ source 'http://rubygems.org'
3
3
  gem 'rspec', '>= 2.0', '< 4.0'
4
4
  gem 'rspec-support', '>= 3.1', '< 4.0'
5
5
  gem 'thor', '~> 0.19.1'
6
- gem 'ruby-plsql', '~> 0.5.0'
6
+ gem 'ruby-plsql', '~> 0.5'
7
7
  gem 'nokogiri', '~> 1.6.0'
8
8
 
9
9
  group :development do
10
- gem 'jeweler', '~> 2.0.1'
10
+ gem 'juwelier', '~> 2.0'
11
+ gem 'rspec_junit_formatter'
12
+ end
13
+
14
+ group :test, :development do
15
+ gem 'rake', '>= 10.0'
11
16
 
12
- # gem 'ruby-oci8', '~> 2.1.0'
13
- gem 'ruby-oci8', :git => 'git://github.com/kubo/ruby-oci8.git', :platforms => :mri
17
+ platforms :ruby, :mswin, :mingw do
18
+ gem 'ruby-oci8', '~> 2.1'
19
+ end
14
20
  end
@@ -1,3 +1,18 @@
1
+ == 0.5.0 2016-05-13
2
+
3
+ * Improvements
4
+ * Tested with ruby 2.3.0, 2.3.1
5
+ * Support for higher ruby-plsql versions - 0.6+ (#38)
6
+ * `require 'spec_helper'` is no longer needed in each spec file (#26)
7
+ * Update examples to use the "expect" RSpec syntax (#23)
8
+ * Bug fixes
9
+ * Fix profiler: was only working with UPCASE procedure and function name (#30)
10
+ * Fix disposal of connections when using multiple ones (#22)
11
+ * Internal (development) improvements
12
+ * Migrate from jeweler to juwelier (#37)
13
+ * Setup CI build on travis-ci.org (#36)
14
+ * Allow reporting of Unit Tests on Jenkins CI with "RspecJunitFormatter" (#31)
15
+
1
16
  == 0.4.0 2015-01-30
2
17
 
3
18
  * Improvements
@@ -6,7 +6,7 @@ Ruby installation on Windows is a little bit different than installation on Mac
6
6
  Install Ruby
7
7
  ------------
8
8
 
9
- Download and install Ruby 1.9.3 from [Ruby Installer for Windows](http://www.rubyinstaller.org/).
9
+ Download and install Ruby from [Ruby Installer for Windows](http://www.rubyinstaller.org/).
10
10
 
11
11
  When installing then select checkbox to add Ruby to your PATH.
12
12
 
@@ -32,7 +32,7 @@ Install ruby-oci8
32
32
 
33
33
  gem install ruby-oci8
34
34
 
35
- If you are behind firewall with proxy server then specify proxy server use -p option, e.g.:
35
+ If you are behind firewall with proxy server then specify proxy server use -p option, e.g.:
36
36
 
37
37
  gem install ruby-oci8 -p http://proxy.example.com:8080
38
38
 
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009-2015 Raimonds Simanovskis
1
+ Copyright (c) 2009-2016 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.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![Build Status](https://travis-ci.org/rsim/ruby-plsql-spec.svg?branch=master)](https://travis-ci.org/rsim/ruby-plsql-spec)
2
+
1
3
  ruby-plsql-spec
2
4
  ===============
3
5
  PL/SQL unit testing with Ruby
@@ -22,7 +24,7 @@ Installing
22
24
 
23
25
  See [Installing on Windows](INSTALL-Windows.md) in separate file.
24
26
 
25
- * Install [Ruby 1.8.7, 1.9.3 or 2.2.x](http://www.ruby-lang.org/en/downloads/) - it is recommended to use latest version
27
+ * Install [Ruby 1.8.7, 1.9.3 or 2.x](http://www.ruby-lang.org/en/downloads/) - it is recommended to use latest version
26
28
  * Install Oracle client, e.g. [Oracle Instant Client](http://www.oracle.com/technology/tech/oci/instantclient/index.html)
27
29
  * Install ruby-oci8 and ruby-plsql-spec (prefix with sudo if necessary)
28
30
 
@@ -110,7 +112,7 @@ If you want to upgrade ruby-plsql-spec to latest version then just do
110
112
 
111
113
  gem install ruby-plsql-spec
112
114
 
113
- If you have upgrade from ruby-plsql-spec version 0.1.0 to 0.2.0 then you need to update your spec_helper.rb file to use rspec 2.0. You can do it by running one more time
115
+ If you have upgraded from ruby-plsql-spec version 0.1.0 to 0.2.0 then you need to update your spec_helper.rb file to use rspec 2.0. You can do it by running one more time
114
116
 
115
117
  plsql-spec init
116
118
 
data/Rakefile CHANGED
@@ -10,18 +10,22 @@ end
10
10
 
11
11
  require 'rake'
12
12
 
13
- require 'jeweler'
14
- Jeweler::Tasks.new do |gem|
15
- gem.name = "ruby-plsql-spec"
16
- gem.summary = "Oracle PL/SQL unit testing framework using Ruby and RSpec"
17
- gem.description = <<-EOS
13
+ begin
14
+ require 'juwelier'
15
+ Juwelier::Tasks.new do |gem|
16
+ gem.name = "ruby-plsql-spec"
17
+ gem.summary = "Oracle PL/SQL unit testing framework using Ruby and RSpec"
18
+ gem.description = <<-EOS
18
19
  ruby-plsql-spec is Oracle PL/SQL unit testing framework which is built using Ruby programming language, ruby-plsql library and RSpec testing framework.
19
- EOS
20
- gem.email = "raimonds.simanovskis@gmail.com"
21
- gem.homepage = "http://github.com/rsim/ruby-plsql-spec"
22
- gem.authors = ["Raimonds Simanovskis"]
20
+ EOS
21
+ gem.email = "raimonds.simanovskis@gmail.com"
22
+ gem.homepage = "http://github.com/rsim/ruby-plsql-spec"
23
+ gem.authors = ["Raimonds Simanovskis"]
24
+ end
25
+ Juwelier::RubygemsDotOrgTasks.new
26
+ rescue LoadError
27
+ # juwelier not installed
23
28
  end
24
- Jeweler::RubygemsDotOrgTasks.new
25
29
 
26
30
  require 'rspec/core/rake_task'
27
31
  RSpec::Core::RakeTask.new(:spec) do |t|
@@ -35,6 +39,7 @@ RSpec::Core::RakeTask.new(:rcov) do |t|
35
39
  end
36
40
 
37
41
  task :default => :spec
42
+ task :test => :spec
38
43
 
39
44
  require 'rdoc/task'
40
45
  Rake::RDocTask.new do |rdoc|
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.0
1
+ 0.5.0
@@ -0,0 +1 @@
1
+ --require spec_helper
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  # load 'award_bonus' procedure into the database
4
2
  require 'award_bonus'
5
3
 
@@ -16,7 +14,7 @@ describe "Award bonus" do
16
14
  :salary => salary
17
15
  )
18
16
  plsql.award_bonus(employee[:employee_id], sales_amt)
19
- get_employee(employee[:employee_id])[:salary].should == result
17
+ expect(get_employee(employee[:employee_id])[:salary]).to eq result
20
18
  end
21
19
  end
22
20
 
@@ -1,23 +1,21 @@
1
- require 'spec_helper'
2
-
3
1
  # load 'betwnstr' procedure into the database
4
2
  require "betwnstr"
5
3
 
6
4
  describe "Between string" do
7
5
  it "should be correct in normal case" do
8
- plsql.betwnstr('abcdefg', 2, 5).should == 'bcde'
6
+ expect(plsql.betwnstr('abcdefg', 2, 5)).to eq 'bcde'
9
7
  end
10
8
 
11
9
  it "should be correct with zero start value" do
12
- plsql.betwnstr('abcdefg', 0, 5).should == 'abcde'
10
+ expect(plsql.betwnstr('abcdefg', 0, 5)).to eq 'abcde'
13
11
  end
14
12
 
15
13
  it "should be correct with way big end value" do
16
- plsql.betwnstr('abcdefg', 5, 500).should == 'efg'
14
+ expect(plsql.betwnstr('abcdefg', 5, 500)).to eq 'efg'
17
15
  end
18
16
 
19
17
  it "should be correct with NULL string" do
20
- plsql.betwnstr(NULL, 5, 500).should == NULL
18
+ expect(plsql.betwnstr(NULL, 5, 500)).to eq NULL
21
19
  end
22
20
 
23
21
  end
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe "Oracle E-Business Suite" do
4
2
  before(:all) do
5
3
  # @old_connection = plsql.connection
@@ -47,15 +45,15 @@ describe "Oracle E-Business Suite" do
47
45
  end
48
46
 
49
47
  it "should return user name" do
50
- plsql.fnd_global.user_name.should == @user_name
48
+ expect(plsql.fnd_global.user_name).to eq @user_name
51
49
  end
52
50
 
53
51
  it "should return responsibility name" do
54
- plsql.fnd_global.resp_name.should == @responsibility_name
52
+ expect(plsql.fnd_global.resp_name).to eq @responsibility_name
55
53
  end
56
54
 
57
55
  end
58
56
 
59
57
  end
60
58
 
61
- end
59
+ end
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  require 'remove_rooms_by_name'
4
2
 
5
3
  describe "Remove rooms by name" do
@@ -29,7 +27,7 @@ describe "Remove rooms by name" do
29
27
  it "should remove a room without furniture" do
30
28
  rooms_without_b = plsql.rooms.all("WHERE name NOT LIKE 'B%'")
31
29
  plsql.remove_rooms_by_name('B%')
32
- plsql.rooms.all.should == rooms_without_b
30
+ expect(plsql.rooms.all).to eq rooms_without_b
33
31
  end
34
32
 
35
33
  it "should not remove a room with furniture" do
@@ -8,9 +8,8 @@ database_config = YAML.load(File.read(database_config_file))
8
8
  database_config = {} unless database_config.is_a?(Hash)
9
9
  database_connections = database_config.keys.map{|k| k.to_sym}
10
10
 
11
- database_config.each do |name, params|
12
- # change all keys to symbols
13
- name = name.to_sym
11
+ database_connections.each do |name|
12
+ params = database_config[name.to_s]
14
13
  symbol_params = Hash[*params.map{|k,v| [k.to_sym, v]}.flatten]
15
14
 
16
15
  plsql(name).connect! symbol_params
@@ -33,7 +32,7 @@ end
33
32
  # Do logoff when exiting to ensure that session temporary tables
34
33
  # (used when calling procedures with table types defined in packages)
35
34
  at_exit do
36
- database_connections.each do |name|
35
+ database_connections.reverse_each do |name|
37
36
  if ENV['PLSQL_COVERAGE']
38
37
  PLSQL::Coverage.stop(name)
39
38
  coverage_directory = name == :default ? ENV['PLSQL_COVERAGE'] : "#{ENV['PLSQL_COVERAGE']}/#{name}"
@@ -55,13 +54,13 @@ RSpec.configure do |config|
55
54
  end
56
55
  config.after(:each) do
57
56
  # Always perform rollback to savepoint after each test
58
- database_connections.each do |name|
57
+ database_connections.reverse_each do |name|
59
58
  plsql(name).rollback_to "before_each"
60
59
  end
61
60
  end
62
61
  config.after(:all) do
63
62
  # Always perform rollback after each describe block
64
- database_connections.each do |name|
63
+ database_connections.reverse_each do |name|
65
64
  plsql(name).rollback
66
65
  end
67
66
  end
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  require 'what_is_profiled'
4
2
 
5
3
  describe "what is profiled" do
@@ -207,7 +207,7 @@ module PLSQL
207
207
 
208
208
  # sometimes first PROCEDURE or FUNCTION line is reported as not executed, force ignoring it
209
209
  source.each do |line, text|
210
- if text =~ /^\s*(PROCEDURE|FUNCTION)/ && coverage[line] == 0
210
+ if text =~ /^\s*(PROCEDURE|FUNCTION)/i && coverage[line] == 0
211
211
  coverage.delete(line)
212
212
  end
213
213
  end
@@ -21,12 +21,9 @@ module PLSQL
21
21
 
22
22
  desc 'init', 'initialize spec subdirectory with default ruby-plsql-spec files'
23
23
  def init
24
- empty_directory 'spec'
25
- %w(spec_helper.rb database.yml).each do |file|
26
- copy_file file, "spec/#{file}"
27
- end
28
- directory 'helpers', 'spec/helpers'
29
24
  empty_directory 'spec/factories'
25
+ copy_file '.rspec', '.rspec'
26
+ directory 'spec', 'spec'
30
27
  say <<-EOS, :red
31
28
 
32
29
  Please update spec/database.yml file and specify your database connection parameters.
@@ -0,0 +1 @@
1
+ --require spec_helper
@@ -8,9 +8,8 @@ database_config = YAML.load(File.read(database_config_file))
8
8
  database_config = {} unless database_config.is_a?(Hash)
9
9
  database_connections = database_config.keys.map{|k| k.to_sym}
10
10
 
11
- database_config.each do |name, params|
12
- # change all keys to symbols
13
- name = name.to_sym
11
+ database_connections.each do |name|
12
+ params = database_config[name.to_s]
14
13
  symbol_params = Hash[*params.map{|k,v| [k.to_sym, v]}.flatten]
15
14
 
16
15
  plsql(name).connect! symbol_params
@@ -33,7 +32,7 @@ end
33
32
  # Do logoff when exiting to ensure that session temporary tables
34
33
  # (used when calling procedures with table types defined in packages)
35
34
  at_exit do
36
- database_connections.each do |name|
35
+ database_connections.reverse_each do |name|
37
36
  if ENV['PLSQL_COVERAGE']
38
37
  PLSQL::Coverage.stop(name)
39
38
  coverage_directory = name == :default ? ENV['PLSQL_COVERAGE'] : "#{ENV['PLSQL_COVERAGE']}/#{name}"
@@ -55,13 +54,13 @@ RSpec.configure do |config|
55
54
  end
56
55
  config.after(:each) do
57
56
  # Always perform rollback to savepoint after each test
58
- database_connections.each do |name|
57
+ database_connections.reverse_each do |name|
59
58
  plsql(name).rollback_to "before_each"
60
59
  end
61
60
  end
62
61
  config.after(:all) do
63
62
  # Always perform rollback after each describe block
64
- database_connections.each do |name|
63
+ database_connections.reverse_each do |name|
65
64
  plsql(name).rollback
66
65
  end
67
66
  end
@@ -1,25 +1,32 @@
1
- # Generated by jeweler
1
+ # Generated by juwelier
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
3
+ # Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: ruby-plsql-spec 0.4.0 ruby lib
5
+ # stub: ruby-plsql-spec 0.5.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
- s.name = "ruby-plsql-spec"
9
- s.version = "0.4.0"
8
+ s.name = "ruby-plsql-spec".freeze
9
+ s.version = "0.5.0"
10
10
 
11
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
- s.require_paths = ["lib"]
13
- s.authors = ["Raimonds Simanovskis"]
14
- s.date = "2015-01-30"
15
- s.description = "ruby-plsql-spec is Oracle PL/SQL unit testing framework which is built using Ruby programming language, ruby-plsql library and RSpec testing framework.\n"
16
- s.email = "raimonds.simanovskis@gmail.com"
17
- s.executables = ["plsql-spec"]
11
+ s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
+ s.require_paths = ["lib".freeze]
13
+ s.authors = ["Raimonds Simanovskis".freeze]
14
+ s.date = "2016-05-13"
15
+ s.description = "ruby-plsql-spec is Oracle PL/SQL unit testing framework which is built using Ruby programming language, ruby-plsql library and RSpec testing framework.\n".freeze
16
+ s.email = "raimonds.simanovskis@gmail.com".freeze
17
+ s.executables = ["plsql-spec".freeze]
18
18
  s.extra_rdoc_files = [
19
19
  "README.md"
20
20
  ]
21
21
  s.files = [
22
22
  ".rspec",
23
+ ".travis.yml",
24
+ ".travis/oracle/LICENSE",
25
+ ".travis/oracle/README.md",
26
+ ".travis/oracle/download.js",
27
+ ".travis/oracle/download.sh",
28
+ ".travis/oracle/install.sh",
29
+ ".travis/setup_accounts.sh",
23
30
  "Gemfile",
24
31
  "History.txt",
25
32
  "INSTALL-Windows.md",
@@ -28,6 +35,7 @@ Gem::Specification.new do |s|
28
35
  "Rakefile",
29
36
  "VERSION",
30
37
  "bin/plsql-spec",
38
+ "examples/.rspec",
31
39
  "examples/source/award_bonus.rb",
32
40
  "examples/source/betwnstr.rb",
33
41
  "examples/source/remove_rooms_by_name.rb",
@@ -54,49 +62,57 @@ Gem::Specification.new do |s|
54
62
  "lib/plsql/coverage/table_line.html.erb",
55
63
  "lib/plsql/spec.rb",
56
64
  "lib/plsql/spec/cli.rb",
57
- "lib/plsql/spec/templates/database.yml",
58
- "lib/plsql/spec/templates/helpers/inspect_helpers.rb",
59
- "lib/plsql/spec/templates/helpers/time_helpers.rb",
60
- "lib/plsql/spec/templates/spec_helper.rb",
65
+ "lib/plsql/spec/templates/.rspec",
66
+ "lib/plsql/spec/templates/spec/database.yml",
67
+ "lib/plsql/spec/templates/spec/helpers/inspect_helpers.rb",
68
+ "lib/plsql/spec/templates/spec/helpers/time_helpers.rb",
69
+ "lib/plsql/spec/templates/spec/spec_helper.rb",
61
70
  "lib/plsql/spec/version.rb",
62
71
  "lib/ruby-plsql-spec.rb",
63
72
  "ruby-plsql-spec.gemspec",
64
73
  "spec/plsql/coverage_spec.rb",
65
74
  "spec/plsql/spec/cli_spec.rb",
66
- "spec/spec_helper.rb"
75
+ "spec/spec_helper.rb",
76
+ "spec/support/unlock_and_setup_hr_user.sql"
67
77
  ]
68
- s.homepage = "http://github.com/rsim/ruby-plsql-spec"
69
- s.rubygems_version = "2.4.5"
70
- s.summary = "Oracle PL/SQL unit testing framework using Ruby and RSpec"
78
+ s.homepage = "http://github.com/rsim/ruby-plsql-spec".freeze
79
+ s.rubygems_version = "2.6.4".freeze
80
+ s.summary = "Oracle PL/SQL unit testing framework using Ruby and RSpec".freeze
71
81
 
72
82
  if s.respond_to? :specification_version then
73
83
  s.specification_version = 4
74
84
 
75
85
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
76
- s.add_runtime_dependency(%q<rspec>, ["< 4.0", ">= 2.0"])
77
- s.add_runtime_dependency(%q<rspec-support>, ["< 4.0", ">= 3.1"])
78
- s.add_runtime_dependency(%q<thor>, ["~> 0.19.1"])
79
- s.add_runtime_dependency(%q<ruby-plsql>, ["~> 0.5.0"])
80
- s.add_runtime_dependency(%q<nokogiri>, ["~> 1.6.0"])
81
- s.add_development_dependency(%q<jeweler>, ["~> 2.0.1"])
82
- s.add_development_dependency(%q<ruby-oci8>, [">= 0"])
86
+ s.add_runtime_dependency(%q<rspec>.freeze, ["< 4.0", ">= 2.0"])
87
+ s.add_runtime_dependency(%q<rspec-support>.freeze, ["< 4.0", ">= 3.1"])
88
+ s.add_runtime_dependency(%q<thor>.freeze, ["~> 0.19.1"])
89
+ s.add_runtime_dependency(%q<ruby-plsql>.freeze, ["~> 0.5"])
90
+ s.add_runtime_dependency(%q<nokogiri>.freeze, ["~> 1.6.0"])
91
+ s.add_development_dependency(%q<juwelier>.freeze, ["~> 2.0"])
92
+ s.add_development_dependency(%q<rspec_junit_formatter>.freeze, [">= 0"])
93
+ s.add_development_dependency(%q<rake>.freeze, [">= 10.0"])
94
+ s.add_development_dependency(%q<ruby-oci8>.freeze, ["~> 2.1"])
83
95
  else
84
- s.add_dependency(%q<rspec>, ["< 4.0", ">= 2.0"])
85
- s.add_dependency(%q<rspec-support>, ["< 4.0", ">= 3.1"])
86
- s.add_dependency(%q<thor>, ["~> 0.19.1"])
87
- s.add_dependency(%q<ruby-plsql>, ["~> 0.5.0"])
88
- s.add_dependency(%q<nokogiri>, ["~> 1.6.0"])
89
- s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
90
- s.add_dependency(%q<ruby-oci8>, [">= 0"])
96
+ s.add_dependency(%q<rspec>.freeze, ["< 4.0", ">= 2.0"])
97
+ s.add_dependency(%q<rspec-support>.freeze, ["< 4.0", ">= 3.1"])
98
+ s.add_dependency(%q<thor>.freeze, ["~> 0.19.1"])
99
+ s.add_dependency(%q<ruby-plsql>.freeze, ["~> 0.5"])
100
+ s.add_dependency(%q<nokogiri>.freeze, ["~> 1.6.0"])
101
+ s.add_dependency(%q<juwelier>.freeze, ["~> 2.0"])
102
+ s.add_dependency(%q<rspec_junit_formatter>.freeze, [">= 0"])
103
+ s.add_dependency(%q<rake>.freeze, [">= 10.0"])
104
+ s.add_dependency(%q<ruby-oci8>.freeze, ["~> 2.1"])
91
105
  end
92
106
  else
93
- s.add_dependency(%q<rspec>, ["< 4.0", ">= 2.0"])
94
- s.add_dependency(%q<rspec-support>, ["< 4.0", ">= 3.1"])
95
- s.add_dependency(%q<thor>, ["~> 0.19.1"])
96
- s.add_dependency(%q<ruby-plsql>, ["~> 0.5.0"])
97
- s.add_dependency(%q<nokogiri>, ["~> 1.6.0"])
98
- s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
99
- s.add_dependency(%q<ruby-oci8>, [">= 0"])
107
+ s.add_dependency(%q<rspec>.freeze, ["< 4.0", ">= 2.0"])
108
+ s.add_dependency(%q<rspec-support>.freeze, ["< 4.0", ">= 3.1"])
109
+ s.add_dependency(%q<thor>.freeze, ["~> 0.19.1"])
110
+ s.add_dependency(%q<ruby-plsql>.freeze, ["~> 0.5"])
111
+ s.add_dependency(%q<nokogiri>.freeze, ["~> 1.6.0"])
112
+ s.add_dependency(%q<juwelier>.freeze, ["~> 2.0"])
113
+ s.add_dependency(%q<rspec_junit_formatter>.freeze, [">= 0"])
114
+ s.add_dependency(%q<rake>.freeze, [">= 10.0"])
115
+ s.add_dependency(%q<ruby-oci8>.freeze, ["~> 2.1"])
100
116
  end
101
117
  end
102
118
 
@@ -44,7 +44,7 @@ describe "plsql-spec" do
44
44
 
45
45
  def create_test(name, string, options = {})
46
46
  file_content = <<-EOS
47
- require 'spec_helper'
47
+ require_relative './spec_helper'
48
48
 
49
49
  describe "test" do
50
50
  it #{name.inspect} do
@@ -91,6 +91,10 @@ EOS
91
91
  expect(File.directory?(@root_dir + '/spec/factories')).to be_truthy
92
92
  end
93
93
 
94
+ it "should create .rspec" do
95
+ expect(File.file?(@root_dir + '/.rspec')).to be_truthy
96
+ end
97
+
94
98
  end
95
99
 
96
100
  describe "run" do
@@ -0,0 +1,2 @@
1
+ alter user hr identified by hr account unlock;
2
+ grant execute on dbms_lock to hr;
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-plsql-spec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Raimonds Simanovskis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-30 00:00:00.000000000 Z
11
+ date: 2016-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -70,14 +70,14 @@ dependencies:
70
70
  requirements:
71
71
  - - "~>"
72
72
  - !ruby/object:Gem::Version
73
- version: 0.5.0
73
+ version: '0.5'
74
74
  type: :runtime
75
75
  prerelease: false
76
76
  version_requirements: !ruby/object:Gem::Requirement
77
77
  requirements:
78
78
  - - "~>"
79
79
  - !ruby/object:Gem::Version
80
- version: 0.5.0
80
+ version: '0.5'
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: nokogiri
83
83
  requirement: !ruby/object:Gem::Requirement
@@ -93,21 +93,21 @@ dependencies:
93
93
  - !ruby/object:Gem::Version
94
94
  version: 1.6.0
95
95
  - !ruby/object:Gem::Dependency
96
- name: jeweler
96
+ name: juwelier
97
97
  requirement: !ruby/object:Gem::Requirement
98
98
  requirements:
99
99
  - - "~>"
100
100
  - !ruby/object:Gem::Version
101
- version: 2.0.1
101
+ version: '2.0'
102
102
  type: :development
103
103
  prerelease: false
104
104
  version_requirements: !ruby/object:Gem::Requirement
105
105
  requirements:
106
106
  - - "~>"
107
107
  - !ruby/object:Gem::Version
108
- version: 2.0.1
108
+ version: '2.0'
109
109
  - !ruby/object:Gem::Dependency
110
- name: ruby-oci8
110
+ name: rspec_junit_formatter
111
111
  requirement: !ruby/object:Gem::Requirement
112
112
  requirements:
113
113
  - - ">="
@@ -120,8 +120,38 @@ dependencies:
120
120
  - - ">="
121
121
  - !ruby/object:Gem::Version
122
122
  version: '0'
123
- description: |
124
- ruby-plsql-spec is Oracle PL/SQL unit testing framework which is built using Ruby programming language, ruby-plsql library and RSpec testing framework.
123
+ - !ruby/object:Gem::Dependency
124
+ name: rake
125
+ requirement: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - ">="
128
+ - !ruby/object:Gem::Version
129
+ version: '10.0'
130
+ type: :development
131
+ prerelease: false
132
+ version_requirements: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ version: '10.0'
137
+ - !ruby/object:Gem::Dependency
138
+ name: ruby-oci8
139
+ requirement: !ruby/object:Gem::Requirement
140
+ requirements:
141
+ - - "~>"
142
+ - !ruby/object:Gem::Version
143
+ version: '2.1'
144
+ type: :development
145
+ prerelease: false
146
+ version_requirements: !ruby/object:Gem::Requirement
147
+ requirements:
148
+ - - "~>"
149
+ - !ruby/object:Gem::Version
150
+ version: '2.1'
151
+ description: 'ruby-plsql-spec is Oracle PL/SQL unit testing framework which is built
152
+ using Ruby programming language, ruby-plsql library and RSpec testing framework.
153
+
154
+ '
125
155
  email: raimonds.simanovskis@gmail.com
126
156
  executables:
127
157
  - plsql-spec
@@ -130,6 +160,13 @@ extra_rdoc_files:
130
160
  - README.md
131
161
  files:
132
162
  - ".rspec"
163
+ - ".travis.yml"
164
+ - ".travis/oracle/LICENSE"
165
+ - ".travis/oracle/README.md"
166
+ - ".travis/oracle/download.js"
167
+ - ".travis/oracle/download.sh"
168
+ - ".travis/oracle/install.sh"
169
+ - ".travis/setup_accounts.sh"
133
170
  - Gemfile
134
171
  - History.txt
135
172
  - INSTALL-Windows.md
@@ -138,6 +175,7 @@ files:
138
175
  - Rakefile
139
176
  - VERSION
140
177
  - bin/plsql-spec
178
+ - examples/.rspec
141
179
  - examples/source/award_bonus.rb
142
180
  - examples/source/betwnstr.rb
143
181
  - examples/source/remove_rooms_by_name.rb
@@ -164,16 +202,18 @@ files:
164
202
  - lib/plsql/coverage/table_line.html.erb
165
203
  - lib/plsql/spec.rb
166
204
  - lib/plsql/spec/cli.rb
167
- - lib/plsql/spec/templates/database.yml
168
- - lib/plsql/spec/templates/helpers/inspect_helpers.rb
169
- - lib/plsql/spec/templates/helpers/time_helpers.rb
170
- - lib/plsql/spec/templates/spec_helper.rb
205
+ - lib/plsql/spec/templates/.rspec
206
+ - lib/plsql/spec/templates/spec/database.yml
207
+ - lib/plsql/spec/templates/spec/helpers/inspect_helpers.rb
208
+ - lib/plsql/spec/templates/spec/helpers/time_helpers.rb
209
+ - lib/plsql/spec/templates/spec/spec_helper.rb
171
210
  - lib/plsql/spec/version.rb
172
211
  - lib/ruby-plsql-spec.rb
173
212
  - ruby-plsql-spec.gemspec
174
213
  - spec/plsql/coverage_spec.rb
175
214
  - spec/plsql/spec/cli_spec.rb
176
215
  - spec/spec_helper.rb
216
+ - spec/support/unlock_and_setup_hr_user.sql
177
217
  homepage: http://github.com/rsim/ruby-plsql-spec
178
218
  licenses: []
179
219
  metadata: {}
@@ -193,7 +233,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
193
233
  version: '0'
194
234
  requirements: []
195
235
  rubyforge_project:
196
- rubygems_version: 2.4.5
236
+ rubygems_version: 2.6.4
197
237
  signing_key:
198
238
  specification_version: 4
199
239
  summary: Oracle PL/SQL unit testing framework using Ruby and RSpec