slacker 1.0.9 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. checksums.yaml +15 -0
  2. data/Gemfile +4 -4
  3. data/README.markdown +22 -22
  4. data/Rakefile +11 -11
  5. data/bin/slacker +28 -29
  6. data/bin/slacker_new +34 -34
  7. data/lib/slacker.rb +175 -175
  8. data/lib/slacker/application.rb +211 -206
  9. data/lib/slacker/command_line_formatter.rb +59 -59
  10. data/lib/slacker/command_line_formatter2.rb +61 -0
  11. data/lib/slacker/configuration.rb +59 -59
  12. data/lib/slacker/formatter.rb +14 -19
  13. data/lib/slacker/query_result_matcher.rb +178 -178
  14. data/lib/slacker/rspec_ext.rb +49 -49
  15. data/lib/slacker/rspec_monkey.rb +7 -7
  16. data/lib/slacker/sql.rb +39 -39
  17. data/lib/slacker/sql_preprocessor.rb +23 -23
  18. data/lib/slacker/string_helper.rb +16 -16
  19. data/lib/slacker/version.rb +3 -3
  20. data/lib/slacker_new/project/data/sample_1/my_table_expected_power_results.csv +11 -11
  21. data/lib/slacker_new/project/data/sample_1/my_table_initial_data.csv +11 -11
  22. data/lib/slacker_new/project/data/sample_1/numbers_expected_output.csv +3 -3
  23. data/lib/slacker_new/project/database.yml +9 -9
  24. data/lib/slacker_new/project/lib/helpers/my_helper.rb +1 -1
  25. data/lib/slacker_new/project/spec/sample_1.rb +66 -66
  26. data/lib/slacker_new/project/sql/sample_1/my_table_on_power.sql.erb +1 -1
  27. data/lib/slacker_new/project/sql/sample_1/play_with_numbers.sql.erb +16 -16
  28. data/lib/slacker_new/project/sql/sample_1/sysobjects_with_params.sql.erb +1 -1
  29. data/slacker.gemspec +27 -26
  30. data/spec/application_spec.rb +13 -13
  31. data/spec/query_result_matcher_spec.rb +268 -268
  32. data/spec/rspec_ext_spec.rb +87 -87
  33. data/spec/slacker_spec.rb +59 -59
  34. data/spec/spec_helper.rb +9 -9
  35. data/spec/test_files/matcher/test_1.csv +3 -3
  36. data/spec/test_files/test_slacker_project/data/test_1.csv +3 -3
  37. data/spec/test_files/test_slacker_project/sql/nest/nested_1.sql.erb +1 -1
  38. data/spec/test_files/test_slacker_project/sql/no_params.sql.erb +2 -2
  39. data/spec/test_files/test_slacker_project/sql/params.sql.erb +1 -1
  40. metadata +19 -20
@@ -1,88 +1,88 @@
1
- require 'slacker'
2
- require 'spec_helper'
3
- require 'ostruct'
4
-
5
- class RSpecSlackerHost
6
- include Slacker::RSpecExt
7
- end
8
-
9
- describe Slacker::RSpecExt do
10
- before(:each) do
11
- Slacker::configure do |config|
12
- config.base_dir = SpecHelper.expand_test_files_path('test_slacker_project')
13
- end
14
-
15
- example = OpenStruct.new
16
- example.metadata = {:sql => '', :example_group => {:file_path => SpecHelper.expand_test_files_path('test_slacker_project/spec/example_xyz.rb')}}
17
-
18
- @instance = RSpecSlackerHost.new
19
- @instance.stub(:example).and_return(example)
20
- end
21
-
22
- it 'responds to query' do
23
- @instance.should respond_to(:query)
24
- end
25
-
26
- it 'responds to match' do
27
- @instance.should respond_to(:match)
28
- end
29
-
30
- it 'responds to csv' do
31
- @instance.should respond_to(:csv)
32
- end
33
-
34
- it 'responds to load_csv' do
35
- @instance.should respond_to(:load_csv)
36
- end
37
-
38
- it 'responds to load_csv' do
39
- @instance.should respond_to(:touch_csv)
40
- end
41
-
42
- it 'responds to sql' do
43
- @instance.should respond_to(:sql)
44
- end
45
-
46
- context 'responds to ghost methods' do
47
- before(:each) do
48
- Slacker.application.stub(:query_script) {|sql| sql}
49
- end
50
-
51
- specify 'described as SQL files found in the sql/helpers folder' do
52
- @instance.sql.respond_to?(:helpers).should be_true
53
- @instance.sql.helpers.respond_to?(:helper_1).should be_true
54
- @instance.sql.helpers.helper_1.should == 'helpers/helper_1.sql called'
55
- end
56
-
57
- specify 'described as SQL.ERB files found in the sql/helpers folder' do
58
- @instance.sql.helpers.respond_to?(:helper_2).should be_true
59
- @instance.sql.helpers.helper_2.should == 'helpers/helper_2.sql.erb called'
60
- end
61
-
62
- specify 'with SQL files taking priority over SQL.ERB files' do
63
- @instance.sql.helpers.respond_to?(:helper_3).should be_true
64
- @instance.sql.helpers.helper_3.should == 'helpers/helper_3.sql called'
65
- end
66
-
67
- specify 'but ignores non-existing methods' do
68
- @instance.sql.helpers.respond_to?(:some_bogus_method).should be_false
69
- end
70
-
71
- specify 'but ignores files which are not with SQL or SQL.ERB extension' do
72
- @instance.sql.helpers.respond_to?(:text_file_1).should be_false
73
- end
74
-
75
- specify 'from folders other than helpers' do
76
- @instance.sql.respond_to?(:example_1).should be_true
77
- @instance.sql.example_1.respond_to?(:helper_1).should be_true
78
- @instance.sql.example_1.helper_1.should == 'example_1/helper_1.sql called'
79
- end
80
-
81
- specify "works with deeply nested example files reflecting their location in the lookup of SQL files in the SQL folder" do
82
- @instance.sql.respond_to?(:nest).should be_true
83
- @instance.sql.nest.respond_to?(:example_1).should be_true
84
- @instance.sql.nest.example_1.respond_to?(:helper_1).should be_true
85
- @instance.sql.nest.example_1.helper_1.should == 'nest/example_1/helper_1.sql.erb called'
86
- end
87
- end
1
+ require 'slacker'
2
+ require 'spec_helper'
3
+ require 'ostruct'
4
+
5
+ class RSpecSlackerHost
6
+ include Slacker::RSpecExt
7
+ end
8
+
9
+ describe Slacker::RSpecExt do
10
+ before(:each) do
11
+ Slacker::configure do |config|
12
+ config.base_dir = SpecHelper.expand_test_files_path('test_slacker_project')
13
+ end
14
+
15
+ example = OpenStruct.new
16
+ example.metadata = {:sql => '', :example_group => {:file_path => SpecHelper.expand_test_files_path('test_slacker_project/spec/example_xyz.rb')}}
17
+
18
+ @instance = RSpecSlackerHost.new
19
+ @instance.stub(:example).and_return(example)
20
+ end
21
+
22
+ it 'responds to query' do
23
+ @instance.should respond_to(:query)
24
+ end
25
+
26
+ it 'responds to match' do
27
+ @instance.should respond_to(:match)
28
+ end
29
+
30
+ it 'responds to csv' do
31
+ @instance.should respond_to(:csv)
32
+ end
33
+
34
+ it 'responds to load_csv' do
35
+ @instance.should respond_to(:load_csv)
36
+ end
37
+
38
+ it 'responds to load_csv' do
39
+ @instance.should respond_to(:touch_csv)
40
+ end
41
+
42
+ it 'responds to sql' do
43
+ @instance.should respond_to(:sql)
44
+ end
45
+
46
+ context 'responds to ghost methods' do
47
+ before(:each) do
48
+ Slacker.application.stub(:query_script) {|sql| sql}
49
+ end
50
+
51
+ specify 'described as SQL files found in the sql/helpers folder' do
52
+ @instance.sql.respond_to?(:helpers).should be_true
53
+ @instance.sql.helpers.respond_to?(:helper_1).should be_true
54
+ @instance.sql.helpers.helper_1.should == 'helpers/helper_1.sql called'
55
+ end
56
+
57
+ specify 'described as SQL.ERB files found in the sql/helpers folder' do
58
+ @instance.sql.helpers.respond_to?(:helper_2).should be_true
59
+ @instance.sql.helpers.helper_2.should == 'helpers/helper_2.sql.erb called'
60
+ end
61
+
62
+ specify 'with SQL files taking priority over SQL.ERB files' do
63
+ @instance.sql.helpers.respond_to?(:helper_3).should be_true
64
+ @instance.sql.helpers.helper_3.should == 'helpers/helper_3.sql called'
65
+ end
66
+
67
+ specify 'but ignores non-existing methods' do
68
+ @instance.sql.helpers.respond_to?(:some_bogus_method).should be_false
69
+ end
70
+
71
+ specify 'but ignores files which are not with SQL or SQL.ERB extension' do
72
+ @instance.sql.helpers.respond_to?(:text_file_1).should be_false
73
+ end
74
+
75
+ specify 'from folders other than helpers' do
76
+ @instance.sql.respond_to?(:example_1).should be_true
77
+ @instance.sql.example_1.respond_to?(:helper_1).should be_true
78
+ @instance.sql.example_1.helper_1.should == 'example_1/helper_1.sql called'
79
+ end
80
+
81
+ specify "works with deeply nested example files reflecting their location in the lookup of SQL files in the SQL folder" do
82
+ @instance.sql.respond_to?(:nest).should be_true
83
+ @instance.sql.nest.respond_to?(:example_1).should be_true
84
+ @instance.sql.nest.example_1.respond_to?(:helper_1).should be_true
85
+ @instance.sql.nest.example_1.helper_1.should == 'nest/example_1/helper_1.sql.erb called'
86
+ end
87
+ end
88
88
  end
@@ -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
@@ -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,3 +1,3 @@
1
- "Field 1","Field_2","b"
2
- 12,,""
3
- "test string",01/30/2011,8.9
1
+ "Field 1","Field_2","b"
2
+ 12,,""
3
+ "test string",01/30/2011,8.9
@@ -1,3 +1,3 @@
1
- "Field 1","Field_2","b"
2
- 12,10,11
3
- "test string",01/01/2011,8.9
1
+ "Field 1","Field_2","b"
2
+ 12,10,11
3
+ "test string",01/01/2011,8.9
@@ -1,2 +1,2 @@
1
- seed <%= options[:seed] %>;
1
+ seed <%= options[:seed] %>;
2
2
  <%= render 'nested_2.sql.erb', {:seed => options[:seed] + 1}%>
@@ -1,3 +1,3 @@
1
- <%2.times do |i|%>
2
- select <%=i+1%>;
1
+ <%2.times do |i|%>
2
+ select <%=i+1%>;
3
3
  <%end%>
@@ -1,2 +1,2 @@
1
- select <%= options[:param1] %>;
1
+ select <%= options[:param1] %>;
2
2
  select <%= options[:param2] %>;
metadata CHANGED
@@ -1,36 +1,38 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slacker
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.9
5
- prerelease:
4
+ version: 1.0.10
6
5
  platform: ruby
7
6
  authors:
8
7
  - Vassil Kovatchev
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-06-12 00:00:00.000000000 Z
11
+ date: 2015-11-03 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: bundler
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ - - ! '>='
20
21
  - !ruby/object:Gem::Version
21
22
  version: 1.0.15
22
23
  type: :runtime
23
24
  prerelease: false
24
25
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
26
  requirements:
27
27
  - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.0'
30
+ - - ! '>='
28
31
  - !ruby/object:Gem::Version
29
32
  version: 1.0.15
30
33
  - !ruby/object:Gem::Dependency
31
34
  name: ruby-odbc
32
35
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
36
  requirements:
35
37
  - - '='
36
38
  - !ruby/object:Gem::Version
@@ -38,7 +40,6 @@ dependencies:
38
40
  type: :runtime
39
41
  prerelease: false
40
42
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
43
  requirements:
43
44
  - - '='
44
45
  - !ruby/object:Gem::Version
@@ -46,19 +47,17 @@ dependencies:
46
47
  - !ruby/object:Gem::Dependency
47
48
  name: rspec
48
49
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
50
  requirements:
51
51
  - - ~>
52
52
  - !ruby/object:Gem::Version
53
- version: 2.10.0
53
+ version: '3.0'
54
54
  type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
57
  requirements:
59
58
  - - ~>
60
59
  - !ruby/object:Gem::Version
61
- version: 2.10.0
60
+ version: '3.0'
62
61
  description: RSpec-based framework for developing automated tests for SQL Server
63
62
  email:
64
63
  - vassil.kovatchev@gmail.com
@@ -68,14 +67,15 @@ executables:
68
67
  extensions: []
69
68
  extra_rdoc_files: []
70
69
  files:
70
+ - Gemfile
71
71
  - README.markdown
72
72
  - Rakefile
73
- - Gemfile
74
- - slacker.gemspec
75
73
  - bin/slacker
76
74
  - bin/slacker_new
75
+ - lib/slacker.rb
77
76
  - lib/slacker/application.rb
78
77
  - lib/slacker/command_line_formatter.rb
78
+ - lib/slacker/command_line_formatter2.rb
79
79
  - lib/slacker/configuration.rb
80
80
  - lib/slacker/formatter.rb
81
81
  - lib/slacker/query_result_matcher.rb
@@ -85,7 +85,6 @@ files:
85
85
  - lib/slacker/sql_preprocessor.rb
86
86
  - lib/slacker/string_helper.rb
87
87
  - lib/slacker/version.rb
88
- - lib/slacker.rb
89
88
  - lib/slacker_new/project/data/sample_1/my_table_expected_power_results.csv
90
89
  - lib/slacker_new/project/data/sample_1/my_table_initial_data.csv
91
90
  - lib/slacker_new/project/data/sample_1/numbers_expected_output.csv
@@ -99,6 +98,7 @@ files:
99
98
  - lib/slacker_new/project/sql/sample_1/play_with_numbers.sql.erb
100
99
  - lib/slacker_new/project/sql/sample_1/sysobjects.sql.erb
101
100
  - lib/slacker_new/project/sql/sample_1/sysobjects_with_params.sql.erb
101
+ - slacker.gemspec
102
102
  - spec/application_spec.rb
103
103
  - spec/query_result_matcher_spec.rb
104
104
  - spec/rspec_ext_spec.rb
@@ -126,28 +126,28 @@ files:
126
126
  - spec/test_files/test_slacker_project/sql/params.sql.erb
127
127
  - spec/test_files/test_slacker_project/sql/test_1.sql
128
128
  homepage: https://github.com/vassilvk/slacker/wiki
129
- licenses: []
129
+ licenses:
130
+ - MIT
131
+ metadata: {}
130
132
  post_install_message:
131
133
  rdoc_options: []
132
134
  require_paths:
133
135
  - lib
134
136
  required_ruby_version: !ruby/object:Gem::Requirement
135
- none: false
136
137
  requirements:
137
138
  - - ! '>='
138
139
  - !ruby/object:Gem::Version
139
140
  version: 1.9.2
140
141
  required_rubygems_version: !ruby/object:Gem::Requirement
141
- none: false
142
142
  requirements:
143
143
  - - ! '>='
144
144
  - !ruby/object:Gem::Version
145
145
  version: '0'
146
146
  requirements: []
147
147
  rubyforge_project: slacker
148
- rubygems_version: 1.8.24
148
+ rubygems_version: 2.4.8
149
149
  signing_key:
150
- specification_version: 3
150
+ specification_version: 4
151
151
  summary: Behavior Driven Development for SQL Server
152
152
  test_files:
153
153
  - spec/application_spec.rb
@@ -176,4 +176,3 @@ test_files:
176
176
  - spec/test_files/test_slacker_project/sql/no_params.sql.erb
177
177
  - spec/test_files/test_slacker_project/sql/params.sql.erb
178
178
  - spec/test_files/test_slacker_project/sql/test_1.sql
179
- has_rdoc: