picard 0.0.3 → 0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.markdown +75 -0
  2. data/lib/picard/version.rb +6 -2
  3. metadata +10 -12
  4. data/README.rdoc +0 -15
data/README.markdown ADDED
@@ -0,0 +1,75 @@
1
+ ## Now, let’s take a look at a test using Picard
2
+
3
+ require 'picard'
4
+
5
+ class DemoTest < Test::Unit::TestCase
6
+ include Picard::TestUnit
7
+
8
+ def test_simple_math
9
+ given
10
+ x = 1
11
+ y = 2
12
+
13
+ expect
14
+ x + y == 3
15
+ end
16
+ end
17
+
18
+ To start using picard you need to mix in Picard::TestUnit module into your TestUnit test case. It will add a special hook that will transform every test method in your test case. For instance, the "test_simple_math" method will be transformed into something like:
19
+
20
+ def test_simple_math
21
+ given
22
+ x = 1
23
+ y = 2
24
+
25
+ expect
26
+ assert_equal 3, (x + y), MESSAGE
27
+ end
28
+ end
29
+
30
+
31
+ Where the MESSAGE is:
32
+
33
+ --------------------------------------------------------------------------------------
34
+ | File: "/Users/savkin/projects/picard/test/picard/demo_test.rb", Line: 10 |
35
+ | Failed Assertion: (x + y == 3) |
36
+ --------------------------------------------------------------------------------------
37
+
38
+
39
+ You might notice a few things here:
40
+ 1. Picard uses TestUnit, so all your tools we will work with it just fine.
41
+ 2. Picard is smart enough to insert assert_equal instead of regular assert.
42
+ 3. Picard generates a very descriptive error message containing not only the file name and the line number of the failed assertion but the assertion itself. In most cases it’s enough information to understand what went wrong so you won't have to find that exact line number to figure it out.
43
+
44
+
45
+ ## What if I want to try?
46
+
47
+ gem 'picard'
48
+
49
+
50
+ ## What is coming next?
51
+
52
+ There are some things I'm going to add in a week or two:
53
+
54
+ 1. The only special case Picard supports right now is `==`. If you are using something like `x != y` in your `expect` block it will just insert a regular `assert` which is bad. It's going to be much smarter than this soon.
55
+ 2.
56
+ In Spock it's possible to write data driven tests:
57
+
58
+ expect:
59
+ x + y == z
60
+
61
+ where:
62
+ x = [1, 10, 100]
63
+ y = [2, 20, 200]
64
+ z = [3, 30, 300]
65
+
66
+ Basically it will transform into something like:
67
+
68
+ expect:
69
+ 1 + 2 == 3
70
+ 10 + 20 == 30
71
+ 100 + 200 == 300
72
+
73
+ Which is totally awesome! I'm going to add a similar feature to Picard soon.
74
+
75
+ 3. Right now Picard is written in Ruby 1.9 but it can parse only 1.8 syntax (which is weird). It needs to be put in order so it will work properly on 1.8 and 1.9.
@@ -1,3 +1,7 @@
1
- module Picard
2
- VERSION = "0.0.3"
1
+ module PicardTestFramework
2
+ module V01
3
+ VERSION = "0.1"
4
+ end
3
5
  end
6
+
7
+ Picard = PicardTestFramework::V01
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: picard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: '0.1'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-02 00:00:00.000000000 -04:00
13
- default_executable:
12
+ date: 2011-10-15 00:00:00.000000000Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: live_ast
17
- requirement: &2169351160 !ruby/object:Gem::Requirement
16
+ requirement: &2156661700 !ruby/object:Gem::Requirement
18
17
  none: false
19
18
  requirements:
20
19
  - - =
@@ -22,10 +21,10 @@ dependencies:
22
21
  version: 1.0.2
23
22
  type: :runtime
24
23
  prerelease: false
25
- version_requirements: *2169351160
24
+ version_requirements: *2156661700
26
25
  - !ruby/object:Gem::Dependency
27
26
  name: live_ast_ripper
28
- requirement: &2169350560 !ruby/object:Gem::Requirement
27
+ requirement: &2156659860 !ruby/object:Gem::Requirement
29
28
  none: false
30
29
  requirements:
31
30
  - - =
@@ -33,10 +32,10 @@ dependencies:
33
32
  version: 0.6.5
34
33
  type: :runtime
35
34
  prerelease: false
36
- version_requirements: *2169350560
35
+ version_requirements: *2156659860
37
36
  - !ruby/object:Gem::Dependency
38
37
  name: flexmock
39
- requirement: &2169350180 !ruby/object:Gem::Requirement
38
+ requirement: &2156659180 !ruby/object:Gem::Requirement
40
39
  none: false
41
40
  requirements:
42
41
  - - ! '>='
@@ -44,7 +43,7 @@ dependencies:
44
43
  version: '0'
45
44
  type: :development
46
45
  prerelease: false
47
- version_requirements: *2169350180
46
+ version_requirements: *2156659180
48
47
  description: Test framework inspired by Spock
49
48
  email:
50
49
  - vic.savkin@gmail.com
@@ -55,7 +54,7 @@ files:
55
54
  - .gitignore
56
55
  - Gemfile
57
56
  - Gemfile.lock
58
- - README.rdoc
57
+ - README.markdown
59
58
  - Rakefile
60
59
  - lib/picard.rb
61
60
  - lib/picard/assertion_wrapper.rb
@@ -79,7 +78,6 @@ files:
79
78
  - test/picard/preprocessor_test.rb
80
79
  - test/picard/test_unit_test.rb
81
80
  - test/test_helper.rb
82
- has_rdoc: true
83
81
  homepage: ''
84
82
  licenses: []
85
83
  post_install_message:
@@ -100,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
98
  version: '0'
101
99
  requirements: []
102
100
  rubyforge_project: picard
103
- rubygems_version: 1.6.2
101
+ rubygems_version: 1.8.10
104
102
  signing_key:
105
103
  specification_version: 3
106
104
  summary: Test framework inspired by Spock
data/README.rdoc DELETED
@@ -1,15 +0,0 @@
1
- == Test Framework "Picard"
2
-
3
- Picard is a test framework heavily inspired by "Spock" (an excellent test framework for the Groovy programming language). It does some AST manipulation to make the structure of your test explicit:
4
-
5
- def test_method
6
- given
7
- x = 1
8
-
9
- expect
10
- x == 1
11
- end
12
-
13
- The "given" block is a setup you do for your test. Every line in the "expect" block is an assertion.
14
-
15
-