tedium 0.0.3 → 0.0.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8766bb089e801c3bef29f442029c3e7c646d5518
4
- data.tar.gz: 9d1458219ddd62f9fb0070641b5e98d47a2173d6
3
+ metadata.gz: 1397c9ac3e0486da2a888709af61602c44f13683
4
+ data.tar.gz: 162b58f2726641bd4fd12d39801ca1f01440d188
5
5
  SHA512:
6
- metadata.gz: 3036b24f0627c6c0bf929673e6201d8a0390a5b6da7d1d5250e107c27858e3fda8d519dece3986ab90ce93a45d64ebabe8e858210ec04ae80041d93fbb411fc7
7
- data.tar.gz: 1903646b66c43c8e92e4fe5e7402ae5d37c9796feefc455989a51dd1f87ce2dea92c5f34a8a44e9967325120d9c0730d1901c16d4f6d8f316941518927a10ccc
6
+ metadata.gz: 74c89dd5a02829550bbfa15387899fbc71054d40a3b7ce9cf23ef3452ff6e1e3f947fe18490f74b240dc8ad8514bd4454a5d1adab45e5f4ff52891283c9b83ab
7
+ data.tar.gz: 9fe6eb32a6484e9adc46355b7557f80157fb83570747b7e5eec824b02269e9efa17c916a7540b49b6f62b6196c9b84f2c26155a16de1fa89acd793c538fd36eb
@@ -1,3 +1,7 @@
1
+ # v0.0.4
2
+
3
+ * Submission also declare a non-bang method that just fills in the data without submitting the form
4
+
1
5
  # v0.0.3
2
6
 
3
7
  * Add implicit submission field inferring feature
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!` method, which will perform the following steps:
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}!" do |*args|
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
@@ -1,4 +1,4 @@
1
1
  module Tedium
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
4
4
 
@@ -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 password)
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
- before do
39
- page_object.stub(:submit!)
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
- it 'performs the submission' do
43
- page_object.sign_in!('foo@bar.com', 'qux')
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
- it 'performs the submission inferring the fields to fill in' do
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.3
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-19 00:00:00.000000000 Z
11
+ date: 2014-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: site_prism