noodall-form-builder 0.0.8 → 0.0.9
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.
@@ -40,7 +40,7 @@ module Noodall
|
|
40
40
|
def check_for_spam
|
41
41
|
if self.defensio_signature.blank?
|
42
42
|
status, response = self.class.defensio.post_document(self.defensio_attributes)
|
43
|
-
|
43
|
+
Rails.logger.debug "Defensio said: #{response.inspect}"
|
44
44
|
return unless status == 200
|
45
45
|
|
46
46
|
self.defensio_signature = response[:signature]
|
@@ -79,7 +79,7 @@ module Noodall
|
|
79
79
|
validate :custom_validation
|
80
80
|
|
81
81
|
def custom_validation
|
82
|
-
return if required_fields.nil?
|
82
|
+
return if required_fields.nil? || !self.new_record?
|
83
83
|
required_fields.each do |field|
|
84
84
|
self.add_error(field.underscored_name.to_sym, "can't be empty") if self.send(field.underscored_name).blank?
|
85
85
|
end
|
@@ -52,3 +52,15 @@ Feature: Form builder
|
|
52
52
|
When I visit the form builder admin page
|
53
53
|
And I click "Download Responses" on the forms row in the Form List
|
54
54
|
Then I should receive a CSV file containing all the responses to that form
|
55
|
+
|
56
|
+
@javscript @wip
|
57
|
+
Scenario: Update an existing form with responses
|
58
|
+
Given a form exists that has had many responses
|
59
|
+
When I am editing the last form
|
60
|
+
When I select "Text" from "Add a new field"
|
61
|
+
And I click "Add"
|
62
|
+
And I check "form_fields_3_required"
|
63
|
+
And I press "Update"
|
64
|
+
Then I should be on the form builder admin page
|
65
|
+
And I should see "Form was successfully updated"
|
66
|
+
|
@@ -44,11 +44,11 @@ end
|
|
44
44
|
Then /^I should see a new field with the options "([^\"]*)"$/ do |arg1|
|
45
45
|
#get index of new fieldset
|
46
46
|
index = 0
|
47
|
-
page.should have_selector('
|
47
|
+
page.should have_selector('table.content tbody tr') do |fieldset|
|
48
48
|
index += 1
|
49
49
|
end
|
50
50
|
|
51
|
-
page.should have_selector("
|
51
|
+
page.should have_selector("input#form_fields_#{index}__type")
|
52
52
|
end
|
53
53
|
|
54
54
|
Given /^a form exists that has had many responses$/ do
|
@@ -222,16 +222,26 @@ When /^I am editing the form$/ do
|
|
222
222
|
visit noodall_admin_form_path(@_form)
|
223
223
|
end
|
224
224
|
|
225
|
-
When /^I click the "([
|
226
|
-
|
225
|
+
When /^I click the "([^\"]*)" arrow next to "([^\"]*)" twice$/ do |arrow, field|
|
226
|
+
When %{I click the "#{arrow}" arrow next to "#{field}" once}
|
227
|
+
When %{I click the "#{arrow}" arrow next to "#{field}" once}
|
227
228
|
end
|
228
229
|
|
229
|
-
Then /^the "([^"]*)" field should be at position (\d+)$/ do |
|
230
|
-
|
230
|
+
Then /^the "([^"]*)" field should be at position (\d+)$/ do |field, position|
|
231
|
+
index = 0
|
232
|
+
page.should have_selector('table.content tbody tr') do |fieldset|
|
233
|
+
index = index+1
|
234
|
+
puts fieldset.find('input[value=#{field}]').inspect
|
235
|
+
return unless fieldset.find('input[value=#{field}]').nil?
|
236
|
+
end
|
237
|
+
|
238
|
+
position.to_i.should == index
|
231
239
|
end
|
232
240
|
|
233
|
-
When /^I click the "([
|
234
|
-
|
241
|
+
When /^I click the "([^\"]*)" arrow next to "([^\"]*)" once$/ do |arrow, field|
|
242
|
+
page.should have_selector('table.content tbody tr') do |fieldset|
|
243
|
+
click_link arrow if fieldset.find('input[value=#{field}]')
|
244
|
+
end
|
235
245
|
end
|
236
246
|
|
237
247
|
When /^I view the form on the website$/ do
|
@@ -245,3 +255,6 @@ Then /^I should see the fields in the order I set$/ do
|
|
245
255
|
pending # express the regexp above with the code you wish you had
|
246
256
|
end
|
247
257
|
|
258
|
+
When /^I am editing the last form$/ do
|
259
|
+
visit noodall_admin_form_path(Noodall::Form.last)
|
260
|
+
end
|
data/features/support/paths.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: noodall-form-builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 13
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 9
|
10
|
+
version: 0.0.9
|
11
11
|
platform: ruby
|
12
12
|
authors: []
|
13
13
|
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-02-03 00:00:00 +00:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|