filet 0.1.0 → 0.2.0
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/.gitignore +1 -0
- data/Gemfile +6 -1
- data/Rakefile +10 -0
- data/Readme.md +37 -7
- data/lib/filet/test_case.rb +4 -2
- data/lib/filet/version.rb +1 -1
- data/test/filet/test_case_test.rb +2 -4
- metadata +2 -2
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/Rakefile
CHANGED
data/Readme.md
CHANGED
@@ -10,8 +10,10 @@ Filet is a dsl for acceptance testing on top of Test::Unit.
|
|
10
10
|
|
11
11
|
To use filet just include in your test_helper
|
12
12
|
|
13
|
-
|
14
|
-
|
13
|
+
```ruby
|
14
|
+
require 'filet'
|
15
|
+
include Filet
|
16
|
+
```
|
15
17
|
|
16
18
|
## Hooks
|
17
19
|
|
@@ -21,18 +23,46 @@ We provide several hooks for options processing.
|
|
21
23
|
|
22
24
|
This allows to process the options you pass for the feature
|
23
25
|
|
24
|
-
|
25
|
-
|
26
|
-
|
26
|
+
```ruby
|
27
|
+
Filet.feature_hook do |base, options|
|
28
|
+
base.send(:include, Capybara)
|
29
|
+
end
|
30
|
+
```
|
27
31
|
|
28
32
|
2. Filet.context_hook
|
29
33
|
|
30
34
|
This allows to process the options you pass for the context
|
31
35
|
|
32
|
-
|
33
|
-
|
36
|
+
```ruby
|
37
|
+
Filet.context_hook do |base, options|
|
38
|
+
base.send(:include, SomeModule) if options[:js]
|
39
|
+
end
|
40
|
+
```
|
41
|
+
|
42
|
+
## Example
|
43
|
+
|
44
|
+
```ruby
|
45
|
+
feature 'Creating a post', %{
|
46
|
+
As a user
|
47
|
+
I want to create a post
|
48
|
+
In order to show it to people
|
49
|
+
} do
|
50
|
+
|
51
|
+
scenario 'Everything goes fine after a submit' do
|
52
|
+
# test code
|
53
|
+
end
|
54
|
+
|
55
|
+
context 'Something goes wrong', :js => true do
|
56
|
+
scenario 'my keyboard stopped working' do
|
57
|
+
# test code
|
34
58
|
end
|
35
59
|
|
60
|
+
scenario 'I forgot to fill up the form' do
|
61
|
+
# test code
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
```
|
36
66
|
## Acknowledgements
|
37
67
|
|
38
68
|
We'd like to thank our employer XING AG for letting us work on this project as part of our innovation time and releasing it as open source.
|
data/lib/filet/test_case.rb
CHANGED
@@ -49,12 +49,14 @@ module Filet
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def create_class(name, superclass, &block)
|
52
|
-
klass = Class.new(superclass
|
52
|
+
klass = Class.new(superclass)
|
53
53
|
name = name.gsub(/(^\d*|\W)/, ' ').lstrip
|
54
54
|
klass_name = name.gsub(/(^[a-z]|\s+\w)/).each do |match|
|
55
55
|
match.lstrip.upcase
|
56
56
|
end
|
57
57
|
|
58
|
-
superclass.const_set klass_name, klass
|
58
|
+
const = superclass.const_set klass_name, klass
|
59
|
+
const.class_eval(&block) if block
|
60
|
+
const
|
59
61
|
end
|
60
62
|
end
|
data/lib/filet/version.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'bundler/setup'
|
3
1
|
require 'test/unit'
|
4
2
|
require 'filet/test_case'
|
5
3
|
|
@@ -105,8 +103,8 @@ module Filet
|
|
105
103
|
end
|
106
104
|
end
|
107
105
|
|
108
|
-
assert klass.
|
109
|
-
assert context_klass.
|
106
|
+
assert klass.method_defined?("test_Scenario_description")
|
107
|
+
assert context_klass.method_defined?("test_Nested_Scenario")
|
110
108
|
end
|
111
109
|
|
112
110
|
def teardown
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: filet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-08-01 00:00:00.000000000 +02:00
|
14
14
|
default_executable:
|
15
15
|
dependencies: []
|
16
16
|
description: Extension for Test::Unit to have a Steak-like DSL for acceptance testing
|