noodall-form-builder 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -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('#form-fields fieldset') do |fieldset|
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("fieldset#field-#{index}")
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 "([^"]*)" arrow next to "([^"]*)" twice$/ do |arg1, arg2|
226
- pending # express the regexp above with the code you wish you had
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 |arg1, arg2|
230
- pending # express the regexp above with the code you wish you had
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 "([^"]*)" arrow next to "([^"]*)" once$/ do |arg1, arg2|
234
- pending # express the regexp above with the code you wish you had
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
@@ -38,7 +38,8 @@ module NavigationHelpers
38
38
  node_path(node)
39
39
  when /^that page$/
40
40
  node_path(@_content)
41
-
41
+ when /^the form builder admin page$/
42
+ noodall_admin_forms_path
42
43
  when /^the article list page$/
43
44
  node_path(@_content)
44
45
  when /content titled "([^\"]*)"$/
@@ -1,5 +1,5 @@
1
1
  module Noodall
2
2
  module FormBuilder
3
- VERSION = "0.0.8"
3
+ VERSION = "0.0.9"
4
4
  end
5
5
  end
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: 15
4
+ hash: 13
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 8
10
- version: 0.0.8
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-01-31 00:00:00 +00:00
18
+ date: 2011-02-03 00:00:00 +00:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency