tedium 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 258164c5ea7bfe3aa42b680ae6d6a2443a96d9c1
4
+ data.tar.gz: 8e9d628b16f9645b89200f7b8ff0e6e983f82ddd
5
+ SHA512:
6
+ metadata.gz: cd72b84371b4180094a5fdce5492729a012463d442e222c2ec8d17cbf7d73e11ccb8c20e03e7f60f9a806e3e77bdd972f243a3dc224fb86d36f4bd8241d659f0
7
+ data.tar.gz: 745577fab02b9c49ccf801499709a63d104e95ec4c96a747d5c1ec31dad25f78e9c4df8a902be4af21ebeb82f6e6cf5164839240501c06b961639feba19d2776
@@ -0,0 +1,21 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ bin
19
+ capybara-*.html
20
+ .rspec
21
+
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+
3
+ rvm:
4
+ - "1.9.3"
5
+ - "2.0.0"
6
+ - "2.1.1"
7
+
8
+ script: "bundle exec rake spec"
9
+
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in tedium.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Stefano Verna
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,150 @@
1
+ # Tedium
2
+
3
+ [![Build Status](https://travis-ci.org/cantierecreativo/tedium.png?branch=master)](https://travis-ci.org/cantierecreativo/tedium)
4
+
5
+ Remove the tedium of formulaic form filling with SitePrism and 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.
6
+
7
+ ## Usage
8
+
9
+ ```ruby
10
+ class SignInPage < SitePrism::Page
11
+ fields :name, :email, :terms_of_service
12
+ submit_button
13
+
14
+ submission :sign_in, %w(name email terms_of_service)
15
+ end
16
+
17
+ feature 'New user registration' do
18
+ let(:sign_in_page) { SignInPage.new }
19
+
20
+ scenario 'successfull sign up' do
21
+ sign_in_page.load
22
+ sign_in_page.sign_in!('Stefano', 's.verna@cantierecreativo.net', true)
23
+ expect(page).to have_content t('user.create.success')
24
+ end
25
+ end
26
+ ```
27
+
28
+ ## SitePrism DSL
29
+
30
+ ### field
31
+
32
+ ```ruby
33
+ field(name, attribute_name = name)
34
+ ```
35
+
36
+ Declares the presence of a field within the page. The selector used to find the input relies on Rails `name="model[attribute]"` attribute convention: `[name$="[attribute]"]`
37
+
38
+ If the underlying attribute name differs from the name you want to give to the page object field, provide the attribute name as the second argument.
39
+
40
+ Once a `:foobar` field is declared, the page object will define a `#foobar_field` method, which will return the corresponding Capybara node.
41
+ element.
42
+
43
+ ### fields
44
+
45
+ ```ruby
46
+ fields(*names)
47
+ ```
48
+
49
+ If you need to declare multiple fields at once, you can use this batch method.
50
+
51
+ ### date_field
52
+
53
+ ```ruby
54
+ date_field(name, attribute_name = name)
55
+ ```
56
+
57
+ Declares the presence of a `date_select` set of selects within the page. Once a `:date_of_birth` date_field is declared, the page object will define a `#date_of_birth_field` method, which will return a `Tedium::VirtualDateElement` instance. Calling `date_of_birth_field.set(Date.new)` will fill in the year, month and day selects with the correct values.
58
+
59
+ You can access to the specific year select element with `date_of_birth_field.year_element` method (the same applies also for month and day selects).
60
+
61
+ ### submit_button
62
+
63
+ ```ruby
64
+ submit_button(role = nil)
65
+ ```
66
+
67
+ Declares the presence of a submit button within the page. It can be either a `input[type=select]` or a `button`. If you pass an argument to the method (ie. `submit_button :sign_in`), the selector will be augmented with a `[role='sign-in']` filter (please note the automatic *dasherization*).
68
+
69
+ Once the submit button is declared, the page object will define a `#submit!`
70
+ method which will press the button.
71
+
72
+ ### submission
73
+
74
+ ```ruby
75
+ submission(name, fields)
76
+ ```
77
+
78
+ Declares a submission process.
79
+
80
+ Given the following page:
81
+
82
+ ```ruby
83
+ class SignInPage < SitePrism::Page
84
+ fields :name, :email, :terms_of_service
85
+ submit_button
86
+
87
+ submission :sign_in, %w(name email terms_of_service)
88
+ end
89
+ ```
90
+
91
+ The page object will define a `#sign_in!` method, which will perform the following steps:
92
+
93
+ ```ruby
94
+ def sign_in!(name, email, terms_of_service)
95
+ name_field.set(name)
96
+ email_field.set(email)
97
+ terms_of_service_field.set(terms_of_service)
98
+ submit!
99
+ end
100
+ ```
101
+
102
+ ### action
103
+
104
+ ```ruby
105
+ action(name, role = name)
106
+ ```
107
+
108
+ Declares the presence of an action button/link within the page. Once a `:sign_out` action is declared, the page object will define a `#sign_out_element` method, which will return the corresponding Capybara node and a `#sign_out!` method, which will click on the element.
109
+
110
+ The selector relies on a `role` attribute present in the action element (see `submit_button` for details). If the role attribute differs from the name you want to give to the page object action, provide it as a second argument.
111
+
112
+ ### actions
113
+
114
+ ```ruby
115
+ actions(*names)
116
+ ```
117
+
118
+ If you need to declare multiple actions at once, you can use this batch method.
119
+
120
+ ### Changes to the Capybara node element #set method
121
+
122
+ In order to fill in text inputs, selects and checkboxes using the same API, Tedium extends the default `Capybara::Node::Element#set` behaviour, so that it will select the first option matching either the its value or its text:
123
+
124
+ ```html
125
+ <select>
126
+ <option value='1'>Option 1</option>
127
+ <option value='2'>Option 2</option>
128
+ <option value='3'>Option 3</option>
129
+ </select>
130
+ ```
131
+ ```ruby
132
+ # both will select the second option
133
+ page.find_first('select').set('Option 2')
134
+ page.find_first('select').set('2')
135
+ ```
136
+
137
+ ### has_record?
138
+
139
+ Every SitePrism page inherits the `has_record?(record)` method, useful in conjunction with the [Rails `div_for` helper](http://devdocs.io/rails/actionview/helpers/recordtaghelper#method-i-div_for):
140
+
141
+ ```erb
142
+ <%= div_for(@person, class: "foo") do %>
143
+ <%= @person.name %>
144
+ <% end %>
145
+ ```
146
+
147
+ ```ruby
148
+ expect(page).to have_record(@person) # this PASSes
149
+ ```
150
+
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+ task :default => :spec
6
+
@@ -0,0 +1,23 @@
1
+ require "tedium/version"
2
+
3
+ require "tedium/capybara/selectors"
4
+ require "tedium/capybara/node_element"
5
+
6
+ require "tedium/site_prism/form_dsl"
7
+ require "tedium/site_prism/action_dsl"
8
+ require "tedium/site_prism/has_record"
9
+ require "tedium/site_prism/root_element_or_page"
10
+
11
+ require "site_prism"
12
+
13
+ [SitePrism::Page, SitePrism::Section].each do |klass|
14
+ klass.send :extend, Tedium::SitePrism::FormDsl
15
+ klass.send :extend, Tedium::SitePrism::ActionDsl
16
+ klass.send :include, Tedium::SitePrism::HasRecord
17
+ klass.send :include, Tedium::SitePrism::RootElementOrPage
18
+ end
19
+
20
+ require 'capybara/node/element'
21
+
22
+ Capybara::Node::Element.send(:include, Tedium::Capybara::NodeElement)
23
+
@@ -0,0 +1,19 @@
1
+ module Tedium
2
+ module Capybara
3
+ module NodeElement
4
+ def self.included(base)
5
+ base.send(:alias_method, :original_set, :set)
6
+ base.send(:alias_method, :set, :augmented_select)
7
+ end
8
+
9
+ def augmented_select(value)
10
+ if tag_name == "select"
11
+ find(:option_with_value_or_label, value).select_option
12
+ else
13
+ original_set(value)
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+
@@ -0,0 +1,72 @@
1
+ require "capybara"
2
+
3
+ Capybara.add_selector(:input_for_field) do
4
+ label 'input for field'
5
+
6
+ xpath do |field|
7
+ XPath.descendant[
8
+ XPath.attr(:name).contains("[#{field}]") &
9
+ XPath.attr(:type).equals('hidden').inverse
10
+ ]
11
+ end
12
+ end
13
+
14
+ Capybara.add_selector(:role) do
15
+ label 'element with role'
16
+
17
+ xpath do |role|
18
+ role = role.to_s.gsub(/_/, '-')
19
+ XPath.descendant[XPath.attr(:role).equals(role)]
20
+ end
21
+ end
22
+
23
+ Capybara.add_selector(:submit_button) do
24
+ label 'submit button'
25
+
26
+ xpath do |role = nil|
27
+
28
+ selectors = [
29
+ XPath.descendant(:input)[XPath.attr(:type).equals('submit')],
30
+ XPath.descendant(:button)
31
+ ]
32
+
33
+ if role
34
+ role = role.to_s.gsub(/_/, '-')
35
+ selectors.map! do |selector|
36
+ selector[XPath.attr(:role).equals(role)]
37
+ end
38
+ end
39
+
40
+ selectors.inject(&:+)
41
+ end
42
+ end
43
+
44
+ Capybara.add_selector(:record) do
45
+ xpath do |record|
46
+ dom_id = record_identifier.dom_id(record)
47
+ XPath.descendant[XPath.attr(:id).equals(dom_id)]
48
+ end
49
+
50
+ match do |record|
51
+ record.is_a?(ActiveModel::Naming)
52
+ end
53
+
54
+ def record_identifier
55
+ if defined?(ActionView::RecordIdentifier)
56
+ ActionView::RecordIdentifier
57
+ elsif defined?(ActionController::RecordIdentifier)
58
+ ActionController::RecordIdentifier
59
+ else
60
+ raise 'No RecordIdentifier found!'
61
+ end
62
+ end
63
+ end
64
+
65
+ Capybara.add_selector :option_with_value_or_label do
66
+ label 'option with value or label'
67
+
68
+ xpath do |value|
69
+ XPath.descendant(:option)[XPath.text.equals(value) | XPath.attr(:value).equals(value)]
70
+ end
71
+ end
72
+
@@ -0,0 +1,18 @@
1
+ module Tedium
2
+ module SitePrism
3
+ module ActionDsl
4
+ def action(name, role = name)
5
+ element "#{name}_element", :role, role
6
+
7
+ define_method "#{name}!" do
8
+ send("#{name}_element").click
9
+ end
10
+ end
11
+
12
+ def actions(*names)
13
+ names.each { |n| action n }
14
+ end
15
+ end
16
+ end
17
+ end
18
+
@@ -0,0 +1,39 @@
1
+ require "tedium/virtual_date_element"
2
+
3
+ module Tedium
4
+ module SitePrism
5
+ module FormDsl
6
+ def field(name, attribute_name = name)
7
+ element "#{name}_field", :input_for_field, attribute_name
8
+ end
9
+
10
+ def fields(*names)
11
+ names.each { |n| field n }
12
+ end
13
+
14
+ def date_field(name, attribute_name = name)
15
+ define_method "#{name}_field" do
16
+ VirtualDateElement.new(root_element_or_page, attribute_name)
17
+ end
18
+ end
19
+
20
+ def submit_button(role = nil)
21
+ element :submit_button, :submit_button, role
22
+
23
+ define_method :submit! do
24
+ submit_button.click
25
+ end
26
+ end
27
+
28
+ def submission(name, fields)
29
+ define_method "#{name}!" do |*args|
30
+ Array(fields).each_with_index do |field, i|
31
+ send("#{field}_field").set(args[i])
32
+ end
33
+ submit!
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+
@@ -0,0 +1,10 @@
1
+ module Tedium
2
+ module SitePrism
3
+ module HasRecord
4
+ def has_record?(record)
5
+ element_exists?(:record, record)
6
+ end
7
+ end
8
+ end
9
+ end
10
+
@@ -0,0 +1,14 @@
1
+ module Tedium
2
+ module SitePrism
3
+ module RootElementOrPage
4
+ def root_element_or_page
5
+ if defined?(self.root_element)
6
+ root_element
7
+ else
8
+ page
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
14
+
@@ -0,0 +1,3 @@
1
+ module Tedium
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,33 @@
1
+ class VirtualDateElement
2
+ attr_reader :root_element, :attribute_name
3
+
4
+ def initialize(root_element, attribute_name)
5
+ @root_element = root_element
6
+ @attribute_name = attribute_name
7
+ end
8
+
9
+ def set(date)
10
+ year_element.set(date.year)
11
+ month_element.set(date.month)
12
+ day_element.set(date.day)
13
+ end
14
+
15
+ def year_element
16
+ token_element('1i')
17
+ end
18
+
19
+ def month_element
20
+ token_element('2i')
21
+ end
22
+
23
+ def day_element
24
+ token_element('3i')
25
+ end
26
+
27
+ private
28
+
29
+ def token_element(token)
30
+ root_element.find :input_for_field, "#{attribute_name}(#{token})"
31
+ end
32
+ end
33
+
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Given a SitePrism page object with a checkbox field' do
4
+ let(:page_object) { page_object_klass.new }
5
+
6
+ let(:page_object_klass) do
7
+ Class.new(SitePrism::Page) do
8
+ field :terms_of_service
9
+ end
10
+ end
11
+
12
+ before do
13
+ visit 'checkbox'
14
+ end
15
+
16
+ it 'fills up the field' do
17
+ page_object.terms_of_service_field.set true
18
+ expect(page_object.terms_of_service_field).to be_checked
19
+ end
20
+ end
21
+
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Given a SitePrism page object with a date field' do
4
+ let(:page_object) { page_object_klass.new }
5
+
6
+ let(:page_object_klass) do
7
+ Class.new(SitePrism::Page) do
8
+ date_field :date_of_birth
9
+ end
10
+ end
11
+
12
+ before do
13
+ visit 'date'
14
+ end
15
+
16
+ it 'fills up all the tokens' do
17
+ page_object.date_of_birth_field.set Date.new(1985, 2, 15)
18
+
19
+ expect(page_object.date_of_birth_field.year_element.value).to eq '1985'
20
+ expect(page_object.date_of_birth_field.month_element.value).to eq '2'
21
+ expect(page_object.date_of_birth_field.day_element.value).to eq '15'
22
+ end
23
+ end
24
+
@@ -0,0 +1,35 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Given a SitePrism page object with some fields and a submission' do
4
+ let(:page_object) { page_object_klass.new }
5
+
6
+ let(:page_object_klass) do
7
+ Class.new(SitePrism::Page) do
8
+ fields :email, :password
9
+ submit_button :sign_in
10
+
11
+ submission :sign_in, %w(email password)
12
+ end
13
+ end
14
+
15
+ before do
16
+ visit 'form'
17
+ end
18
+
19
+ it 'finds the email field' do
20
+ expect(page_object.email_field).to be_present
21
+ end
22
+
23
+ it 'finds the password field' do
24
+ expect(page_object.password_field).to be_present
25
+ end
26
+
27
+ it 'finds the submit button' do
28
+ expect(page_object.submit_button).to be_present
29
+ end
30
+
31
+ it 'performs the submission' do
32
+ page_object.sign_in!('foo@bar.com', 'qux')
33
+ end
34
+ end
35
+
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Given any SitePrism page object' do
4
+ let(:page_object) { SitePrism::Page.new }
5
+ let(:record) { Project.new(12) }
6
+
7
+ before do
8
+ visit 'record'
9
+ end
10
+
11
+ it 'I can use the have_selector matcher' do
12
+ expect(page_object).to have_record(record)
13
+ end
14
+ end
15
+
@@ -0,0 +1,25 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Given a SitePrism page object with an action' do
4
+ let(:page_object) { page_object_klass.new }
5
+
6
+ let(:page_object_klass) do
7
+ Class.new(SitePrism::Page) do
8
+ action :follow_project
9
+ end
10
+ end
11
+
12
+ before do
13
+ visit 'action'
14
+ end
15
+
16
+ it 'finds the action element' do
17
+ expect(page_object.follow_project_element).to be_present
18
+ end
19
+
20
+ it 'performs the action' do
21
+ page_object.follow_project!
22
+ expect(page).to have_content 'Followed!'
23
+ end
24
+ end
25
+
@@ -0,0 +1,26 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Given a SitePrism page object with a select field' do
4
+ let(:page_object) { page_object_klass.new }
5
+
6
+ let(:page_object_klass) do
7
+ Class.new(SitePrism::Page) do
8
+ field :type
9
+ end
10
+ end
11
+
12
+ before do
13
+ visit 'select'
14
+ end
15
+
16
+ it '.set selects options by value' do
17
+ page_object.type_field.set 'public'
18
+ expect(page_object.type_field.value).to eq 'public'
19
+ end
20
+
21
+ it '.set selects options by label' do
22
+ page_object.type_field.set 'Public: fluff blargh'
23
+ expect(page_object.type_field.value).to eq 'public'
24
+ end
25
+ end
26
+
@@ -0,0 +1,2 @@
1
+ <a href="followed.html" role="follow-project">Follow</a>
2
+
@@ -0,0 +1,3 @@
1
+ <input name="user[terms_of_service]" type="hidden" value="0">
2
+ <input name="user[terms_of_service]" type="checkbox" value="1">
3
+
@@ -0,0 +1,68 @@
1
+ <select name="user[date_of_birth(1i)]">
2
+ <option value="1987">1987</option>
3
+ <option value="1986">1986</option>
4
+ <option value="1985">1985</option>
5
+ <option value="1984">1984</option>
6
+ <option value="1983">1983</option>
7
+ <option value="1982">1982</option>
8
+ <option value="1981">1981</option>
9
+ <option value="1980">1980</option>
10
+ <option value="1979">1979</option>
11
+ <option value="1978">1978</option>
12
+ <option value="1977">1977</option>
13
+ <option value="1976">1976</option>
14
+ <option value="1975">1975</option>
15
+ <option value="1974">1974</option>
16
+ <option value="1973">1973</option>
17
+ <option value="1972">1972</option>
18
+ <option value="1971">1971</option>
19
+ <option value="1970">1970</option>
20
+ </select>
21
+ <select name="user[date_of_birth(2i)]">
22
+ <option value="1">January</option>
23
+ <option value="2">February</option>
24
+ <option value="3">March</option>
25
+ <option value="4">April</option>
26
+ <option value="5">May</option>
27
+ <option value="6">June</option>
28
+ <option value="7">July</option>
29
+ <option value="8">August</option>
30
+ <option value="9">September</option>
31
+ <option value="10">October</option>
32
+ <option value="11">November</option>
33
+ <option value="12">December</option>
34
+ </select>
35
+ <select name="user[date_of_birth(3i)]">
36
+ <option value="1">1</option>
37
+ <option value="2">2</option>
38
+ <option value="3">3</option>
39
+ <option value="4">4</option>
40
+ <option value="5">5</option>
41
+ <option value="6">6</option>
42
+ <option value="7">7</option>
43
+ <option value="8">8</option>
44
+ <option value="9">9</option>
45
+ <option value="10">10</option>
46
+ <option value="11">11</option>
47
+ <option value="12">12</option>
48
+ <option value="13">13</option>
49
+ <option value="14">14</option>
50
+ <option value="15">15</option>
51
+ <option value="16">16</option>
52
+ <option value="17">17</option>
53
+ <option value="18">18</option>
54
+ <option value="19">19</option>
55
+ <option value="20">20</option>
56
+ <option value="21">21</option>
57
+ <option value="22">22</option>
58
+ <option value="23">23</option>
59
+ <option value="24">24</option>
60
+ <option value="25">25</option>
61
+ <option value="26">26</option>
62
+ <option value="27">27</option>
63
+ <option value="28">28</option>
64
+ <option value="29">29</option>
65
+ <option value="30">30</option>
66
+ <option value="31">31</option>
67
+ </select>
68
+
@@ -0,0 +1,2 @@
1
+ <p>Followed!</p>
2
+
@@ -0,0 +1,15 @@
1
+ <form method="get">
2
+ <div style="margin:0;padding:0;display:inline">
3
+ <input name="utf8" type="hidden" value="&#x2713;" />
4
+ </div>
5
+ <div class="email">
6
+ <label for="session_email">Email</label>
7
+ <input name="session[email]" type="email" />
8
+ </div>
9
+ <div class="password">
10
+ <label for="session_password">Password</label>
11
+ <input name="session[password]" type="password" />
12
+ </div>
13
+ <input class="button" type="submit" value="Sign in" role="sign-in" />
14
+ </form>
15
+
@@ -0,0 +1,4 @@
1
+ <div id="project_12">
2
+ Hi there!
3
+ </div>
4
+
@@ -0,0 +1,5 @@
1
+ <select name='project[type]'>
2
+ <option value="private">Private: fluff blargh</option>
3
+ <option value="public">Public: fluff blargh</option>
4
+ </select>
5
+
@@ -0,0 +1,30 @@
1
+ require 'capybara/dsl'
2
+ require 'tedium'
3
+ require 'pry'
4
+
5
+ require 'active_support/core_ext/object/blank'
6
+ require 'action_view/record_identifier'
7
+ require 'active_model'
8
+
9
+ class Project < Struct.new(:id)
10
+ extend ActiveModel::Naming
11
+ include ActiveModel::Conversion
12
+ end
13
+
14
+ module SpecHelper
15
+ def visit(page_name)
16
+ page.visit("/#{page_name}.html")
17
+ end
18
+
19
+ def page
20
+ @page ||= begin
21
+ Capybara.app = Rack::File.new(File.expand_path('../fixtures', __FILE__))
22
+ Capybara.current_session
23
+ end
24
+ end
25
+ end
26
+
27
+ RSpec.configure do |c|
28
+ c.include SpecHelper
29
+ end
30
+
@@ -0,0 +1,37 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'tedium/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "tedium"
8
+ spec.version = Tedium::VERSION
9
+ spec.authors = ["Stefano Verna"]
10
+ spec.email = ["s.verna@cantierecreativo.net"]
11
+ spec.summary = %q{Simplify form filling with SitePrism}
12
+ spec.description = <<-DESCRIPTION.sub(/^ +/, '')
13
+ Removes the tedium of form filling with SitePrism by allowing you
14
+ to specify a set of fields, actions and submissions rather than
15
+ procedurally calling Capybara’s DSL methods.
16
+ DESCRIPTION
17
+
18
+ spec.homepage = "https://github.com/cantierecreativo/tedium"
19
+ spec.license = "MIT"
20
+
21
+ spec.files = `git ls-files`.split($/)
22
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
23
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
24
+ spec.require_paths = ["lib"]
25
+
26
+ spec.add_dependency 'site_prism'
27
+ spec.add_dependency 'activesupport'
28
+
29
+ spec.add_development_dependency "bundler", "~> 1.3"
30
+ spec.add_development_dependency "rake"
31
+ spec.add_development_dependency "rspec"
32
+ spec.add_development_dependency "pry"
33
+ spec.add_development_dependency "actionpack"
34
+ spec.add_development_dependency "activemodel"
35
+ spec.add_development_dependency "launchy"
36
+ end
37
+
metadata ADDED
@@ -0,0 +1,216 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tedium
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Stefano Verna
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-03-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: site_prism
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: activesupport
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: actionpack
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: activemodel
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: launchy
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - '>='
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ description: "Removes the tedium of form filling with SitePrism by allowing you\n
140
+ \ to specify a set of fields, actions and submissions rather than \n procedurally
141
+ calling Capybara’s DSL methods.\n"
142
+ email:
143
+ - s.verna@cantierecreativo.net
144
+ executables: []
145
+ extensions: []
146
+ extra_rdoc_files: []
147
+ files:
148
+ - .gitignore
149
+ - .travis.yml
150
+ - Gemfile
151
+ - LICENSE.txt
152
+ - README.md
153
+ - Rakefile
154
+ - lib/tedium.rb
155
+ - lib/tedium/capybara/node_element.rb
156
+ - lib/tedium/capybara/selectors.rb
157
+ - lib/tedium/site_prism/action_dsl.rb
158
+ - lib/tedium/site_prism/form_dsl.rb
159
+ - lib/tedium/site_prism/has_record.rb
160
+ - lib/tedium/site_prism/root_element_or_page.rb
161
+ - lib/tedium/version.rb
162
+ - lib/tedium/virtual_date_element.rb
163
+ - spec/features/fill_in_checkboxes_spec.rb
164
+ - spec/features/fill_in_dates_spec.rb
165
+ - spec/features/fill_in_form_spec.rb
166
+ - spec/features/have_record_spec.rb
167
+ - spec/features/perform_actions_spec.rb
168
+ - spec/features/select_options_by_value_spec.rb
169
+ - spec/fixtures/action.html
170
+ - spec/fixtures/checkbox.html
171
+ - spec/fixtures/date.html
172
+ - spec/fixtures/followed.html
173
+ - spec/fixtures/form.html
174
+ - spec/fixtures/record.html
175
+ - spec/fixtures/select.html
176
+ - spec/spec_helper.rb
177
+ - tedium.gemspec
178
+ homepage: https://github.com/cantierecreativo/tedium
179
+ licenses:
180
+ - MIT
181
+ metadata: {}
182
+ post_install_message:
183
+ rdoc_options: []
184
+ require_paths:
185
+ - lib
186
+ required_ruby_version: !ruby/object:Gem::Requirement
187
+ requirements:
188
+ - - '>='
189
+ - !ruby/object:Gem::Version
190
+ version: '0'
191
+ required_rubygems_version: !ruby/object:Gem::Requirement
192
+ requirements:
193
+ - - '>='
194
+ - !ruby/object:Gem::Version
195
+ version: '0'
196
+ requirements: []
197
+ rubyforge_project:
198
+ rubygems_version: 2.2.2
199
+ signing_key:
200
+ specification_version: 4
201
+ summary: Simplify form filling with SitePrism
202
+ test_files:
203
+ - spec/features/fill_in_checkboxes_spec.rb
204
+ - spec/features/fill_in_dates_spec.rb
205
+ - spec/features/fill_in_form_spec.rb
206
+ - spec/features/have_record_spec.rb
207
+ - spec/features/perform_actions_spec.rb
208
+ - spec/features/select_options_by_value_spec.rb
209
+ - spec/fixtures/action.html
210
+ - spec/fixtures/checkbox.html
211
+ - spec/fixtures/date.html
212
+ - spec/fixtures/followed.html
213
+ - spec/fixtures/form.html
214
+ - spec/fixtures/record.html
215
+ - spec/fixtures/select.html
216
+ - spec/spec_helper.rb