ruby-plsql-spec 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 926bc9ee745cd69cd401e19559efaa9aaa8552d1
4
+ data.tar.gz: 2bcf1b8dccdee59d09314d134f59548aa5b15769
5
+ SHA512:
6
+ metadata.gz: 3a9bafcfdb0f06cc4ba1ac6e1eee08a0cabf941bb3dde968cacb3aa7fd24fa33cc041c6288dc2caa237bc972bce05f259424bb61724c9a18fc88d93d87c2abe4
7
+ data.tar.gz: 65645390db2b2bef19893a6307e9bd6f0579c6e83bb4549bfcbb7a667d5d51d45d559fef65d59e611b6f1c9f4a53a5bf011c09d914c229afb326f7bd40f3b588
data/Gemfile CHANGED
@@ -1,12 +1,13 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
- gem 'rspec', '~> 2.0'
4
- gem 'thor', '~> 0.14.2'
3
+ gem 'rspec', '>= 2.0', '< 4.0'
4
+ gem 'rspec-support', '>= 3.1', '< 4.0'
5
+ gem 'thor', '~> 0.19.1'
5
6
  gem 'ruby-plsql', '~> 0.5.0'
6
- gem 'nokogiri', '~> 1.5.0'
7
+ gem 'nokogiri', '~> 1.6.0'
7
8
 
8
9
  group :development do
9
- gem 'jeweler', '~> 1.8.3'
10
+ gem 'jeweler', '~> 2.0.1'
10
11
 
11
12
  # gem 'ruby-oci8', '~> 2.1.0'
12
13
  gem 'ruby-oci8', :git => 'git://github.com/kubo/ruby-oci8.git', :platforms => :mri
data/History.txt CHANGED
@@ -1,3 +1,20 @@
1
+ == 0.4.0 2015-01-30
2
+
3
+ * Improvements
4
+ * Use latest latest nokogiri version 1.6, thor 0.19.1 (#18)
5
+ * Add support for latest rspec 3.x (#13)
6
+ * Added --capture option to plsql-spec to indicate when to capture the output (#10)
7
+ * Tested with Ruby version 2.2.0
8
+ * Tested with ruby-oci8 version 2.1.7
9
+ * Buf fixes
10
+ * fix for cli diff issue related to color rendering (#14)
11
+ * Internal (development) improvements
12
+ * Ensure DATABASE\_PORT is Fixnum (#16)
13
+ * Coverage test fix: compile plsql with optimize level 1 (#13)
14
+ * Tests: allow fully-qualified service name connection (#12)
15
+ * Migrate tests to rspec 3.x, using expect syntax (#13)
16
+ * Use latest jeweler 2.0.1 (#18)
17
+
1
18
  == 0.3.0 2012-04-16
2
19
 
3
20
  * Changes
data/License.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009-2012 Raimonds Simanovskis
1
+ Copyright (c) 2009-2015 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
@@ -17,4 +17,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
17
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
18
  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
19
  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -22,7 +22,7 @@ Installing
22
22
 
23
23
  See [Installing on Windows](INSTALL-Windows.md) in separate file.
24
24
 
25
- * Install [Ruby 1.8.7 or Ruby 1.9.3](http://www.ruby-lang.org/en/downloads/) - it is recommended to use latest 1.9.3 version
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
26
26
  * Install Oracle client, e.g. [Oracle Instant Client](http://www.oracle.com/technology/tech/oci/instantclient/index.html)
27
27
  * Install ruby-oci8 and ruby-plsql-spec (prefix with sudo if necessary)
28
28
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.4.0
@@ -1,5 +1,7 @@
1
1
  require 'thor'
2
2
  require 'thor/actions'
3
+ require 'rspec/support'
4
+ RSpec::Support.require_rspec_support 'differ'
3
5
 
4
6
  # use plsql-spec for showing diff of files
5
7
  # by defuault Thor uses diff utility which is not available on Windows
@@ -42,6 +44,10 @@ EOS
42
44
  :type => :boolean,
43
45
  :default => false,
44
46
  :banner => "show DBMS_OUTPUT messages"
47
+ method_option :capture,
48
+ :type => :boolean,
49
+ :default => true,
50
+ :banner => "hide the output when some exception occur"
45
51
  method_option :"html",
46
52
  :type => :string,
47
53
  :banner => "generate HTML RSpec output to specified file (default is test-results.html)"
@@ -76,10 +82,10 @@ EOS
76
82
 
77
83
  if files.empty?
78
84
  say "Running all specs from spec/", :yellow
79
- puts run("#{speccommand} spec", :verbose => false, :capture => true)
85
+ puts run("#{speccommand} spec", :verbose => false, :capture => options[:capture])
80
86
  else
81
87
  say "Running specs from #{files.join(', ')}", :yellow
82
- puts run("#{speccommand} #{files.join(' ')}", :verbose => false, :capture => true)
88
+ puts run("#{speccommand} #{files.join(' ')}", :verbose => false, :capture => options[:capture])
83
89
  end
84
90
 
85
91
  if options[:html]
@@ -98,7 +104,7 @@ EOS
98
104
 
99
105
  desc 'diff [FILE1] [FILE2]', 'show difference between files'
100
106
  def diff(file1, file2)
101
- differ = RSpec::Expectations::Differ.new
107
+ differ = RSpec::Support::Differ.new
102
108
  say differ.diff_as_string File.read(file2), File.read(file1)
103
109
  end
104
110
 
@@ -112,4 +118,4 @@ EOS
112
118
  end
113
119
 
114
120
  end
115
- end
121
+ end
@@ -2,14 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
+ # stub: ruby-plsql-spec 0.4.0 ruby lib
5
6
 
6
7
  Gem::Specification.new do |s|
7
8
  s.name = "ruby-plsql-spec"
8
- s.version = "0.3.0"
9
+ s.version = "0.4.0"
9
10
 
10
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
+ s.require_paths = ["lib"]
11
13
  s.authors = ["Raimonds Simanovskis"]
12
- s.date = "2012-04-16"
14
+ s.date = "2015-01-30"
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"
14
16
  s.email = "raimonds.simanovskis@gmail.com"
15
17
  s.executables = ["plsql-spec"]
@@ -64,34 +66,36 @@ Gem::Specification.new do |s|
64
66
  "spec/spec_helper.rb"
65
67
  ]
66
68
  s.homepage = "http://github.com/rsim/ruby-plsql-spec"
67
- s.require_paths = ["lib"]
68
- s.rubygems_version = "1.8.11"
69
+ s.rubygems_version = "2.4.5"
69
70
  s.summary = "Oracle PL/SQL unit testing framework using Ruby and RSpec"
70
71
 
71
72
  if s.respond_to? :specification_version then
72
- s.specification_version = 3
73
+ s.specification_version = 4
73
74
 
74
75
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
75
- s.add_runtime_dependency(%q<rspec>, ["~> 2.0"])
76
- s.add_runtime_dependency(%q<thor>, ["~> 0.14.2"])
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"])
77
79
  s.add_runtime_dependency(%q<ruby-plsql>, ["~> 0.5.0"])
78
- s.add_runtime_dependency(%q<nokogiri>, ["~> 1.5.0"])
79
- s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
80
+ s.add_runtime_dependency(%q<nokogiri>, ["~> 1.6.0"])
81
+ s.add_development_dependency(%q<jeweler>, ["~> 2.0.1"])
80
82
  s.add_development_dependency(%q<ruby-oci8>, [">= 0"])
81
83
  else
82
- s.add_dependency(%q<rspec>, ["~> 2.0"])
83
- s.add_dependency(%q<thor>, ["~> 0.14.2"])
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"])
84
87
  s.add_dependency(%q<ruby-plsql>, ["~> 0.5.0"])
85
- s.add_dependency(%q<nokogiri>, ["~> 1.5.0"])
86
- s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
88
+ s.add_dependency(%q<nokogiri>, ["~> 1.6.0"])
89
+ s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
87
90
  s.add_dependency(%q<ruby-oci8>, [">= 0"])
88
91
  end
89
92
  else
90
- s.add_dependency(%q<rspec>, ["~> 2.0"])
91
- s.add_dependency(%q<thor>, ["~> 0.14.2"])
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"])
92
96
  s.add_dependency(%q<ruby-plsql>, ["~> 0.5.0"])
93
- s.add_dependency(%q<nokogiri>, ["~> 1.5.0"])
94
- s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
97
+ s.add_dependency(%q<nokogiri>, ["~> 1.6.0"])
98
+ s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
95
99
  s.add_dependency(%q<ruby-oci8>, [">= 0"])
96
100
  end
97
101
  end
@@ -11,13 +11,19 @@ describe "Coverage" do
11
11
  PLSQL::Coverage.reset_cache
12
12
 
13
13
  plsql.connect! CONNECTION_PARAMS
14
+ plsql.execute "ALTER SESSION SET PLSQL_OPTIMIZE_LEVEL=1"
14
15
  drop_profiler_tables
15
16
  @source = <<-SQL
16
17
  CREATE OR REPLACE FUNCTION test_profiler RETURN VARCHAR2 IS
18
+
19
+ -- A comment before executed code
17
20
  BEGIN
18
21
  RETURN 'test_profiler';
22
+ -- A dummy empty line follows
23
+
19
24
  EXCEPTION
20
25
  WHEN OTHERS THEN
26
+ -- We should never reach here
21
27
  RETURN 'others';
22
28
  END;
23
29
  SQL
@@ -26,10 +32,13 @@ END;
26
32
  @coverage_data = {
27
33
  DATABASE_USER.upcase => {
28
34
  "TEST_PROFILER" => {
29
- 1=>0,
30
- 3=>1,
31
- 6=>0,
32
- 7=>1
35
+ 1=>1,
36
+ 4=>1,
37
+ 5=>1,
38
+ 8=>0,
39
+ 9=>0,
40
+ 11=>0,
41
+ 12=>1
33
42
  }
34
43
  }
35
44
  }
@@ -49,17 +58,17 @@ END;
49
58
  end
50
59
 
51
60
  it "should start coverage collection" do
52
- @start_result.should be_true
61
+ expect(@start_result).to be_truthy
53
62
  end
54
63
 
55
64
  it "should create profiler tables" do
56
65
  %w(plsql_profiler_data plsql_profiler_units plsql_profiler_runs).each do |table_name|
57
- plsql.send(table_name).should be_a(PLSQL::Table)
66
+ expect(plsql.send(table_name)).to be_a(PLSQL::Table)
58
67
  end
59
68
  end
60
69
 
61
70
  it "should start collecting profiler data" do
62
- plsql.plsql_profiler_runs.all.should_not be_empty
71
+ expect(plsql.plsql_profiler_runs.all).not_to be_empty
63
72
  end
64
73
 
65
74
  end
@@ -72,11 +81,11 @@ END;
72
81
  end
73
82
 
74
83
  it "should stop coverage collection" do
75
- @stop_result.should be_true
84
+ expect(@stop_result).to be_truthy
76
85
  end
77
86
 
78
87
  it "should populate profiler data table" do
79
- plsql.plsql_profiler_data.all.should_not be_empty
88
+ expect(plsql.plsql_profiler_data.all).not_to be_empty
80
89
  end
81
90
 
82
91
  end
@@ -89,21 +98,21 @@ END;
89
98
  end
90
99
 
91
100
  it "should drop profiler tables" do
92
- PLSQL::Coverage.cleanup.should be_true
101
+ expect(PLSQL::Coverage.cleanup).to be_truthy
93
102
  %w(plsql_profiler_data plsql_profiler_units plsql_profiler_runs).each do |table_name|
94
- PLSQL::Table.find(plsql, table_name.to_sym).should be_nil
103
+ expect(PLSQL::Table.find(plsql, table_name.to_sym)).to be_nil
95
104
  end
96
105
  end
97
106
 
98
107
  it "should delete profiler table data when profiler tables already were present" do
99
108
  # simulate that profiler tables were already present
100
109
  PLSQL::Coverage.reset_cache
101
- lambda {
110
+ expect {
102
111
  PLSQL::Coverage.start
103
112
  plsql.test_profiler
104
113
  PLSQL::Coverage.stop
105
114
  PLSQL::Coverage.cleanup
106
- }.should_not change {
115
+ }.not_to change {
107
116
  [plsql.plsql_profiler_data.all, plsql.plsql_profiler_units.all, plsql.plsql_profiler_runs.all]
108
117
  }
109
118
  end
@@ -117,19 +126,19 @@ END;
117
126
  end
118
127
 
119
128
  it "should get profiler run results" do
120
- PLSQL::Coverage.find.coverage_data.should == @coverage_data
129
+ expect(PLSQL::Coverage.find.coverage_data).to eq(@coverage_data)
121
130
  end
122
131
 
123
132
  it "should not get ignored schemas" do
124
- PLSQL::Coverage.find.coverage_data(:ignore_schemas => [DATABASE_USER]).should be_empty
133
+ expect(PLSQL::Coverage.find.coverage_data(:ignore_schemas => [DATABASE_USER])).to be_empty
125
134
  end
126
135
 
127
136
  it "should get only objects with like condition" do
128
- PLSQL::Coverage.find.coverage_data(:like => "#{DATABASE_USER}.test%").should == @coverage_data
137
+ expect(PLSQL::Coverage.find.coverage_data(:like => "#{DATABASE_USER}.test%")).to eq(@coverage_data)
129
138
  end
130
139
 
131
140
  it "should not get objects not matching like condition" do
132
- PLSQL::Coverage.find.coverage_data(:like => "#{DATABASE_USER}.none%").should be_empty
141
+ expect(PLSQL::Coverage.find.coverage_data(:like => "#{DATABASE_USER}.none%")).to be_empty
133
142
  end
134
143
 
135
144
  end
@@ -137,7 +146,7 @@ END;
137
146
  describe "generate" do
138
147
  def adjust_test_coverage
139
148
  @test_coverage = @coverage_data[DATABASE_USER.upcase]['TEST_PROFILER'].dup
140
- @test_coverage.delete(1) if @test_coverage[1] && @source.split("\n")[0] =~ /^CREATE OR REPLACE (.*)$/
149
+ @test_coverage.delete(1) if @test_coverage[1] == 0 && @source.split("\n")[0] =~ /^CREATE OR REPLACE (.*)$/
141
150
  end
142
151
 
143
152
  def expected_coverages
@@ -176,26 +185,29 @@ END;
176
185
 
177
186
  # line should be present
178
187
  a = @details_doc.at_css("table.details a[name=\"line#{i+1}\"]")
179
- a.should_not be_nil
188
+ expect(a).not_to be_nil
189
+
190
+ doc_line = a.parent.children[1]
191
+ doc_line_text = doc_line ? doc_line.text : ""
180
192
 
181
193
  # source text should be present
182
- a.parent.children[1].text.should == line
194
+ expect(doc_line_text).to eq(line)
183
195
 
184
196
  # table row should have correct class according to coverage data
185
197
  tr = a.ancestors('tr')[0]
186
- tr.attr('class').should == case @test_coverage[i+1]
198
+ expect(tr.attr('class')).to eq(case @test_coverage[i+1]
187
199
  when nil
188
200
  'inferred'
189
201
  when 0
190
202
  'uncovered'
191
203
  else
192
204
  'marked'
193
- end
205
+ end)
194
206
  end
195
207
  end
196
208
 
197
209
  it "should generate HTML table with coverage percentage" do
198
- @details_doc.css("table.report div.percent_graph_legend").map{|div| div.text}.should == expected_coverages
210
+ expect(@details_doc.css("table.report div.percent_graph_legend").map{|div| div.text}).to eq(expected_coverages)
199
211
  end
200
212
 
201
213
  end
@@ -206,8 +218,8 @@ END;
206
218
  end
207
219
 
208
220
  it "should generate HTML table with coverage percentage" do
209
- @index_doc.css("table.report tbody tr:contains('HR.TEST_PROFILER') div.percent_graph_legend").map{|div| div.text}.should == expected_coverages
210
- @index_doc.css("table.report tfoot div.percent_graph_legend").map{|div| div.text}.should == expected_coverages
221
+ expect(@index_doc.css("table.report tbody tr:contains('HR.TEST_PROFILER') div.percent_graph_legend").map{|div| div.text}).to eq(expected_coverages)
222
+ expect(@index_doc.css("table.report tfoot div.percent_graph_legend").map{|div| div.text}).to eq(expected_coverages)
211
223
  end
212
224
 
213
225
  end
@@ -230,21 +242,21 @@ END;
230
242
  end
231
243
 
232
244
  it "should start collecting profiler data" do
233
- plsql(:other).plsql_profiler_runs.all.should_not be_empty
245
+ expect(plsql(:other).plsql_profiler_runs.all).not_to be_empty
234
246
  end
235
247
 
236
248
  it "should populate profiler data table" do
237
- plsql(:other).plsql_profiler_data.all.should_not be_empty
249
+ expect(plsql(:other).plsql_profiler_data.all).not_to be_empty
238
250
  end
239
251
 
240
252
  it "should get profiler run results" do
241
- PLSQL::Coverage.find(:other).coverage_data.should == @coverage_data
253
+ expect(PLSQL::Coverage.find(:other).coverage_data).to eq(@coverage_data)
242
254
  end
243
255
 
244
256
  it "should generate reports" do
245
257
  PLSQL::Coverage.report :other, :directory => File.join(@directory, 'other')
246
- File.file?(File.join(@directory, 'other/index.html')).should be_true
258
+ expect(File.file?(File.join(@directory, 'other/index.html'))).to be_truthy
247
259
  end
248
260
  end
249
261
 
250
- end
262
+ end
@@ -24,7 +24,7 @@ describe "plsql-spec" do
24
24
  content = "default:\n" <<
25
25
  " username: #{DATABASE_USER}\n" <<
26
26
  " password: #{DATABASE_PASSWORD}\n" <<
27
- " database: #{DATABASE_NAME}\n"
27
+ " database: #{DATABASE_SERVICE_NAME}\n"
28
28
  content << " host: #{DATABASE_HOST}\n" if defined?(DATABASE_HOST)
29
29
  content << " port: #{DATABASE_PORT}\n" if defined?(DATABASE_PORT)
30
30
  File.open(File.join(@root_dir, 'spec/database.yml'), 'w') do |file|
@@ -72,23 +72,23 @@ EOS
72
72
  end
73
73
 
74
74
  it "should create spec subdirectory" do
75
- File.directory?(@root_dir + '/spec').should be_true
75
+ expect(File.directory?(@root_dir + '/spec')).to be_truthy
76
76
  end
77
77
 
78
78
  it "should create spec_helper.rb" do
79
- File.file?(@root_dir + '/spec/spec_helper.rb').should be_true
79
+ expect(File.file?(@root_dir + '/spec/spec_helper.rb')).to be_truthy
80
80
  end
81
81
 
82
82
  it "should create database.yml" do
83
- File.file?(@root_dir + '/spec/database.yml').should be_true
83
+ expect(File.file?(@root_dir + '/spec/database.yml')).to be_truthy
84
84
  end
85
85
 
86
86
  it "should create helpers/inspect_helpers.rb" do
87
- File.file?(@root_dir + '/spec/helpers/inspect_helpers.rb').should be_true
87
+ expect(File.file?(@root_dir + '/spec/helpers/inspect_helpers.rb')).to be_truthy
88
88
  end
89
89
 
90
90
  it "should create factories subdirectory" do
91
- File.directory?(@root_dir + '/spec/factories').should be_true
91
+ expect(File.directory?(@root_dir + '/spec/factories')).to be_truthy
92
92
  end
93
93
 
94
94
  end
@@ -103,41 +103,41 @@ EOS
103
103
  describe "successful tests" do
104
104
  before(:all) do
105
105
  create_test 'SYSDATE should not be NULL',
106
- 'plsql.sysdate.should_not == NULL'
106
+ 'expect(plsql.sysdate).not_to eq(NULL)'
107
107
  run_cli('run')
108
108
  end
109
109
 
110
110
  it "should report zero failures" do
111
- @stdout.should =~ / 0 failures/
111
+ expect(@stdout).to match(/ 0 failures/)
112
112
  end
113
113
 
114
114
  it "should not return failing exit status" do
115
- @exit_status.should be_nil
115
+ expect(@exit_status).to be_nil
116
116
  end
117
117
  end
118
118
 
119
119
  describe "failing tests" do
120
120
  before(:all) do
121
121
  create_test 'SYSDATE should be NULL',
122
- 'plsql.sysdate.should == NULL'
122
+ 'expect(plsql.sysdate).to eq(NULL)'
123
123
  run_cli('run')
124
124
  end
125
125
 
126
126
  it "should report failures" do
127
- @stdout.should =~ / 1 failure/
127
+ expect(@stdout).to match(/ 1 failure/)
128
128
  end
129
129
 
130
130
  it "should return failing exit status" do
131
- @exit_status.should == 1
131
+ expect(@exit_status).to eq(1)
132
132
  end
133
133
  end
134
134
 
135
135
  describe "specified files" do
136
136
  before(:all) do
137
137
  create_test 'SYSDATE should not be NULL',
138
- 'plsql.sysdate.should_not == NULL'
138
+ 'expect(plsql.sysdate).not_to eq(NULL)'
139
139
  create_test 'SYSDATE should be NULL',
140
- 'plsql.sysdate.should == NULL',
140
+ 'expect(plsql.sysdate).to eq(NULL)',
141
141
  :file_name => 'test2_spec.rb'
142
142
  end
143
143
 
@@ -147,12 +147,12 @@ EOS
147
147
 
148
148
  it "should report one file examples" do
149
149
  run_cli('run', 'spec/test_spec.rb')
150
- @stdout.should =~ /1 example/
150
+ expect(@stdout).to match(/1 example/)
151
151
  end
152
152
 
153
153
  it "should report two files examples" do
154
154
  run_cli('run', 'spec/test_spec.rb', 'spec/test2_spec.rb')
155
- @stdout.should =~ /2 examples/
155
+ expect(@stdout).to match(/2 examples/)
156
156
  end
157
157
  end
158
158
 
@@ -169,7 +169,7 @@ EOS
169
169
  END;
170
170
  SQL
171
171
  create_test 'shoud test coverage',
172
- 'plsql.test_profiler.should == "test_profiler"'
172
+ 'expect(plsql.test_profiler).to eq("test_profiler")'
173
173
  @index_file = File.join(@root_dir, 'coverage/index.html')
174
174
  @details_file = File.join(@root_dir, "coverage/#{DATABASE_USER.upcase}-TEST_PROFILER.html")
175
175
  end
@@ -190,34 +190,34 @@ EOS
190
190
 
191
191
  it "should report zero failures" do
192
192
  run_cli('run', '--coverage')
193
- @stdout.should =~ / 0 failures/
193
+ expect(@stdout).to match(/ 0 failures/)
194
194
  end
195
195
 
196
196
  it "should generate coverage reports" do
197
197
  run_cli('run', '--coverage')
198
- File.file?(@index_file).should be_true
199
- File.file?(@details_file).should be_true
198
+ expect(File.file?(@index_file)).to be_truthy
199
+ expect(File.file?(@details_file)).to be_truthy
200
200
  end
201
201
 
202
202
  it "should generate coverage reports in specified directory" do
203
203
  run_cli('run', '--coverage', 'plsql_coverage')
204
- File.file?(@index_file.gsub('coverage', 'plsql_coverage')).should be_true
205
- File.file?(@details_file.gsub('coverage', 'plsql_coverage')).should be_true
204
+ expect(File.file?(@index_file.gsub('coverage', 'plsql_coverage'))).to be_truthy
205
+ expect(File.file?(@details_file.gsub('coverage', 'plsql_coverage'))).to be_truthy
206
206
  end
207
207
 
208
208
  it "should not generate coverage report for ignored schema" do
209
209
  run_cli('run', '--coverage', '--ignore_schemas', DATABASE_USER)
210
- File.file?(@details_file).should be_false
210
+ expect(File.file?(@details_file)).to be_falsey
211
211
  end
212
212
 
213
213
  it "should generate coverage report for objects matching like condition" do
214
214
  run_cli('run', '--coverage', '--like', "#{DATABASE_USER}.%")
215
- File.file?(@details_file).should be_true
215
+ expect(File.file?(@details_file)).to be_truthy
216
216
  end
217
217
 
218
218
  it "should not generate coverage report for objects not matching like condition" do
219
219
  run_cli('run', '--coverage', '--like', "#{DATABASE_USER}.aaa%")
220
- File.file?(@details_file).should be_false
220
+ expect(File.file?(@details_file)).to be_falsey
221
221
  end
222
222
 
223
223
  end
@@ -232,7 +232,7 @@ EOS
232
232
  END;
233
233
  SQL
234
234
  create_test 'shoud test dbms_output',
235
- 'plsql.test_dbms_output.should be_nil'
235
+ 'expect(plsql.test_dbms_output).to be_nil'
236
236
  end
237
237
 
238
238
  after(:all) do
@@ -245,12 +245,12 @@ EOS
245
245
 
246
246
  it "should show DBMS_OUTPUT in standard output" do
247
247
  run_cli('run', '--dbms_output')
248
- @stdout.should =~ /DBMS_OUTPUT: test_dbms_output/
248
+ expect(@stdout).to match(/DBMS_OUTPUT: test_dbms_output/)
249
249
  end
250
250
 
251
251
  it "should not show DBMS_OUTPUT without specifying option" do
252
252
  run_cli('run')
253
- @stdout.should_not =~ /DBMS_OUTPUT: test_dbms_output/
253
+ expect(@stdout).not_to match(/DBMS_OUTPUT: test_dbms_output/)
254
254
  end
255
255
 
256
256
  end
@@ -258,7 +258,7 @@ EOS
258
258
  describe "with html output" do
259
259
  before(:all) do
260
260
  create_test 'SYSDATE should not be NULL',
261
- 'plsql.sysdate.should_not == NULL'
261
+ 'expect(plsql.sysdate).not_to eq(NULL)'
262
262
  @default_html_file = File.join(@root_dir, 'test-results.html')
263
263
  @custom_file_name = 'custom-results.html'
264
264
  @custom_html_file = File.join(@root_dir, @custom_file_name)
@@ -279,12 +279,12 @@ EOS
279
279
 
280
280
  it "should create default report file" do
281
281
  run_cli('run', '--html')
282
- File.read(@default_html_file).should =~ / 0 failures/
282
+ expect(File.read(@default_html_file)).to match(/ 0 failures/)
283
283
  end
284
284
 
285
285
  it "should create specified report file" do
286
286
  run_cli('run', '--html', @custom_file_name)
287
- File.read(@custom_html_file).should =~ / 0 failures/
287
+ expect(File.read(@custom_html_file)).to match(/ 0 failures/)
288
288
  end
289
289
 
290
290
  end
@@ -297,15 +297,15 @@ EOS
297
297
  end
298
298
 
299
299
  it "should show ruby-plsql-spec version" do
300
- @stdout.should =~ /ruby-plsql-spec\s+#{PLSQL::Spec::VERSION.gsub('.','\.')}/
300
+ expect(@stdout).to match(/ruby-plsql-spec\s+#{PLSQL::Spec::VERSION.gsub('.','\.')}/)
301
301
  end
302
302
 
303
303
  it "should show ruby-plsql version" do
304
- @stdout.should =~ /ruby-plsql\s+#{PLSQL::VERSION.gsub('.','\.')}/
304
+ expect(@stdout).to match(/ruby-plsql\s+#{PLSQL::VERSION.gsub('.','\.')}/)
305
305
  end
306
306
 
307
307
  it "should show rspec version" do
308
- @stdout.should =~ /rspec\s+#{::RSpec::Version::STRING.gsub('.','\.')}/
308
+ expect(@stdout).to match(/rspec\s+#{::RSpec::Version::STRING.gsub('.','\.')}/)
309
309
  end
310
310
 
311
311
  end
@@ -329,8 +329,8 @@ EOS
329
329
  end
330
330
 
331
331
  it "should show diff" do
332
- @stdout.should =~ /^\-#{@test_strings[0]}$/
333
- @stdout.should =~ /^\+#{@test_strings[1]}$/
332
+ expect(@stdout).to match(/^\-#{@test_strings[0]}$/)
333
+ expect(@stdout).to match(/^\+#{@test_strings[1]}$/)
334
334
  end
335
335
  end
336
336
 
data/spec/spec_helper.rb CHANGED
@@ -10,15 +10,17 @@ require 'nokogiri'
10
10
  require 'ruby-plsql-spec'
11
11
 
12
12
  DATABASE_NAME = ENV['DATABASE_NAME'] || 'orcl'
13
+ DATABASE_SERVICE_NAME = (defined?(JRUBY_VERSION) ? "/" : "") +
14
+ (ENV['DATABASE_SERVICE_NAME'] || DATABASE_NAME)
13
15
  DATABASE_HOST = ENV['DATABASE_HOST'] || 'localhost'
14
- DATABASE_PORT = ENV['DATABASE_PORT'] || 1521
16
+ DATABASE_PORT = (ENV['DATABASE_PORT'] || 1521).to_i
15
17
  DATABASE_USER = ENV['DATABASE_USER'] || 'hr'
16
18
  DATABASE_PASSWORD = ENV['DATABASE_PASSWORD'] || 'hr'
17
19
 
18
20
  CONNECTION_PARAMS = {
19
21
  :username => DATABASE_USER,
20
22
  :password => DATABASE_PASSWORD,
21
- :database => DATABASE_NAME
23
+ :database => DATABASE_SERVICE_NAME
22
24
  }
23
25
  CONNECTION_PARAMS[:host] = DATABASE_HOST if defined?(DATABASE_HOST)
24
26
  CONNECTION_PARAMS[:port] = DATABASE_PORT if defined?(DATABASE_PORT)
metadata CHANGED
@@ -1,86 +1,127 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-plsql-spec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
5
- prerelease:
4
+ version: 0.4.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Raimonds Simanovskis
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-04-16 00:00:00.000000000 Z
11
+ date: 2015-01-30 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rspec
16
- requirement: &2152658840 !ruby/object:Gem::Requirement
17
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
- - - ~>
17
+ - - "<"
18
+ - !ruby/object:Gem::Version
19
+ version: '4.0'
20
+ - - ">="
20
21
  - !ruby/object:Gem::Version
21
22
  version: '2.0'
22
23
  type: :runtime
23
24
  prerelease: false
24
- version_requirements: *2152658840
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "<"
28
+ - !ruby/object:Gem::Version
29
+ version: '4.0'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '2.0'
33
+ - !ruby/object:Gem::Dependency
34
+ name: rspec-support
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "<"
38
+ - !ruby/object:Gem::Version
39
+ version: '4.0'
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: '3.1'
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - "<"
48
+ - !ruby/object:Gem::Version
49
+ version: '4.0'
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: '3.1'
25
53
  - !ruby/object:Gem::Dependency
26
54
  name: thor
27
- requirement: &2152657940 !ruby/object:Gem::Requirement
28
- none: false
55
+ requirement: !ruby/object:Gem::Requirement
29
56
  requirements:
30
- - - ~>
57
+ - - "~>"
31
58
  - !ruby/object:Gem::Version
32
- version: 0.14.2
59
+ version: 0.19.1
33
60
  type: :runtime
34
61
  prerelease: false
35
- version_requirements: *2152657940
62
+ version_requirements: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - "~>"
65
+ - !ruby/object:Gem::Version
66
+ version: 0.19.1
36
67
  - !ruby/object:Gem::Dependency
37
68
  name: ruby-plsql
38
- requirement: &2152653980 !ruby/object:Gem::Requirement
39
- none: false
69
+ requirement: !ruby/object:Gem::Requirement
40
70
  requirements:
41
- - - ~>
71
+ - - "~>"
42
72
  - !ruby/object:Gem::Version
43
73
  version: 0.5.0
44
74
  type: :runtime
45
75
  prerelease: false
46
- version_requirements: *2152653980
76
+ version_requirements: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - "~>"
79
+ - !ruby/object:Gem::Version
80
+ version: 0.5.0
47
81
  - !ruby/object:Gem::Dependency
48
82
  name: nokogiri
49
- requirement: &2152653280 !ruby/object:Gem::Requirement
50
- none: false
83
+ requirement: !ruby/object:Gem::Requirement
51
84
  requirements:
52
- - - ~>
85
+ - - "~>"
53
86
  - !ruby/object:Gem::Version
54
- version: 1.5.0
87
+ version: 1.6.0
55
88
  type: :runtime
56
89
  prerelease: false
57
- version_requirements: *2152653280
90
+ version_requirements: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - "~>"
93
+ - !ruby/object:Gem::Version
94
+ version: 1.6.0
58
95
  - !ruby/object:Gem::Dependency
59
96
  name: jeweler
60
- requirement: &2152652320 !ruby/object:Gem::Requirement
61
- none: false
97
+ requirement: !ruby/object:Gem::Requirement
62
98
  requirements:
63
- - - ~>
99
+ - - "~>"
64
100
  - !ruby/object:Gem::Version
65
- version: 1.8.3
101
+ version: 2.0.1
66
102
  type: :development
67
103
  prerelease: false
68
- version_requirements: *2152652320
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - "~>"
107
+ - !ruby/object:Gem::Version
108
+ version: 2.0.1
69
109
  - !ruby/object:Gem::Dependency
70
110
  name: ruby-oci8
71
- requirement: &2152650640 !ruby/object:Gem::Requirement
72
- none: false
111
+ requirement: !ruby/object:Gem::Requirement
73
112
  requirements:
74
- - - ! '>='
113
+ - - ">="
75
114
  - !ruby/object:Gem::Version
76
115
  version: '0'
77
116
  type: :development
78
117
  prerelease: false
79
- version_requirements: *2152650640
80
- description: ! 'ruby-plsql-spec is Oracle PL/SQL unit testing framework which is built
81
- using Ruby programming language, ruby-plsql library and RSpec testing framework.
82
-
83
- '
118
+ version_requirements: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
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.
84
125
  email: raimonds.simanovskis@gmail.com
85
126
  executables:
86
127
  - plsql-spec
@@ -88,7 +129,7 @@ extensions: []
88
129
  extra_rdoc_files:
89
130
  - README.md
90
131
  files:
91
- - .rspec
132
+ - ".rspec"
92
133
  - Gemfile
93
134
  - History.txt
94
135
  - INSTALL-Windows.md
@@ -135,29 +176,25 @@ files:
135
176
  - spec/spec_helper.rb
136
177
  homepage: http://github.com/rsim/ruby-plsql-spec
137
178
  licenses: []
179
+ metadata: {}
138
180
  post_install_message:
139
181
  rdoc_options: []
140
182
  require_paths:
141
183
  - lib
142
184
  required_ruby_version: !ruby/object:Gem::Requirement
143
- none: false
144
185
  requirements:
145
- - - ! '>='
186
+ - - ">="
146
187
  - !ruby/object:Gem::Version
147
188
  version: '0'
148
- segments:
149
- - 0
150
- hash: -1549635846164205319
151
189
  required_rubygems_version: !ruby/object:Gem::Requirement
152
- none: false
153
190
  requirements:
154
- - - ! '>='
191
+ - - ">="
155
192
  - !ruby/object:Gem::Version
156
193
  version: '0'
157
194
  requirements: []
158
195
  rubyforge_project:
159
- rubygems_version: 1.8.11
196
+ rubygems_version: 2.4.5
160
197
  signing_key:
161
- specification_version: 3
198
+ specification_version: 4
162
199
  summary: Oracle PL/SQL unit testing framework using Ruby and RSpec
163
200
  test_files: []