slacker 1.0.7 → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +4 -4
- data/README.markdown +22 -22
- data/Rakefile +11 -11
- data/lib/slacker.rb +175 -175
- data/lib/slacker/application.rb +206 -206
- data/lib/slacker/command_line_formatter.rb +59 -59
- data/lib/slacker/configuration.rb +59 -59
- data/lib/slacker/formatter.rb +19 -19
- data/lib/slacker/query_result_matcher.rb +178 -178
- data/lib/slacker/rspec_ext.rb +49 -49
- data/lib/slacker/rspec_monkey.rb +6 -6
- data/lib/slacker/sql.rb +39 -39
- data/lib/slacker/string_helper.rb +16 -16
- data/lib/slacker/version.rb +1 -1
- data/lib/slacker_new/project/debug/failed_examples/example_001.sql +0 -0
- data/lib/slacker_new/project/debug/passed_examples/example_001.sql +0 -0
- data/lib/slacker_new/project/sql/sample_1/my_table_on_power.sql.erb +1 -1
- data/lib/slacker_new/project/sql/sample_1/play_with_numbers.sql.erb +16 -16
- data/slacker.gemspec +3 -3
- data/spec/application_spec.rb +13 -13
- data/spec/query_result_matcher_spec.rb +268 -268
- data/spec/slacker_spec.rb +59 -59
- data/spec/spec_helper.rb +9 -9
- data/spec/test_files/test_slacker_project/sql/nest/nested_1.sql.erb +1 -1
- data/spec/test_files/test_slacker_project/sql/params.sql.erb +1 -1
- metadata +8 -7
- data/Gemfile.lock +0 -28
data/spec/slacker_spec.rb
CHANGED
@@ -1,60 +1,60 @@
|
|
1
|
-
require 'slacker'
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
describe Slacker do
|
5
|
-
it 'exposes a singleton application object' do
|
6
|
-
app = Slacker::application
|
7
|
-
app.should equal(Slacker::application)
|
8
|
-
end
|
9
|
-
|
10
|
-
it 'and it''s base folder can be configured through a call to configure' do
|
11
|
-
Slacker.configure do |config|
|
12
|
-
config.base_dir = 'xyz'
|
13
|
-
end
|
14
|
-
|
15
|
-
Slacker.configuration.base_dir.should == 'xyz'
|
16
|
-
end
|
17
|
-
|
18
|
-
it 'converts a hash array to csv' do
|
19
|
-
csv = Slacker.hash_array_to_csv [{'a' => 1, 'b' => 2}, {'a' => 3, 'b' => 4}]
|
20
|
-
csv.to_csv.should == "a,b\n1,2\n3,4\n"
|
21
|
-
end
|
22
|
-
|
23
|
-
context 'provides SQL resolution' do
|
24
|
-
before(:each) do
|
25
|
-
Slacker.configure do |config|
|
26
|
-
config.base_dir = SpecHelper.expand_test_files_path('test_slacker_project')
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
specify 'which resolves to a SQL string when a non-file is sent to it' do
|
31
|
-
Slacker.sql_from_query_string("select 'abc' as xyz").should == "select 'abc' as xyz"
|
32
|
-
end
|
33
|
-
|
34
|
-
specify 'which resolves to the correct contents of a SQL file' do
|
35
|
-
Slacker.sql_from_query_string("test_1.sql").should == "select 1;"
|
36
|
-
end
|
37
|
-
|
38
|
-
context 'of an ERB file' do
|
39
|
-
specify 'with no params' do
|
40
|
-
Slacker.sql_from_query_string("no_params.sql.erb").should == "select 1;\nselect 2;\n"
|
41
|
-
end
|
42
|
-
|
43
|
-
specify 'with params' do
|
44
|
-
Slacker.sql_from_query_string("params.sql.erb", {:param1 => 11, :param2 => 12}).should == "select 11;\nselect 12;"
|
45
|
-
end
|
46
|
-
|
47
|
-
specify 'which calls another ERB file with no params' do
|
48
|
-
Slacker.sql_from_query_string("nested.sql.erb").should == "select 1;\nselect 2;\n"
|
49
|
-
end
|
50
|
-
|
51
|
-
specify 'which calls another ERB file with params' do
|
52
|
-
Slacker.sql_from_query_string("nested_with_params.sql.erb", {:param1 => 21, :param2 => 22}).should == "select 21;\nselect 22;"
|
53
|
-
end
|
54
|
-
|
55
|
-
specify 'which calls complex multi-nested file' do
|
56
|
-
Slacker.sql_from_query_string("multi_nested.sql.erb", {:seed => 1}).should == "seed 1;\nselect 3;\nselect 4;"
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
1
|
+
require 'slacker'
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe Slacker do
|
5
|
+
it 'exposes a singleton application object' do
|
6
|
+
app = Slacker::application
|
7
|
+
app.should equal(Slacker::application)
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'and it''s base folder can be configured through a call to configure' do
|
11
|
+
Slacker.configure do |config|
|
12
|
+
config.base_dir = 'xyz'
|
13
|
+
end
|
14
|
+
|
15
|
+
Slacker.configuration.base_dir.should == 'xyz'
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'converts a hash array to csv' do
|
19
|
+
csv = Slacker.hash_array_to_csv [{'a' => 1, 'b' => 2}, {'a' => 3, 'b' => 4}]
|
20
|
+
csv.to_csv.should == "a,b\n1,2\n3,4\n"
|
21
|
+
end
|
22
|
+
|
23
|
+
context 'provides SQL resolution' do
|
24
|
+
before(:each) do
|
25
|
+
Slacker.configure do |config|
|
26
|
+
config.base_dir = SpecHelper.expand_test_files_path('test_slacker_project')
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
specify 'which resolves to a SQL string when a non-file is sent to it' do
|
31
|
+
Slacker.sql_from_query_string("select 'abc' as xyz").should == "select 'abc' as xyz"
|
32
|
+
end
|
33
|
+
|
34
|
+
specify 'which resolves to the correct contents of a SQL file' do
|
35
|
+
Slacker.sql_from_query_string("test_1.sql").should == "select 1;"
|
36
|
+
end
|
37
|
+
|
38
|
+
context 'of an ERB file' do
|
39
|
+
specify 'with no params' do
|
40
|
+
Slacker.sql_from_query_string("no_params.sql.erb").should == "select 1;\nselect 2;\n"
|
41
|
+
end
|
42
|
+
|
43
|
+
specify 'with params' do
|
44
|
+
Slacker.sql_from_query_string("params.sql.erb", {:param1 => 11, :param2 => 12}).should == "select 11;\nselect 12;"
|
45
|
+
end
|
46
|
+
|
47
|
+
specify 'which calls another ERB file with no params' do
|
48
|
+
Slacker.sql_from_query_string("nested.sql.erb").should == "select 1;\nselect 2;\n"
|
49
|
+
end
|
50
|
+
|
51
|
+
specify 'which calls another ERB file with params' do
|
52
|
+
Slacker.sql_from_query_string("nested_with_params.sql.erb", {:param1 => 21, :param2 => 22}).should == "select 21;\nselect 22;"
|
53
|
+
end
|
54
|
+
|
55
|
+
specify 'which calls complex multi-nested file' do
|
56
|
+
Slacker.sql_from_query_string("multi_nested.sql.erb", {:seed => 1}).should == "seed 1;\nselect 3;\nselect 4;"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
60
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
module SpecHelper
|
2
|
-
def self.expand_test_files_path(path)
|
3
|
-
File.expand_path("#{File.dirname(__FILE__)}/test_files/#{path}")
|
4
|
-
end
|
5
|
-
|
6
|
-
def self.load_csv(file)
|
7
|
-
CSV.read(expand_test_files_path(file), {:headers => true, :encoding => 'Windows-1252'})
|
8
|
-
end
|
9
|
-
end
|
1
|
+
module SpecHelper
|
2
|
+
def self.expand_test_files_path(path)
|
3
|
+
File.expand_path("#{File.dirname(__FILE__)}/test_files/#{path}")
|
4
|
+
end
|
5
|
+
|
6
|
+
def self.load_csv(file)
|
7
|
+
CSV.read(expand_test_files_path(file), {:headers => true, :encoding => 'Windows-1252'})
|
8
|
+
end
|
9
|
+
end
|
@@ -1,2 +1,2 @@
|
|
1
|
-
seed <%= options[:seed] %>;
|
1
|
+
seed <%= options[:seed] %>;
|
2
2
|
<%= render 'nested_2.sql.erb', {:seed => options[:seed] + 1}%>
|
@@ -1,2 +1,2 @@
|
|
1
|
-
select <%= options[:param1] %>;
|
1
|
+
select <%= options[:param1] %>;
|
2
2
|
select <%= options[:param2] %>;
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slacker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,14 +9,14 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-06-
|
12
|
+
date: 2012-06-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
21
|
version: 1.0.15
|
22
22
|
type: :runtime
|
@@ -24,7 +24,7 @@ dependencies:
|
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
none: false
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: 1.0.15
|
30
30
|
- !ruby/object:Gem::Dependency
|
@@ -48,7 +48,7 @@ dependencies:
|
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
49
49
|
none: false
|
50
50
|
requirements:
|
51
|
-
- -
|
51
|
+
- - ! '>='
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: 2.5.0
|
54
54
|
type: :runtime
|
@@ -56,7 +56,7 @@ dependencies:
|
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
none: false
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 2.5.0
|
62
62
|
description: RSpec-based framework for developing automated tests for SQL Server
|
@@ -72,7 +72,6 @@ files:
|
|
72
72
|
- Rakefile
|
73
73
|
- Gemfile
|
74
74
|
- slacker.gemspec
|
75
|
-
- Gemfile.lock
|
76
75
|
- bin/slacker
|
77
76
|
- bin/slacker_new
|
78
77
|
- lib/slacker/application.rb
|
@@ -91,6 +90,8 @@ files:
|
|
91
90
|
- lib/slacker_new/project/data/sample_1/my_table_initial_data.csv
|
92
91
|
- lib/slacker_new/project/data/sample_1/numbers_expected_output.csv
|
93
92
|
- lib/slacker_new/project/database.yml
|
93
|
+
- lib/slacker_new/project/debug/failed_examples/example_001.sql
|
94
|
+
- lib/slacker_new/project/debug/passed_examples/example_001.sql
|
94
95
|
- lib/slacker_new/project/lib/helpers/my_helper.rb
|
95
96
|
- lib/slacker_new/project/spec/sample_1.rb
|
96
97
|
- lib/slacker_new/project/sql/sample_1/create_my_table.sql.erb
|
data/Gemfile.lock
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
slacker (1.0.7)
|
5
|
-
bundler (~> 1.0.15)
|
6
|
-
rspec (~> 2.5.0)
|
7
|
-
ruby-odbc (= 0.99994)
|
8
|
-
|
9
|
-
GEM
|
10
|
-
remote: http://rubygems.org/
|
11
|
-
specs:
|
12
|
-
diff-lcs (1.1.3)
|
13
|
-
rspec (2.5.0)
|
14
|
-
rspec-core (~> 2.5.0)
|
15
|
-
rspec-expectations (~> 2.5.0)
|
16
|
-
rspec-mocks (~> 2.5.0)
|
17
|
-
rspec-core (2.5.2)
|
18
|
-
rspec-expectations (2.5.0)
|
19
|
-
diff-lcs (~> 1.1.2)
|
20
|
-
rspec-mocks (2.5.0)
|
21
|
-
ruby-odbc (0.99994)
|
22
|
-
|
23
|
-
PLATFORMS
|
24
|
-
ruby
|
25
|
-
x86-mingw32
|
26
|
-
|
27
|
-
DEPENDENCIES
|
28
|
-
slacker!
|