foundation-formbuilder-rails 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/foundation/form_builder/rails/form_builder.rb +5 -1
- data/lib/foundation/form_builder/rails/version.rb +1 -1
- data/spec/spec_helper.rb +81 -0
- data/spec/views/text_field_spec.rb +27 -0
- metadata +54 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b80872c707b7f33537c3a006c46ef38ecb42b074
|
4
|
+
data.tar.gz: d3f03f6a258e9b044056e44c1437700aef613cc7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 754ddd90e664e757721be50a323060e55eca23cd91d45bbc86bb0ad892c1b4e06fc66c1eba3580fab982af8364b5177125250d67c193cc54c936c3ad66b8cdef
|
7
|
+
data.tar.gz: 4a884d45946755dbbc4f2b62e465cdfe1f61df898bd07a7fa99e99cd8d82590618e8d6aa123a57cd032ee0745aca29ad0469937abd571c5b31a695675166b3d8
|
data/README.md
CHANGED
@@ -643,7 +643,11 @@ module Foundation
|
|
643
643
|
|
644
644
|
# Return any errors for the field we are working with
|
645
645
|
def get_field_errors(method)
|
646
|
-
|
646
|
+
# If we have any errors, return them and delete them from Rails
|
647
|
+
# default object to prevent <div></div> inside <label></label>
|
648
|
+
errors = object.errors[method].clone
|
649
|
+
object.errors[method].count.times { object.errors[method].delete_at(0) }
|
650
|
+
errors
|
647
651
|
end
|
648
652
|
|
649
653
|
# Return a class attribute containing the css error class for the label
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
require 'rspec/active_model/mocks'
|
2
|
+
|
3
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
4
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
5
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause this
|
6
|
+
# file to always be loaded, without a need to explicitly require it in any files.
|
7
|
+
#
|
8
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
9
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
10
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
11
|
+
# individual file that may not need all of that loaded. Instead, make a
|
12
|
+
# separate helper file that requires this one and then use it only in the specs
|
13
|
+
# that actually need it.
|
14
|
+
#
|
15
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
16
|
+
# users commonly want.
|
17
|
+
#
|
18
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
19
|
+
RSpec.configure do |config|
|
20
|
+
# The settings below are suggested to provide a good initial experience
|
21
|
+
# with RSpec, but feel free to customize to your heart's content.
|
22
|
+
# config.include RSpec::Rails::ViewExampleGroup, type: :view, example_group: { :file_path => 'spec/views' }
|
23
|
+
|
24
|
+
# These two settings work together to allow you to limit a spec run
|
25
|
+
# to individual examples or groups you care about by tagging them with
|
26
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
27
|
+
# get run.
|
28
|
+
config.filter_run :focus
|
29
|
+
config.run_all_when_everything_filtered = true
|
30
|
+
|
31
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
32
|
+
# file, and it's useful to allow more verbose output when running an
|
33
|
+
# individual spec file.
|
34
|
+
if config.files_to_run.one?
|
35
|
+
# Use the documentation formatter for detailed output,
|
36
|
+
# unless a formatter has already been configured
|
37
|
+
# (e.g. via a command-line flag).
|
38
|
+
config.default_formatter = 'doc'
|
39
|
+
end
|
40
|
+
|
41
|
+
# Print the 10 slowest examples and example groups at the
|
42
|
+
# end of the spec run, to help surface which specs are running
|
43
|
+
# particularly slow.
|
44
|
+
config.profile_examples = 10
|
45
|
+
|
46
|
+
# Run specs in random order to surface order dependencies. If you find an
|
47
|
+
# order dependency and want to debug it, you can fix the order by providing
|
48
|
+
# the seed, which is printed after each run.
|
49
|
+
# --seed 1234
|
50
|
+
config.order = :random
|
51
|
+
|
52
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
53
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
54
|
+
# test failures related to randomization by passing the same `--seed` value
|
55
|
+
# as the one that triggered the failure.
|
56
|
+
Kernel.srand config.seed
|
57
|
+
|
58
|
+
# rspec-expectations config goes here. You can use an alternate
|
59
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
60
|
+
# assertions if you prefer.
|
61
|
+
config.expect_with :rspec do |expectations|
|
62
|
+
# Enable only the newer, non-monkey-patching expect syntax.
|
63
|
+
# For more details, see:
|
64
|
+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
65
|
+
expectations.syntax = :expect
|
66
|
+
end
|
67
|
+
|
68
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
69
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
70
|
+
config.mock_with :rspec do |mocks|
|
71
|
+
# Enable only the newer, non-monkey-patching expect syntax.
|
72
|
+
# For more details, see:
|
73
|
+
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
74
|
+
mocks.syntax = :expect
|
75
|
+
|
76
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
77
|
+
# a real object. This is generally recommended.
|
78
|
+
mocks.verify_partial_doubles = true
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# ActionView::Helpers::FormBuilder.send(:include, Foundation::FormBuilder::Rails)
|
2
|
+
|
3
|
+
RSpec.describe 'text_field', :type => :view do
|
4
|
+
|
5
|
+
# class User
|
6
|
+
# def self.all
|
7
|
+
# :value
|
8
|
+
# end
|
9
|
+
# end
|
10
|
+
|
11
|
+
it 'has something on the page' do
|
12
|
+
let(:users) {[
|
13
|
+
mock_model("User", id: 1, name: 'Ashley')
|
14
|
+
]}
|
15
|
+
stub_template 'users/_form.html.erb' => "<%= form_for @user do |f| %><%= f.text_field :name' %><% end %>"
|
16
|
+
render
|
17
|
+
rendered.should =~ /Ashley/
|
18
|
+
end
|
19
|
+
|
20
|
+
# it 'has something on the page' do
|
21
|
+
# user = double("User", id: 1, name: 'Ashley')
|
22
|
+
# allow(User).to receive(:all) { user }
|
23
|
+
# stub_template 'users/_form.html.erb' => "<%= form_for @user do |f| %><%= f.text_field :name' %><% end %>"
|
24
|
+
# render
|
25
|
+
# rendered.should =~ /Ashley/
|
26
|
+
# end
|
27
|
+
end
|
metadata
CHANGED
@@ -1,29 +1,71 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foundation-formbuilder-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ashley Bye
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 1.6.3
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 1.6.3
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rails
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 4.1.4
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 4.1.4
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec-rails
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 3.0.1
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 3.0.1
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec-activemodel-mocks
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.0.1
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.0.1
|
27
69
|
description: This is a custom FormBuilder used to display form elements generated
|
28
70
|
by the `form_for` helpers in the correct style for the Foundation 5 Framework (http://foundation.zurb.com/)
|
29
71
|
email:
|
@@ -41,6 +83,8 @@ files:
|
|
41
83
|
- lib/foundation/form_builder/rails/generators/install_generator.rb
|
42
84
|
- lib/foundation/form_builder/rails/templates/global_formbuilder.rb
|
43
85
|
- lib/foundation/form_builder/rails/version.rb
|
86
|
+
- spec/spec_helper.rb
|
87
|
+
- spec/views/text_field_spec.rb
|
44
88
|
homepage: https://github.com/ashleybye/foundation-formbuilder-rails
|
45
89
|
licenses:
|
46
90
|
- MIT
|
@@ -53,7 +97,7 @@ require_paths:
|
|
53
97
|
- lib
|
54
98
|
required_ruby_version: !ruby/object:Gem::Requirement
|
55
99
|
requirements:
|
56
|
-
- -
|
100
|
+
- - '='
|
57
101
|
- !ruby/object:Gem::Version
|
58
102
|
version: 2.1.2
|
59
103
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
@@ -67,4 +111,6 @@ rubygems_version: 2.2.2
|
|
67
111
|
signing_key:
|
68
112
|
specification_version: 4
|
69
113
|
summary: FormBuilder for the ZURB Foundation 5 CSS Framework
|
70
|
-
test_files:
|
114
|
+
test_files:
|
115
|
+
- spec/spec_helper.rb
|
116
|
+
- spec/views/text_field_spec.rb
|