slacker 1.0.2 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- slacker (1.0.2)
4
+ slacker (1.0.4)
5
5
  bundler (~> 1.0.15)
6
6
  rspec (~> 2.5.0)
7
7
  ruby-odbc (= 0.99994)
data/README.markdown CHANGED
@@ -1,44 +1,8 @@
1
1
  # Slacker
2
- Behavior Driven Development for SQL Server
3
-
4
- # Description
5
- Slacker is a Ruby (RSpec-based) framework for developing automated tests for SQL Server programmable objects such as stored procedures and scalar/table functions.
6
-
7
- # Installation
8
- gem install slacker
9
-
10
- ### Requirements
11
-
12
- * Ruby 1.9.2.
13
-
14
- Runs on Windows and Linux.
15
-
16
- _Note_: Before installing on Windows, you need to install the [Ruby Windows Development Kit](https://github.com/oneclick/rubyinstaller/wiki/Development-Kit).
17
-
18
- # Quick Start
19
- To create a new Slacker project, run the following command:
20
-
21
- slacker_new my_project
22
2
 
23
- This will create a new project directory `my_project`.
24
-
25
- Navigate to the new project directory and modify file `database.yml` to tell Slacker which database to connect to.
26
-
27
- Run Slacker:
28
-
29
- slacker
30
-
31
- If all is good, you should see something like this:
32
-
33
- my_database (my_server)
34
- .....
35
-
36
- Finished in 0.05222 seconds
37
- 5 examples, 0 failures
38
-
39
- Next, check out sample file `my_project\spec\sample_1.rb` to see the BDD specification you just executed.
3
+ Behavior Driven Development for SQL Server
40
4
 
41
- Also take a look at the SQL files generated in folder `my_project\debug\passed_examples`. Those are the actual SQL scripts Slacker generated and executed against your database.
5
+ Slacker is a transacted RSpec-based framework for developing automated tests for SQL Server 2005 and 2008 programmable objects such as stored procedures, scalar/table functions, triggers, etc.
42
6
 
43
7
  # Resources
44
8
 
@@ -55,4 +19,4 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
55
19
 
56
20
  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
57
21
 
58
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,3 +1,3 @@
1
1
  module Slacker
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.4"
3
3
  end
@@ -1,52 +1,41 @@
1
- # Method describe opens up an example group.
1
+ # Method "describe" opens up an example group.
2
2
  describe 'My database' do
3
- # Simple example which demonstrates inline query against the database.
3
+ # Simple inline query example.
4
4
  it 'contains system tables' do
5
- # Select all system objects in the database.
6
- # We should have at least one of those.
5
+ # Make sure we have at least one system object in the database.
7
6
  query("select * from sysobjects where xtype = 'S';").count.should > 0
8
7
  end
9
8
 
10
- # The same query, this time using a SQL template.
11
- # See file sql/sample_1/sysobject.sql.erb
9
+ # The same query, this time using a SQL template stored in file "sql/sample_1/sysobject.sql.erb".
12
10
  it 'contains system tables (take two)' do
13
- # SQL templates are located in the sql folder and are accessible through the "sql" object (see below).
14
- # Each sub-folder of the sql folder appears as a sql object contained within its parent startint at the root - the "sql" object.
15
- # Each template file (*.sql.erb) appears as a method of the folder it appears in.
16
- #
17
- # For example, the file sysobjects.sql.erb is located in "sql/sample_1/",
18
- # so it is accessible like this:
19
- # sql.sample_1.sysobjects
11
+ # Every (*.sql.erb) file in folder "sql" can be called as a method on object "sql".
12
+ # Subfolders of folder "sql" appear as children of object "sql" with their (*.sql.erb) files automatically available as methods.
20
13
  sql.sample_1.sysobjects.count.should > 0
21
14
  end
22
15
 
23
16
  # This time we'll use a parameterized template.
24
- # See file sql/sample_1/sysobject_with_params.sql.erb
25
17
  it 'contains system tables (take three)' do
26
- # You can pass a hash to any SQL template - this hash becomes available to the
27
- # template through the "options" object - see file sql/sample_1/sysobject_with_params.sql.erb as an example.
18
+ # Every template can accept parameters; see file "sql/sample_1/sysobject_with_params.sql.erb".
28
19
  sql.sample_1.sysobjects_with_params(:xtype => 'S').count.should > 0
29
20
  end
30
21
 
31
22
  # SQL Templates can contain multiple statements and can return multiple resultsets.
32
23
  it 'can play with numbers' do
33
- # Note that this time we're calling the template with a block.
34
- # When called with a block, a template is executed and its results are accessible
35
- # from within the block through the "results" object.
24
+ # Note that this time we're calling the template with a block which receives the results as a block parameter.
36
25
  sql.sample_1.play_with_numbers(:x => 2, :y => 12) do |results|
37
26
  # The results object contains an array of all the resultsets generated by the query script.
38
- # A resultset contains an array of records.
39
- # Each record is a hash of field => value pairs.
27
+ # A resultset contains an array of records. Each record is a hash of field => value pairs.
28
+
29
+ # First resultset; First record; Column "product".
40
30
  results[0][0][:product].should == 24
41
31
 
42
- # A resultset can be matched directly against an array of hashes using the "match" method.
32
+ # A resultset can be matched directly against an array of hashes using method "match".
43
33
  results[1].should match([{:x => 2, :y => 12, :sum => 14}])
44
34
 
45
- # Or against a CSV file stored in the data folder (see file data/sample_1/numbers_expected_output.csv)
35
+ # Or against a CSV file stored in project's "data" folder (see file "data/sample_1/numbers_expected_output.csv").
46
36
  results[2].should match('sample_1/numbers_expected_output.csv')
47
37
 
48
- # Or a resultset's values can be matched one-by-one.
49
- # Note that the third resultset contains two records:
38
+ # A resultset's values can be matched one-by-one.
50
39
  results[2][0][:p].should == 2
51
40
  results[2][0][:s].should == 34
52
41
  results[2][1][:p].should == 12
@@ -54,27 +43,24 @@ describe 'My database' do
54
43
  end
55
44
  end
56
45
 
57
- # Every "it" (example) is executed in a transaction which is rolled back once the example is complete.
58
- # This ensures that every example starts at the same state of the database as any other example in the spec.
59
- # No example can ever interfere witht the results of another example.
46
+ # Every "it" (example) is executed in a T-SQL transaction which is rolled back once the example is complete.
47
+ # No example can ever interfere with the results of another example.
60
48
  #
61
49
  # CSV files can be used to load data directly into a table.
62
50
  # In this example, we will create a table, populate it with data,
63
51
  # calculate the exponentiation of one column based on another column
64
52
  # and verify the results against an expected resultset stored in a CSV file.
65
- it 'can play with numbers (take three)' do
66
- # Create the table - see file sql/sample_1/create_my_table.sql.erb
53
+ it 'can play with numbers (take two)' do
54
+ # Create the table - see file "sql/sample_1/create_my_table.sql.erb".
67
55
  sql.sample_1.create_my_table
68
- # We can populate any table by calling method "load_csv".
69
- # As a first parameter we will pass the name of the CSV file which contains the source data;
70
- # The file name is relative to the data folder - see file data/sample_1/my_table_initial_data.csv.
71
- # The name of the destination table goes into the second parameter.
72
- load_csv 'sample_1/my_table_initial_data.csv', 'MyTable'
56
+ # We can populate any table with data from the "data" folder by calling method "load_csv".
57
+ # See file "data/sample_1/my_table_initial_data.csv".
58
+ load_csv('sample_1/my_table_initial_data.csv', 'MyTable')
73
59
 
74
60
  # Now let's test the system scalar function Power.
75
61
  # We will use it in a query expression executed agaings MyTable and we
76
62
  # will compare the results against a CSV file - we should expect them to match.
77
- # See files "sql/sample_1/my_table_on_power.sql.erb" and "data/sample_1/my_table_expected_power_results.csv"
63
+ # See files "sql/sample_1/my_table_on_power.sql.erb" and "data/sample_1/my_table_expected_power_results.csv".
78
64
  sql.sample_1.my_table_on_power.should match('sample_1/my_table_expected_power_results.csv')
79
65
  end
80
66
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: slacker
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.0.2
5
+ version: 1.0.4
6
6
  platform: ruby
7
7
  authors:
8
8
  - Vassil Kovatchev
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-07-01 00:00:00 Z
13
+ date: 2011-07-03 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler