capybara-harness 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +38 -8
- data/lib/capybara/harness/dom/attribute.rb +0 -1
- data/lib/capybara/harness/version.rb +1 -1
- metadata +9 -9
data/README.md
CHANGED
@@ -9,13 +9,6 @@ By pulling redundant behavior out of scenarios and tests (such as filling out an
|
|
9
9
|
comment element is visible on the page), the focus moves to the essential steps of the use cases and the intent of
|
10
10
|
the feature becomes more legible.
|
11
11
|
|
12
|
-
## Props
|
13
|
-
|
14
|
-
I had been playing with the concept for a while in my acceptance tests, but this thoughtbot article really helped
|
15
|
-
solidify the concept and highly influenced me:
|
16
|
-
|
17
|
-
http://robots.thoughtbot.com/post/35776432958/better-support-with-test-harnesses
|
18
|
-
|
19
12
|
## Status
|
20
13
|
|
21
14
|
This library is still very much in the baking phase, although I am successfully using it in 2 production projects. I'll
|
@@ -37,7 +30,44 @@ Or install it yourself as:
|
|
37
30
|
|
38
31
|
## Usage
|
39
32
|
|
40
|
-
|
33
|
+
First, create a new harness in spec/support/harnesses:
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
class BlogPostHarness < Capybara::Harness::DomHarness
|
37
|
+
define_reader :post do |r|
|
38
|
+
r.attribute :title, :finder => true
|
39
|
+
r.attribute :author do |attrs|
|
40
|
+
"#{attrs[:first_name]} #{attrs[:last_name][0][1].}"
|
41
|
+
end
|
42
|
+
r.attribute :body
|
43
|
+
end
|
44
|
+
|
45
|
+
define_writer do |w|
|
46
|
+
w.field :title, :label => 'Blog Post Title'
|
47
|
+
w.field :body
|
48
|
+
end
|
49
|
+
end
|
50
|
+
```
|
51
|
+
|
52
|
+
Now in your feature spec, e.g. spec/features/blog_posts_spec.rb, create the new harness and interact with it:
|
53
|
+
|
54
|
+
```ruby
|
55
|
+
scenario "Add blog post" do
|
56
|
+
post = BlogPostHarness.new
|
57
|
+
|
58
|
+
visit blog_posts_path
|
59
|
+
click_link 'Add'
|
60
|
+
post.create(attributes_for(:blog_post))
|
61
|
+
expect(post).to be_on_the_page
|
62
|
+
end
|
63
|
+
```
|
64
|
+
|
65
|
+
## Props
|
66
|
+
|
67
|
+
I had been playing with the concept for a while in my acceptance tests, but this thoughtbot article really helped
|
68
|
+
solidify the concept and highly influenced me:
|
69
|
+
|
70
|
+
http://robots.thoughtbot.com/post/35776432958/better-support-with-test-harnesses
|
41
71
|
|
42
72
|
## Contributing
|
43
73
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capybara-harness
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2013-01-27 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70228239283380 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70228239283380
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: capybara
|
27
|
-
requirement: &
|
27
|
+
requirement: &70228239298800 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '1.1'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70228239298800
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: activesupport
|
38
|
-
requirement: &
|
38
|
+
requirement: &70228239298040 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '3.0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70228239298040
|
47
47
|
description: A test harness strategy to easily query and manipulate DOM elements as
|
48
48
|
self-contained objects in the context of feature or acceptance tests.
|
49
49
|
email:
|
@@ -85,7 +85,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
85
85
|
version: '0'
|
86
86
|
segments:
|
87
87
|
- 0
|
88
|
-
hash: -
|
88
|
+
hash: -4009381885818823532
|
89
89
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
90
|
none: false
|
91
91
|
requirements:
|
@@ -94,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
94
|
version: '0'
|
95
95
|
segments:
|
96
96
|
- 0
|
97
|
-
hash: -
|
97
|
+
hash: -4009381885818823532
|
98
98
|
requirements: []
|
99
99
|
rubyforge_project:
|
100
100
|
rubygems_version: 1.8.15
|