tedium 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +13 -1
- data/lib/tedium/site_prism/form_dsl.rb +4 -1
- data/lib/tedium/version.rb +1 -1
- data/spec/features/fill_in_form_spec.rb +15 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1397c9ac3e0486da2a888709af61602c44f13683
|
4
|
+
data.tar.gz: 162b58f2726641bd4fd12d39801ca1f01440d188
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74c89dd5a02829550bbfa15387899fbc71054d40a3b7ce9cf23ef3452ff6e1e3f947fe18490f74b240dc8ad8514bd4454a5d1adab45e5f4ff52891283c9b83ab
|
7
|
+
data.tar.gz: 9fe6eb32a6484e9adc46355b7557f80157fb83570747b7e5eec824b02269e9efa17c916a7540b49b6f62b6196c9b84f2c26155a16de1fa89acd793c538fd36eb
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
# Tedium
|
2
2
|
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/tedium.png)](http://badge.fury.io/rb/tedium)
|
3
4
|
[![Build Status](https://travis-ci.org/cantierecreativo/tedium.png?branch=master)](https://travis-ci.org/cantierecreativo/tedium)
|
4
5
|
[![Coverage Status](https://coveralls.io/repos/cantierecreativo/tedium/badge.png)](https://coveralls.io/r/cantierecreativo/tedium)
|
6
|
+
[![Code Climate](https://codeclimate.com/github/cantierecreativo/tedium.png)](https://codeclimate.com/github/cantierecreativo/tedium)
|
5
7
|
|
6
8
|
Remove the tedium of formulaic form filling with [SitePrism](https://github.com/natritmeyer/site_prism) and [Capybara](https://github.com/jnicklas/capybara). Tedium allows you to specify a set of fields and actions to be performed rather than procedurally calling Capybara’s DSL methods on SitePrism elements.
|
7
9
|
|
@@ -98,7 +100,17 @@ class SignInPage < SitePrism::Page
|
|
98
100
|
end
|
99
101
|
```
|
100
102
|
|
101
|
-
The page object will define a `#sign_in
|
103
|
+
The page object will define a `#sign_in` method, which will perform the following steps:
|
104
|
+
|
105
|
+
```ruby
|
106
|
+
def sign_in(name, email, terms_of_service)
|
107
|
+
name_field.set(name)
|
108
|
+
email_field.set(email)
|
109
|
+
terms_of_service_field.set(terms_of_service)
|
110
|
+
end
|
111
|
+
```
|
112
|
+
|
113
|
+
And a `#sign_in!` method, which will also submit the form:
|
102
114
|
|
103
115
|
```ruby
|
104
116
|
def sign_in!(name, email, terms_of_service)
|
@@ -36,10 +36,13 @@ module Tedium
|
|
36
36
|
|
37
37
|
def submission(name, fields = nil)
|
38
38
|
fields ||= @fields
|
39
|
-
define_method "#{name}
|
39
|
+
define_method "#{name}" do |*args|
|
40
40
|
Array(fields).each_with_index do |field, i|
|
41
41
|
send("#{field}_field").set(args[i])
|
42
42
|
end
|
43
|
+
end
|
44
|
+
define_method "#{name}!" do |*args|
|
45
|
+
send(name, *args)
|
43
46
|
submit!
|
44
47
|
end
|
45
48
|
end
|
data/lib/tedium/version.rb
CHANGED
@@ -8,7 +8,7 @@ describe 'Given a SitePrism page object with some fields and a submission' do
|
|
8
8
|
fields :email, :password
|
9
9
|
submit_button :sign_in
|
10
10
|
|
11
|
-
submission :sign_in, %w(email
|
11
|
+
submission :sign_in, %w(password email)
|
12
12
|
submission :implicit_sign_in
|
13
13
|
end
|
14
14
|
end
|
@@ -34,20 +34,27 @@ describe 'Given a SitePrism page object with some fields and a submission' do
|
|
34
34
|
expect(page).to have_content 'Submitted!'
|
35
35
|
end
|
36
36
|
|
37
|
-
context do
|
38
|
-
|
39
|
-
page_object.
|
37
|
+
context 'with a submission with explicit fields' do
|
38
|
+
it 'performs the submission' do
|
39
|
+
page_object.sign_in('qux', 'foo@bar.com')
|
40
|
+
|
41
|
+
expect(page_object.email_field.value).to eq 'foo@bar.com'
|
42
|
+
expect(page_object.password_field.value).to eq 'qux'
|
40
43
|
end
|
44
|
+
end
|
41
45
|
|
42
|
-
|
43
|
-
|
46
|
+
context 'with a submission with no fields' do
|
47
|
+
it 'performs a submission inferring the fields to fill in' do
|
48
|
+
page_object.implicit_sign_in('foo@bar.com', 'qux')
|
44
49
|
|
45
50
|
expect(page_object.email_field.value).to eq 'foo@bar.com'
|
46
51
|
expect(page_object.password_field.value).to eq 'qux'
|
47
|
-
expect(page_object).to have_received(:submit!)
|
48
52
|
end
|
53
|
+
end
|
49
54
|
|
50
|
-
|
55
|
+
context 'with a bang submission' do
|
56
|
+
it 'performs a submission and submits' do
|
57
|
+
page_object.stub(:submit!)
|
51
58
|
page_object.implicit_sign_in!('foo@bar.com', 'qux')
|
52
59
|
|
53
60
|
expect(page_object.email_field.value).to eq 'foo@bar.com'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tedium
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefano Verna
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: site_prism
|