adva-core 0.0.9 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- data/app/models/section.rb +0 -6
- data/app/views/admin/sites/index.html.rb +2 -2
- data/config/redirects.rb +2 -1
- data/lib/adva.rb +41 -0
- data/lib/adva/controller/internal_redirect.rb +2 -1
- data/lib/adva/core.rb +8 -0
- data/lib/adva/engine.rb +1 -0
- data/lib/adva/generators/app.rb +7 -8
- data/lib/adva/generators/templates/app/Gemfile +4 -4
- data/lib/adva/generators/templates/app/Thorfile +9 -0
- data/lib/adva/generators/templates/app/app_template.rb +4 -2
- data/lib/adva/generators/templates/engine/Gemfile.erb +15 -0
- data/lib/adva/testing.rb +9 -2
- data/lib/adva/testing/engine.rb +1 -0
- data/lib/adva/view/form.rb +4 -1
- data/lib/adva_core/version.rb +1 -1
- data/lib/bundler/repository.rb +117 -0
- data/lib/patches/inherited_resources.rb +4 -3
- data/lib/patches/rails/integretion_runner_respond_to.rb +1 -1
- data/lib/patches/rails/polymorphic_url_for.rb +3 -1
- data/lib/patches/rails/recognize_path_env.rb +33 -29
- data/lib/patches/rails/route_set_to_param.rb +19 -17
- data/lib/patches/rails/route_set_trailing_segment.rb +1 -1
- data/lib/patches/rails/sti_associations.rb +10 -4
- data/lib/patches/rails/translation_helper.rb +2 -1
- data/lib/patches/responders/flash_responder.rb +1 -0
- data/lib/patches/simple_form.rb +2 -2
- data/lib/testing/env.rb +19 -13
- data/lib/testing/factories.rb +5 -1
- data/lib/testing/paths.rb +4 -4
- data/lib/testing/selectors.rb +72 -0
- data/lib/testing/step_definitions/capybara_steps.rb +211 -0
- data/lib/testing/step_definitions/common_steps.rb +87 -98
- data/lib/testing/step_definitions/debug_steps.rb +11 -4
- data/lib/testing/step_definitions/email_steps.rb +195 -0
- data/lib/testing/step_definitions/menu_steps.rb +7 -2
- data/lib/testing/step_definitions/more_web_steps.rb +4 -0
- data/lib/testing/step_definitions/pickle_steps.rb +104 -0
- data/lib/testing/step_definitions/transforms.rb +10 -1
- data/lib/testing/support/pickle.rb +24 -0
- data/public/javascripts/adva-core/jquery/jquery.table_tree.js +5 -1
- metadata +340 -305
- data/lib/patches/rails/asset_expansion_multiple_registrations.rb +0 -21
- data/lib/patches/rails/template_resolver_caching.rb +0 -9
- data/lib/patches/webrat/links-data-method.rb +0 -15
- data/lib/patches/webrat/logger.rb +0 -14
- data/lib/patches/webrat/upload_file.rb +0 -23
- data/lib/patches/webrat/within_xpath.rb +0 -13
- data/lib/testing/step_definitions/webrat_steps.rb +0 -284
- data/lib/testing/step_definitions/within_steps.rb +0 -16
@@ -1,21 +0,0 @@
|
|
1
|
-
# Allow to register javascript/stylesheet_expansions to existing symbols
|
2
|
-
#
|
3
|
-
# see https://rails.lighthouseapp.com/projects/8994/tickets/1975-allow-to-register-javascriptstylesheet_expansions-to-existing-symbols
|
4
|
-
|
5
|
-
require 'action_view/helpers/asset_tag_helper'
|
6
|
-
|
7
|
-
module ActionView::Helpers::AssetTagHelper
|
8
|
-
def self.register_javascript_expansion(expansions)
|
9
|
-
expansions.each do |key, values|
|
10
|
-
@@javascript_expansions[key] ||= []
|
11
|
-
@@javascript_expansions[key] += Array(values)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def self.register_stylesheet_expansion(expansions)
|
16
|
-
expansions.each do |key, values|
|
17
|
-
@@stylesheet_expansions[key] ||= []
|
18
|
-
@@stylesheet_expansions[key] += Array(values)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,9 +0,0 @@
|
|
1
|
-
# Gem.patching('rails', '3.0.0.rc') do
|
2
|
-
# require 'action_view/template/resolver'
|
3
|
-
# ActionView::Resolver.class_eval do
|
4
|
-
# def caching?
|
5
|
-
# # @caching ||= !defined?(Rails.application) || Rails.application.config.cache_classes
|
6
|
-
# @caching ||= !defined?(Rails.application) || Rails.application.nil? || Rails.application.config.cache_classes
|
7
|
-
# end
|
8
|
-
# end
|
9
|
-
# end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'gem-patching'
|
2
|
-
|
3
|
-
Gem.patching('webrat', '0.7.2') do
|
4
|
-
Webrat::Link.class_eval do
|
5
|
-
def http_method
|
6
|
-
if !@element["data-method"].blank?
|
7
|
-
@element["data-method"]
|
8
|
-
elsif !onclick.blank? && onclick.include?("f.submit()")
|
9
|
-
http_method_from_js_form
|
10
|
-
else
|
11
|
-
:get
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end if defined?(Webrat)
|
@@ -1,14 +0,0 @@
|
|
1
|
-
require 'gem-patching'
|
2
|
-
|
3
|
-
Gem.patching('webrat', '0.7.2') do
|
4
|
-
Webrat::Logging.class_eval do
|
5
|
-
def logger
|
6
|
-
case Webrat.configuration.mode
|
7
|
-
when :rails
|
8
|
-
defined?(Rails) ? Rails.logger : nil
|
9
|
-
else
|
10
|
-
super
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end if defined?(Webrat)
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'gem-patching'
|
2
|
-
|
3
|
-
Gem.patching('webrat', '0.7.2') do
|
4
|
-
Webrat::FileField.class_eval do
|
5
|
-
include ActionDispatch::TestProcess
|
6
|
-
|
7
|
-
def test_uploaded_file
|
8
|
-
return "" if @original_value.blank?
|
9
|
-
|
10
|
-
case Webrat.configuration.mode
|
11
|
-
when :rails
|
12
|
-
if content_type
|
13
|
-
# Rails 3 does not have an ActionController::TestUploadedFile anymore
|
14
|
-
Rack::Test::UploadedFile.new(@original_value, content_type)
|
15
|
-
else
|
16
|
-
Rack::Test::UploadedFile.new(@original_value)
|
17
|
-
end
|
18
|
-
when :rack, :merb
|
19
|
-
Rack::Test::UploadedFile.new(@original_value, content_type)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end if defined?(Webrat)
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# see https://webrat.lighthouseapp.com/projects/10503/tickets/153-within-should-support-xpath
|
2
|
-
|
3
|
-
Gem.patching('webrat', '0.7.2') do
|
4
|
-
Webrat::Scope.class_eval do
|
5
|
-
def scoped_dom
|
6
|
-
if @selector =~ /^\.?\/\/?/
|
7
|
-
@scope.dom.xpath(@selector).first
|
8
|
-
else
|
9
|
-
@scope.dom.css(@selector).first
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end if defined?(Webrat)
|
@@ -1,284 +0,0 @@
|
|
1
|
-
require 'uri'
|
2
|
-
|
3
|
-
Given /^(?:|I )am on (.+)$/ do |page|
|
4
|
-
visit path_to(page)
|
5
|
-
follow_redirect! if redirect?
|
6
|
-
end
|
7
|
-
|
8
|
-
When /^(?:|I )go to (.+)$/ do |page|
|
9
|
-
visit path_to(page)
|
10
|
-
follow_redirect! if redirect?
|
11
|
-
end
|
12
|
-
|
13
|
-
When /^(?:|I )press "([^\"]*)"$/ do |button|
|
14
|
-
click_button(button)
|
15
|
-
end
|
16
|
-
|
17
|
-
When /^(?:|I )follow "([^\"]*)"$/ do |link|
|
18
|
-
click_link(link)
|
19
|
-
end
|
20
|
-
|
21
|
-
When /^(?:|I )follow "([^\"]*)" within "([^\"]*)"$/ do |link, parent|
|
22
|
-
click_link_within(parent, link)
|
23
|
-
end
|
24
|
-
|
25
|
-
When /^I follow "([^"]*)" within the "([^"]*)" row$/ do |link, text|
|
26
|
-
row = webrat.dom.xpath("//tr//*[contains(text(), '#{text}')]/ancestor::tr").first
|
27
|
-
assert row, "could not find a row #{text.inspect}"
|
28
|
-
click_link_within(row.css_path, link)
|
29
|
-
end
|
30
|
-
|
31
|
-
When /^(?:|I )fill in "([^\"]*)" with "([^\"]*)"$/ do |field, value|
|
32
|
-
fill_in(field, :with => value)
|
33
|
-
end
|
34
|
-
|
35
|
-
When /^(?:|I )fill in "([^\"]*)" for "([^\"]*)"$/ do |value, field|
|
36
|
-
fill_in(field, :with => value)
|
37
|
-
end
|
38
|
-
|
39
|
-
# Use this to fill in an entire form with data from a table. Example:
|
40
|
-
#
|
41
|
-
# When I fill in the following:
|
42
|
-
# | Account Number | 5002 |
|
43
|
-
# | Expiry date | 2009-11-01 |
|
44
|
-
# | Note | Nice guy |
|
45
|
-
# | Wants Email? | |
|
46
|
-
#
|
47
|
-
When /^(?:|I )fill in the following:?$/ do |fields|
|
48
|
-
fields.rows_hash.each do |name, value|
|
49
|
-
step = case webrat.field_labeled(name)
|
50
|
-
when Webrat::TextField, Webrat::TextareaField, Webrat::PasswordField
|
51
|
-
%(I fill in "#{name}" with "#{value}")
|
52
|
-
# when Webrat::RadioField
|
53
|
-
# %(I choose "#{value}")
|
54
|
-
# when Webrat::CheckboxField
|
55
|
-
# %(I check "#{value}")
|
56
|
-
when Webrat::SelectField, Webrat::MultiSelectField
|
57
|
-
%(I select "#{value}" from "#{name}")
|
58
|
-
when Webrat::FileField
|
59
|
-
%(I attach "#{value}" to "#{name}")
|
60
|
-
end
|
61
|
-
When step
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
When /^(?:|I )select "([^\"]*)" from "([^\"]*)"$/ do |value, field|
|
66
|
-
select(value, :from => field)
|
67
|
-
end
|
68
|
-
|
69
|
-
# Use this step in conjunction with Rail's datetime_select helper. For example:
|
70
|
-
# When I select "December 25, 2008 10:00" as the date and time
|
71
|
-
When /^(?:|I )select "([^\"]*)" as the date and time$/ do |time|
|
72
|
-
select_datetime(time)
|
73
|
-
end
|
74
|
-
|
75
|
-
# Use this step when using multiple datetime_select helpers on a page or
|
76
|
-
# you want to specify which datetime to select. Given the following view:
|
77
|
-
# <%= f.label :preferred %><br />
|
78
|
-
# <%= f.datetime_select :preferred %>
|
79
|
-
# <%= f.label :alternative %><br />
|
80
|
-
# <%= f.datetime_select :alternative %>
|
81
|
-
# The following steps would fill out the form:
|
82
|
-
# When I select "November 23, 2004 11:20" as the "Preferred" date and time
|
83
|
-
# And I select "November 25, 2004 10:30" as the "Alternative" date and time
|
84
|
-
When /^(?:|I )select "([^\"]*)" as the "([^\"]*)" date and time$/ do |datetime, datetime_label|
|
85
|
-
select_datetime(datetime, :from => datetime_label)
|
86
|
-
end
|
87
|
-
|
88
|
-
# Use this step in conjunction with Rail's time_select helper. For example:
|
89
|
-
# When I select "2:20PM" as the time
|
90
|
-
# Note: Rail's default time helper provides 24-hour time-- not 12 hour time. Webrat
|
91
|
-
# will convert the 2:20PM to 14:20 and then select it.
|
92
|
-
When /^(?:|I )select "([^\"]*)" as the time$/ do |time|
|
93
|
-
select_time(time)
|
94
|
-
end
|
95
|
-
|
96
|
-
# Use this step when using multiple time_select helpers on a page or you want to
|
97
|
-
# specify the name of the time on the form. For example:
|
98
|
-
# When I select "7:30AM" as the "Gym" time
|
99
|
-
When /^(?:|I )select "([^\"]*)" as the "([^\"]*)" time$/ do |time, time_label|
|
100
|
-
select_time(time, :from => time_label)
|
101
|
-
end
|
102
|
-
|
103
|
-
# Use this step in conjunction with Rail's date_select helper. For example:
|
104
|
-
# When I select "February 20, 1981" as the date
|
105
|
-
When /^(?:|I )select "([^\"]*)" as the date$/ do |date|
|
106
|
-
select_date(date)
|
107
|
-
end
|
108
|
-
|
109
|
-
# Use this step when using multiple date_select helpers on one page or
|
110
|
-
# you want to specify the name of the date on the form. For example:
|
111
|
-
# When I select "April 26, 1982" as the "Date of Birth" date
|
112
|
-
When /^(?:|I )select "([^\"]*)" as the "([^\"]*)" date$/ do |date, date_label|
|
113
|
-
select_date(date, :from => date_label)
|
114
|
-
end
|
115
|
-
|
116
|
-
When /^(?:|I )check "([^\"]*)"$/ do |field|
|
117
|
-
check(field)
|
118
|
-
end
|
119
|
-
|
120
|
-
When /^(?:|I )uncheck "([^\"]*)"$/ do |field|
|
121
|
-
uncheck(field)
|
122
|
-
end
|
123
|
-
|
124
|
-
When /^(?:|I )choose "([^\"]*)"$/ do |field|
|
125
|
-
choose(field)
|
126
|
-
end
|
127
|
-
|
128
|
-
# Adds support for validates_attachment_content_type. Without the mime-type getting
|
129
|
-
# passed to attach_file() you will get a "Photo file is not one of the allowed file types."
|
130
|
-
# error message
|
131
|
-
When /^(?:|I )attach the file "([^\"]*)" to "([^\"]*)"$/ do |path, field|
|
132
|
-
type = path.split(".")[1]
|
133
|
-
|
134
|
-
case type
|
135
|
-
when "jpg"
|
136
|
-
type = "image/jpg"
|
137
|
-
when "jpeg"
|
138
|
-
type = "image/jpeg"
|
139
|
-
when "png"
|
140
|
-
type = "image/png"
|
141
|
-
when "gif"
|
142
|
-
type = "image/gif"
|
143
|
-
end
|
144
|
-
|
145
|
-
attach_file(field, path, type)
|
146
|
-
end
|
147
|
-
|
148
|
-
Then /^(?:|I )should see "([^\"]*)"$/ do |text|
|
149
|
-
if defined?(Spec::Rails::Matchers)
|
150
|
-
response.should contain(text)
|
151
|
-
else
|
152
|
-
assert_contain text
|
153
|
-
end
|
154
|
-
end
|
155
|
-
|
156
|
-
Then /^(?:|I )should see "([^\"]*)" within "([^\"]*)"$/ do |text, selector|
|
157
|
-
within(selector) do |content|
|
158
|
-
if defined?(Spec::Rails::Matchers)
|
159
|
-
content.should contain(text)
|
160
|
-
else
|
161
|
-
hc = Webrat::Matchers::HasContent.new(text)
|
162
|
-
assert hc.matches?(content), hc.failure_message
|
163
|
-
end
|
164
|
-
end
|
165
|
-
end
|
166
|
-
|
167
|
-
Then /^(?:|I )should see \/([^\/]*)\/$/ do |regexp|
|
168
|
-
regexp = Regexp.new(regexp)
|
169
|
-
if defined?(Spec::Rails::Matchers)
|
170
|
-
response.should contain(regexp)
|
171
|
-
else
|
172
|
-
assert_match(regexp, response_body)
|
173
|
-
end
|
174
|
-
end
|
175
|
-
|
176
|
-
Then /^(?:|I )should see \/([^\/]*)\/ within "([^\"]*)"$/ do |regexp, selector|
|
177
|
-
within(selector) do |content|
|
178
|
-
regexp = Regexp.new(regexp)
|
179
|
-
if defined?(Spec::Rails::Matchers)
|
180
|
-
content.should contain(regexp)
|
181
|
-
else
|
182
|
-
assert_match(regexp, content)
|
183
|
-
end
|
184
|
-
end
|
185
|
-
end
|
186
|
-
|
187
|
-
Then /^(?:|I )should not see "([^\"]*)"$/ do |text|
|
188
|
-
if defined?(Spec::Rails::Matchers)
|
189
|
-
response.should_not contain(text)
|
190
|
-
else
|
191
|
-
assert_not_contain(text)
|
192
|
-
end
|
193
|
-
end
|
194
|
-
|
195
|
-
Then /^(?:|I )should not see "([^\"]*)" within "([^\"]*)"$/ do |text, selector|
|
196
|
-
within(selector) do |content|
|
197
|
-
if defined?(Spec::Rails::Matchers)
|
198
|
-
content.should_not contain(text)
|
199
|
-
else
|
200
|
-
hc = Webrat::Matchers::HasContent.new(text)
|
201
|
-
assert !hc.matches?(content), hc.negative_failure_message
|
202
|
-
end
|
203
|
-
end
|
204
|
-
end
|
205
|
-
|
206
|
-
Then /^(?:|I )should not see \/([^\/]*)\/$/ do |regexp|
|
207
|
-
regexp = Regexp.new(regexp)
|
208
|
-
if defined?(Spec::Rails::Matchers)
|
209
|
-
response.should_not contain(regexp)
|
210
|
-
else
|
211
|
-
assert_not_contain(regexp)
|
212
|
-
end
|
213
|
-
end
|
214
|
-
|
215
|
-
Then /^(?:|I )should not see \/([^\/]*)\/ within "([^\"]*)"$/ do |regexp, selector|
|
216
|
-
within(selector) do |content|
|
217
|
-
regexp = Regexp.new(regexp)
|
218
|
-
if defined?(Spec::Rails::Matchers)
|
219
|
-
content.should_not contain(regexp)
|
220
|
-
else
|
221
|
-
assert_no_match(regexp, content)
|
222
|
-
end
|
223
|
-
end
|
224
|
-
end
|
225
|
-
|
226
|
-
Then /^the "([^\"]*)" field should contain "([^\"]*)"$/ do |field, value|
|
227
|
-
if defined?(Spec::Rails::Matchers)
|
228
|
-
field_labeled(field).value.should =~ /#{value}/
|
229
|
-
else
|
230
|
-
assert_match(/#{value}/, field_labeled(field).value)
|
231
|
-
end
|
232
|
-
end
|
233
|
-
|
234
|
-
Then /^the "([^\"]*)" field should not contain "([^\"]*)"$/ do |field, value|
|
235
|
-
if defined?(Spec::Rails::Matchers)
|
236
|
-
field_labeled(field).value.should_not =~ /#{value}/
|
237
|
-
else
|
238
|
-
assert_no_match(/#{value}/, field_labeled(field).value)
|
239
|
-
end
|
240
|
-
end
|
241
|
-
|
242
|
-
Then /^the "([^\"]*)" (?:checkbox|radio button) should be checked$/ do |label|
|
243
|
-
if defined?(Spec::Rails::Matchers)
|
244
|
-
field_labeled(label).should be_checked
|
245
|
-
else
|
246
|
-
assert field_labeled(label).checked?
|
247
|
-
end
|
248
|
-
end
|
249
|
-
|
250
|
-
Then /^the "([^\"]*)" (?:checkbox|radio button) should not be checked$/ do |label|
|
251
|
-
if defined?(Spec::Rails::Matchers)
|
252
|
-
field_labeled(label).should_not be_checked
|
253
|
-
else
|
254
|
-
assert !field_labeled(label).checked?
|
255
|
-
end
|
256
|
-
end
|
257
|
-
|
258
|
-
Then /^(?:|I )should be on (.+)$/ do |page|
|
259
|
-
if defined?(Spec::Rails::Matchers)
|
260
|
-
URI.parse(current_url).path.should == path_to(page)
|
261
|
-
else
|
262
|
-
assert_equal path_to(page), URI.parse(current_url).path
|
263
|
-
end
|
264
|
-
end
|
265
|
-
|
266
|
-
Then /^(?:|I )should not be on (.+)$/ do |page|
|
267
|
-
if defined?(Spec::Rails::Matchers)
|
268
|
-
URI.parse(current_url).path.should != path_to(page)
|
269
|
-
else
|
270
|
-
assert_not_equal path_to(page), URI.parse(current_url).path
|
271
|
-
end
|
272
|
-
end
|
273
|
-
|
274
|
-
Then /^(?:|I )should have the following query string:$/ do |expected_pairs|
|
275
|
-
actual_params = CGI.parse(URI.parse(current_url).query)
|
276
|
-
expected_params = Hash[expected_pairs.rows_hash.map{|k,v| [k,[v]]}]
|
277
|
-
|
278
|
-
if defined?(Spec::Rails::Matchers)
|
279
|
-
actual_params.should == expected_params
|
280
|
-
else
|
281
|
-
assert_equal expected_params, actual_params
|
282
|
-
end
|
283
|
-
end
|
284
|
-
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# http://mislav.uniqpath.com/2010/09/cuking-it-right/
|
2
|
-
|
3
|
-
# Then I should see "foo" in the top menu
|
4
|
-
scopes = {
|
5
|
-
'the title' => 'h1, h2, h3',
|
6
|
-
'the top menu' => '#top',
|
7
|
-
'the action menu' => '#actions',
|
8
|
-
'the sidebar' => '#sidebar'
|
9
|
-
}
|
10
|
-
scopes.each do |context, selector|
|
11
|
-
Then /^(.+) (?:with)?in #{context}$/ do |step|
|
12
|
-
within(selector) do
|
13
|
-
Then step
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|