beespew 0.2.0 → 1.0.0
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 +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +3 -2
- data/README.md +4 -0
- data/beespew.gemspec +4 -1
- data/lib/beespew/form_builder.rb +1 -1
- data/lib/beespew/version.rb +1 -1
- data/spec/dummy/config/environments/test.rb +1 -1
- data/spec/{form_helper_spec.rb → form_builder_spec.rb} +13 -6
- data/spec/spec_helper.rb +3 -0
- metadata +35 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e790d9c6c7c3bd666019fbb7ceb7918aea4585ce
|
4
|
+
data.tar.gz: 702e9ff36fef464e219826c862fd2bcce5f4512a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 326e7894d73c3fb3adc14c8afd91895d10d6a243b2b0d54d0fa94154846022de5c3b0958dbce3568e6b98f17909724ee512e50be6ae4ea3cc89f4f808f78900a
|
7
|
+
data.tar.gz: a0c94a8d78d02adafef52268f2a5dd1e244173eaf5be83d3304999063f4d5a13cf3005d76d256075091a09273127bbf31f41b3e1fb70ecdd120562fc61444400
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.2.3
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -94,6 +94,10 @@ strong parameters will unwillingly disable your spam protection.
|
|
94
94
|
|
95
95
|
### HEAD (not released yet)
|
96
96
|
|
97
|
+
### 1.0.0
|
98
|
+
* Require Ruby >= 2.1
|
99
|
+
* Set honeypot field with a [tabindex of -1](https://www.w3.org/TR/html5/editing.html#sequential-focus-navigation-and-the-tabindex-attribute)
|
100
|
+
|
97
101
|
### 0.2.0
|
98
102
|
* Add Beespew form builder with `honeypot` field
|
99
103
|
* Make Beespew.attribute configurable ([#1](https://github.com/Absolventa/beespew/issues/1))
|
data/beespew.gemspec
CHANGED
@@ -14,6 +14,8 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.description = "Beespew is a naive spam protection plugin for rails using a honeypot"
|
15
15
|
s.license = "MIT"
|
16
16
|
|
17
|
+
s.required_ruby_version = '>= 2.1'
|
18
|
+
|
17
19
|
s.files = `git ls-files`.split($/)
|
18
20
|
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
21
|
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
@@ -22,5 +24,6 @@ Gem::Specification.new do |s|
|
|
22
24
|
s.add_dependency "rails", ">= 4.0", '<= 5.0'
|
23
25
|
|
24
26
|
s.add_development_dependency "sqlite3"
|
25
|
-
s.add_development_dependency "rspec-rails"
|
27
|
+
s.add_development_dependency "rspec-rails", '>= 3.0.0'
|
28
|
+
s.add_development_dependency "rspec-html-matchers"
|
26
29
|
end
|
data/lib/beespew/form_builder.rb
CHANGED
@@ -2,7 +2,7 @@ module Beespew
|
|
2
2
|
class FormBuilder < ActionView::Helpers::FormBuilder
|
3
3
|
|
4
4
|
def beespew_field(options = {})
|
5
|
-
options = { class: 'beespew', placeholder: placeholder }.
|
5
|
+
options = { class: 'beespew', placeholder: placeholder, tabindex: -1 }.
|
6
6
|
merge(options.with_indifferent_access)
|
7
7
|
text_field Beespew.attribute, options
|
8
8
|
end
|
data/lib/beespew/version.rb
CHANGED
@@ -13,7 +13,7 @@ Rails.application.configure do
|
|
13
13
|
config.eager_load = false
|
14
14
|
|
15
15
|
# Configure static asset server for tests with Cache-Control for performance.
|
16
|
-
config.
|
16
|
+
config.serve_static_files = true
|
17
17
|
config.static_cache_control = 'public, max-age=3600'
|
18
18
|
|
19
19
|
# Show full error reports and disable caching.
|
@@ -7,23 +7,20 @@ describe Beespew::FormBuilder do
|
|
7
7
|
it 'returns a text field with a default css class' do
|
8
8
|
input = subject.beespew_field
|
9
9
|
|
10
|
-
|
11
|
-
expect(input).to start_with expected
|
10
|
+
expect(input).to have_tag('input', with: { class: 'beespew', name: 'hive[beespew]' })
|
12
11
|
end
|
13
12
|
|
14
13
|
it 'returns a text field with a custom css class' do
|
15
14
|
input = subject.beespew_field class: 'foobar'
|
16
15
|
|
17
|
-
|
18
|
-
expect(input).to start_with expected
|
16
|
+
expect(input).to have_tag('input', with: { class: 'foobar' })
|
19
17
|
end
|
20
18
|
|
21
19
|
it 'obeyes the configured Beespew.attribute' do
|
22
20
|
allow(Beespew).to receive(:attribute).and_return('sweetsformysweet')
|
23
21
|
input = subject.beespew_field
|
24
22
|
|
25
|
-
|
26
|
-
expect(input).to start_with expected
|
23
|
+
expect(input).to have_tag('input', with: { id: 'hive_sweetsformysweet', name: 'hive[sweetsformysweet]' })
|
27
24
|
end
|
28
25
|
|
29
26
|
context 'with placeholder' do
|
@@ -48,6 +45,16 @@ describe Beespew::FormBuilder do
|
|
48
45
|
end
|
49
46
|
end
|
50
47
|
|
48
|
+
context 'with tabindex' do
|
49
|
+
it 'defaults to -1' do
|
50
|
+
expect(subject.beespew_field).to match "tabindex=\"-1\""
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'allows overriding the tabindex' do
|
54
|
+
expect(subject.beespew_field(tabindex: 999)).to match "tabindex=\"999\""
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
51
58
|
end
|
52
59
|
|
53
60
|
describe '#honeypot' do
|
data/spec/spec_helper.rb
CHANGED
@@ -2,11 +2,14 @@ ENV['RAILS_ENV'] ||= 'test'
|
|
2
2
|
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
3
3
|
|
4
4
|
require 'rspec/rails'
|
5
|
+
require 'rspec-html-matchers'
|
5
6
|
|
6
7
|
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
7
8
|
RSpec.configure do |config|
|
8
9
|
config.order = :random
|
9
10
|
|
11
|
+
config.include RSpecHtmlMatchers
|
12
|
+
|
10
13
|
# Seed global randomization in this process using the `--seed` CLI option.
|
11
14
|
# Setting this allows you to use `--seed` to deterministically reproduce
|
12
15
|
# test failures related to randomization by passing the same `--seed` value
|
metadata
CHANGED
@@ -1,61 +1,75 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beespew
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carsten Zimmermann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '4.0'
|
20
|
-
- - <=
|
20
|
+
- - "<="
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: '5.0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '4.0'
|
30
|
-
- - <=
|
30
|
+
- - "<="
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '5.0'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: sqlite3
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- -
|
37
|
+
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: '0'
|
40
40
|
type: :development
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
|
-
- -
|
44
|
+
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '0'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rspec-rails
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
|
-
- -
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 3.0.0
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 3.0.0
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: rspec-html-matchers
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
52
66
|
- !ruby/object:Gem::Version
|
53
67
|
version: '0'
|
54
68
|
type: :development
|
55
69
|
prerelease: false
|
56
70
|
version_requirements: !ruby/object:Gem::Requirement
|
57
71
|
requirements:
|
58
|
-
- -
|
72
|
+
- - ">="
|
59
73
|
- !ruby/object:Gem::Version
|
60
74
|
version: '0'
|
61
75
|
description: Beespew is a naive spam protection plugin for rails using a honeypot
|
@@ -65,11 +79,11 @@ executables: []
|
|
65
79
|
extensions: []
|
66
80
|
extra_rdoc_files: []
|
67
81
|
files:
|
68
|
-
- .gitignore
|
69
|
-
- .rspec
|
70
|
-
- .ruby-gemset
|
71
|
-
- .ruby-version
|
72
|
-
- .travis.yml
|
82
|
+
- ".gitignore"
|
83
|
+
- ".rspec"
|
84
|
+
- ".ruby-gemset"
|
85
|
+
- ".ruby-version"
|
86
|
+
- ".travis.yml"
|
73
87
|
- Gemfile
|
74
88
|
- MIT-LICENSE
|
75
89
|
- README.md
|
@@ -128,7 +142,7 @@ files:
|
|
128
142
|
- spec/dummy/public/422.html
|
129
143
|
- spec/dummy/public/500.html
|
130
144
|
- spec/dummy/public/favicon.ico
|
131
|
-
- spec/
|
145
|
+
- spec/form_builder_spec.rb
|
132
146
|
- spec/model_spec.rb
|
133
147
|
- spec/spec_helper.rb
|
134
148
|
homepage: https://github.com/Absolventa/beespew
|
@@ -141,17 +155,17 @@ require_paths:
|
|
141
155
|
- lib
|
142
156
|
required_ruby_version: !ruby/object:Gem::Requirement
|
143
157
|
requirements:
|
144
|
-
- -
|
158
|
+
- - ">="
|
145
159
|
- !ruby/object:Gem::Version
|
146
|
-
version: '
|
160
|
+
version: '2.1'
|
147
161
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
148
162
|
requirements:
|
149
|
-
- -
|
163
|
+
- - ">="
|
150
164
|
- !ruby/object:Gem::Version
|
151
165
|
version: '0'
|
152
166
|
requirements: []
|
153
167
|
rubyforge_project:
|
154
|
-
rubygems_version: 2.
|
168
|
+
rubygems_version: 2.4.5.1
|
155
169
|
signing_key:
|
156
170
|
specification_version: 4
|
157
171
|
summary: Beespew is a naive spam protection plugin for rails using a honeypot
|
@@ -202,6 +216,6 @@ test_files:
|
|
202
216
|
- spec/dummy/public/422.html
|
203
217
|
- spec/dummy/public/500.html
|
204
218
|
- spec/dummy/public/favicon.ico
|
205
|
-
- spec/
|
219
|
+
- spec/form_builder_spec.rb
|
206
220
|
- spec/model_spec.rb
|
207
221
|
- spec/spec_helper.rb
|