slacker 0.0.8 → 0.0.9

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.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- slacker (0.0.7)
4
+ slacker (0.0.9)
5
5
  bundler (~> 1.0.15)
6
6
  rspec (= 2.5.0)
7
7
  ruby-odbc (= 0.99994)
data/README.markdown CHANGED
@@ -38,6 +38,18 @@ If all is good, you should see something like this:
38
38
 
39
39
  Next, check out sample file `my_project\spec\sample_1.rb` to see the BDD specification you just executed.
40
40
 
41
+ Also take a look at the SQL files generated in folder `my_project\debug\passed_examples`. Those are the actual scripts __Slacker__ generated and executed against your database.
42
+
43
+ Pop any of these scripts into SQL Server Management Studio and run to see the actual results received by __Slacker__.
44
+
45
+ Note that all the scripts are executed in their own transaction which is rolled back at the end.
46
+
47
+ This ensures that:
48
+
49
+ 1. When __Slacker__ finishes its run, it leaves the database in the same exact state as it found it.
50
+
51
+ 2. All examples (see `sample_1.rb`) are executed in isolation from each other. No example can interfere with the results of any of the other examples.
52
+
41
53
  # Documentation TODO
42
54
 
43
55
  Document the following features:
@@ -1,3 +1,3 @@
1
1
  module Slacker
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
@@ -0,0 +1,11 @@
1
+ "x","y","power"
2
+ "2","1","2"
3
+ "3","2","9"
4
+ "4","3","64"
5
+ "5","4","625"
6
+ "4","2","16"
7
+ "3","3","27"
8
+ "2","4","16"
9
+ "1","5","1"
10
+ "-1","2","1"
11
+ "-2","5","-32"
@@ -0,0 +1,11 @@
1
+ "x","y"
2
+ 2,1
3
+ 3,2
4
+ 4,3
5
+ 5,4
6
+ 4,2
7
+ 3,3
8
+ 2,4
9
+ 1,5
10
+ -1,2
11
+ -2,5
@@ -0,0 +1,3 @@
1
+ "p","s"
2
+ "10","42"
3
+ "34","66"
@@ -1,8 +1,8 @@
1
- # Database connection
2
- # When Slacker is executed, it will attempt to connect to this database
1
+ # Database connection.
2
+ # When Slacker is executed, it will attempt to connect to this database.
3
3
 
4
- # Replace the following with your connection information
5
- # Note that at this point Slacker only works with SQL Server authentication
4
+ # Replace the following with your connection information.
5
+ # Note that at this point Slacker only works with SQL Server authentication.
6
6
  server: my_server
7
7
  database: my_database
8
8
  user: user_name
@@ -75,4 +75,32 @@ describe 'My database' do
75
75
  third_resultset[1][:s].should == 44
76
76
  end
77
77
  end
78
+
79
+ # The results of a query can also be compared against the contents
80
+ # of a CSV file located in the data folder - see file data/sample_1/numbers_expected_output.csv
81
+ it 'can play with numbers (take two)' do
82
+ sql.sample_1.play_with_numbers(:x => 10, :y => 34) do
83
+ results[2].should match('sample_1/numbers_expected_output.csv')
84
+ end
85
+ end
86
+
87
+ # CSV files can be used to load data directly into a table.
88
+ # In this example, we will create a table, populate it with data,
89
+ # execute standard deviation calculation and verify the results against
90
+ # an expected result stored in a CSV file.
91
+ it 'can play with numbers (take three)' do
92
+ # Create the table - see file sql/sample_1/create_my_table.sql.erb
93
+ sql.sample_1.create_my_table
94
+ # We can populate any table by calling method "load_csv".
95
+ # As a first parameter we will pass the name of the CSV file which contains the source data;
96
+ # The file name is relative to the data folder - see file data/sample_1/my_table_initial_data.csv.
97
+ # The name of the destination table goes into the second parameter.
98
+ load_csv 'sample_1/my_table_initial_data.csv', 'MyTable'
99
+
100
+ # Now let's test the system scalar function Power.
101
+ # We will use it in a query expression executed agaings MyTable and we
102
+ # will compare the results against a CSV file - we should expect them to match.
103
+ # See files "sql/sample_1/my_table_on_power.sql.erb" and "data/sample_1/my_table_expected_power_results.csv"
104
+ sql.sample_1.my_table_on_power.should match('sample_1/my_table_expected_power_results.csv')
105
+ end
78
106
  end
@@ -0,0 +1 @@
1
+ create table MyTable(x int, y int);
@@ -0,0 +1,2 @@
1
+ select x, y, convert(int, Power(x, y)) as [power]
2
+ from MyTable;
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: slacker
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.8
5
+ version: 0.0.9
6
6
  platform: ruby
7
7
  authors:
8
8
  - Vassil Kovatchev
@@ -75,12 +75,16 @@ files:
75
75
  - lib/slacker/application.rb
76
76
  - lib/slacker.rb
77
77
  - lib/slacker_new/project/lib/helpers/my_helper.rb
78
- - lib/slacker_new/project/data/my_table.csv
78
+ - lib/slacker_new/project/data/sample_1/my_table_expected_power_results.csv
79
+ - lib/slacker_new/project/data/sample_1/my_table_initial_data.csv
80
+ - lib/slacker_new/project/data/sample_1/numbers_expected_output.csv
79
81
  - lib/slacker_new/project/debug/failed_examples/example_001.sql
80
82
  - lib/slacker_new/project/debug/passed_examples/example_001.sql
83
+ - lib/slacker_new/project/sql/sample_1/my_table_on_power.sql.erb
81
84
  - lib/slacker_new/project/sql/sample_1/sysobjects_with_params_2.sql.erb
82
85
  - lib/slacker_new/project/sql/sample_1/play_with_numbers.sql.erb
83
86
  - lib/slacker_new/project/sql/sample_1/sysobjects_with_params.sql.erb
87
+ - lib/slacker_new/project/sql/sample_1/create_my_table.sql.erb
84
88
  - lib/slacker_new/project/sql/sample_1/sysobjects.sql.erb
85
89
  - lib/slacker_new/project/spec/sample_1.rb
86
90
  - lib/slacker_new/project/database.yml
File without changes