record_collection 0.9.2 → 0.10.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/.travis.yml +1 -1
- data/CHANGELOG.md +8 -1
- data/Gemfile +1 -0
- data/lib/record_collection/base.rb +11 -2
- data/lib/record_collection/rails/form_builder.rb +7 -7
- data/lib/record_collection/rails/form_helper.rb +5 -0
- data/lib/record_collection/version.rb +1 -1
- data/record_collection.gemspec +2 -0
- data/spec/base/behaviour_spec.rb +0 -51
- data/spec/dummy/app/models/project/collection.rb +1 -0
- data/spec/dummy/app/views/projects/collection_edit.html.slim +3 -2
- data/spec/dummy/db/migrate/20151225113902_add_start_date_to_projects.rb +5 -0
- data/spec/dummy/db/schema.rb +2 -1
- data/spec/features/optional_date_field_all_nil_spec.rb +10 -0
- data/spec/rails/form_builder_spec.rb +24 -21
- data/spec/record_selection/base_spec.rb +80 -36
- data/spec/spec_helper.rb +1 -0
- metadata +34 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e654f6b5c7b1ed264fc6ef308f6796cd2f2d2d73
|
4
|
+
data.tar.gz: 34ab6394a4d3f8f48b9f586e9affbbe6857f6f06
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9857ed54b6d7fb8afa92a60214288914cb480446cc377ad4666237103dca381b4e8082244475ac43210e167c3079be55f2d4bda5a8646050e05f45e2ac9cafc
|
7
|
+
data.tar.gz: fa18d0aa9fe61206460f21e1aec97076231922fd292abaf50c4e801c019e136c66c505f0ea3dddfdb068297e3f41a3a46c74f0ded91eb6c69ab2cc6c21f28f4b
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
CHANGELOG
|
2
2
|
=========
|
3
3
|
|
4
|
+
2015-12-25 - v0.10.0
|
5
|
+
--------------------
|
6
|
+
### Changed
|
7
|
+
* renamed uniform_collection_attribute to uniform_collection_value
|
8
|
+
|
9
|
+
### Fixed
|
10
|
+
* Make optionals active when all the values in the collection are nil
|
11
|
+
|
4
12
|
2015-12-15 - v0.9.2
|
5
13
|
-------------------
|
6
14
|
|
@@ -35,4 +43,3 @@ Employee::Collection.where(a: 1).where.not(b: 3)
|
|
35
43
|
|
36
44
|
### Added
|
37
45
|
* Smarter find on collection object
|
38
|
-
|
data/Gemfile
CHANGED
@@ -155,7 +155,7 @@ module RecordCollection
|
|
155
155
|
# value in the collection, but the values of the collection are a result of
|
156
156
|
# an invalid form submission. In this case you want to keep the values of the
|
157
157
|
# submitted form as collection values, not the current uniform attribute.
|
158
|
-
def
|
158
|
+
def uniform_collection_value(attr, options = {})
|
159
159
|
attribute_spec = self.class.attributes[attr]
|
160
160
|
raise "Attribute #{attr} not defined on collection" unless attribute_spec
|
161
161
|
if attribute_spec[:type] == Boolean
|
@@ -166,10 +166,19 @@ module RecordCollection
|
|
166
166
|
results = map{|r| r.public_send(attr) }.uniq
|
167
167
|
end
|
168
168
|
return nil unless results.size == 1 # one value found
|
169
|
-
|
169
|
+
self[attr] = results.first if options[:set_if_nil] and self[attr].nil?
|
170
170
|
results.first
|
171
171
|
end
|
172
172
|
|
173
|
+
def mixed_values_for_attribute?(attr, options = {})
|
174
|
+
attribute_spec = self.class.attributes[attr]
|
175
|
+
raise "Attribute #{attr} not defined on collection" unless attribute_spec
|
176
|
+
collection_values = self.map{|r| r[attr] }.uniq
|
177
|
+
return true if collection_values.size > 1
|
178
|
+
self[attr] = collection_values.first if collection_values.any? and options[:set_if_nil]
|
179
|
+
false
|
180
|
+
end
|
181
|
+
|
173
182
|
def ids
|
174
183
|
@ids ||= map{|record| record.try(:id) }.compact
|
175
184
|
end
|
@@ -11,7 +11,7 @@ ActionView::Helpers::FormBuilder.class_eval do
|
|
11
11
|
def collection_ids
|
12
12
|
@collection_ids_already_added = true
|
13
13
|
return "".html_safe unless object.respond_to?(:map)
|
14
|
-
|
14
|
+
@template.hidden_field_tag('ids', object.map(&:id).join(RecordCollection.ids_separator), id: nil).html_safe
|
15
15
|
end
|
16
16
|
|
17
17
|
def optional_boolean(attr, options = {})
|
@@ -58,15 +58,15 @@ ActionView::Helpers::FormBuilder.class_eval do
|
|
58
58
|
attrs
|
59
59
|
end
|
60
60
|
|
61
|
+
# The attribute is active if it is defined on the collection
|
62
|
+
# (this can be the case when setting it nil and a validation of another attribute failed)
|
63
|
+
# or the collection has no mixed values of that attribute
|
61
64
|
def active_class(attr)
|
62
65
|
active = false # default
|
63
|
-
if object.respond_to?(:
|
64
|
-
|
65
|
-
# The field is active when the uniform value is not nil,
|
66
|
-
# aka has a value
|
67
|
-
active = !uniform_value.nil?
|
66
|
+
if object.respond_to?(:mixed_values_for_attribute?)
|
67
|
+
active = !object.mixed_values_for_attribute?(attr, set_if_nil: true)
|
68
68
|
end
|
69
|
-
active = true unless object
|
69
|
+
active = true unless object[attr].nil? # Activate if collection or record attribute is not nil
|
70
70
|
active ? 'active' : 'inactive'
|
71
71
|
end
|
72
72
|
end
|
@@ -1,6 +1,11 @@
|
|
1
1
|
ActionView::Helpers::FormHelper.class_eval do
|
2
2
|
private
|
3
3
|
|
4
|
+
# This trick makes it possible to use the record_collection object
|
5
|
+
# directly in to forms and point to the proper controller action
|
6
|
+
# like:
|
7
|
+
# = form_for @collection do |f|
|
8
|
+
# = f.text_field :name
|
4
9
|
alias_method :old_apply_form_for_options!, :apply_form_for_options!
|
5
10
|
def apply_form_for_options!(record, object, options) #:nodoc:
|
6
11
|
if record.is_a?(RecordCollection::Base)
|
data/record_collection.gemspec
CHANGED
@@ -40,6 +40,8 @@ Gem::Specification.new do |spec|
|
|
40
40
|
spec.add_development_dependency "spring"
|
41
41
|
spec.add_development_dependency "spring-commands-rspec"
|
42
42
|
spec.add_development_dependency "quiet_assets"
|
43
|
+
spec.add_development_dependency "simple_form"
|
44
|
+
spec.add_development_dependency "rspec-html-matchers"
|
43
45
|
|
44
46
|
|
45
47
|
spec.add_runtime_dependency 'active_attr', '>= 0.8'
|
data/spec/base/behaviour_spec.rb
CHANGED
@@ -32,59 +32,8 @@ RSpec.describe Employee::Collection do
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
describe '#uniform_collection_attribute' do
|
36
|
-
let(:collection_class){ described_class }
|
37
|
-
describe 'boolean attribute' do
|
38
|
-
let(:record) { Struct.new(:admin) }
|
39
|
-
|
40
|
-
it 'returns false for mixed falsy boolean values' do
|
41
|
-
expect( collection_class.new([record.new, record.new(false)]).uniform_collection_attribute(:admin)).to be false
|
42
|
-
end
|
43
|
-
|
44
|
-
it 'returns nil for mixes boolean values' do
|
45
|
-
expect( collection_class.new([record.new, record.new(true)]).uniform_collection_attribute(:admin)).to be nil
|
46
|
-
end
|
47
|
-
|
48
|
-
it 'returns true for all truthy values' do
|
49
|
-
expect( collection_class.new([record.new(true), record.new(true)]).uniform_collection_attribute(:admin)).to be true
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
describe 'untyped attribute' do
|
54
|
-
let(:record) { Struct.new(:section) }
|
55
|
-
it 'returns nil for mixed values truthy and falsy' do
|
56
|
-
collection = collection_class.new([record.new, record.new('NT2')])
|
57
|
-
expect( collection.uniform_collection_attribute :section ).to be nil
|
58
|
-
end
|
59
|
-
|
60
|
-
it 'returns nil for mixed truthy values' do
|
61
|
-
collection = collection_class.new([record.new('NT1'), record.new('NT2')])
|
62
|
-
expect( collection.uniform_collection_attribute :section ).to be nil
|
63
|
-
end
|
64
|
-
|
65
|
-
it 'returns the value for all the same values, but does not set the value' do
|
66
|
-
collection = collection_class.new([record.new('NT2'), record.new('NT2')])
|
67
|
-
expect( collection.uniform_collection_attribute :section ).to eq 'NT2'
|
68
|
-
expect( collection.section ).to be nil
|
69
|
-
end
|
70
|
-
|
71
|
-
it 'returns the value for all the same values, and sets the value if set_if_nil is given' do
|
72
|
-
collection = collection_class.new([record.new('NT2'), record.new('NT2')])
|
73
|
-
expect( collection.uniform_collection_attribute :section, set_if_nil: true ).to eq 'NT2'
|
74
|
-
expect( collection.section ).to eq 'NT2'
|
75
|
-
end
|
76
|
-
|
77
|
-
it 'returns the value for all the same values, and does not set the value if set_if_nil is given, but already set (eg: by invalid form)' do
|
78
|
-
collection = collection_class.new([record.new('NT2'), record.new('NT2')], section: 'Invalid set form value')
|
79
|
-
expect( collection.uniform_collection_attribute :section, set_if_nil: true ).to eq 'NT2'
|
80
|
-
expect( collection.section ).to eq 'Invalid set form value'
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
35
|
describe "array like behaviour" do
|
86
36
|
collection = described_class.new([1])
|
87
37
|
Array.wrap( collection ).should == collection
|
88
38
|
end
|
89
39
|
end
|
90
|
-
|
@@ -1,8 +1,9 @@
|
|
1
1
|
h1 Edit multiple projects
|
2
|
-
=
|
2
|
+
= simple_form_for @collection, url: [:collection_update, @collection] do |f|
|
3
3
|
= render 'form_errors', target: @collection
|
4
4
|
.form-inputs= f.optional_boolean :finished, disabled: true
|
5
|
-
.form-inputs= f.
|
5
|
+
.form-inputs= f.optional_input :start_date
|
6
|
+
.form-inputs= f.optional_input :description
|
6
7
|
.form-actions= f.submit
|
7
8
|
.page-actions
|
8
9
|
= link_to 'Back', employees_path
|
data/spec/dummy/db/schema.rb
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
#
|
12
12
|
# It's strongly recommended that you check this file into your version control system.
|
13
13
|
|
14
|
-
ActiveRecord::Schema.define(version:
|
14
|
+
ActiveRecord::Schema.define(version: 20151225113902) do
|
15
15
|
|
16
16
|
create_table "employees", force: :cascade do |t|
|
17
17
|
t.string "name"
|
@@ -30,6 +30,7 @@ ActiveRecord::Schema.define(version: 20151215123553) do
|
|
30
30
|
t.datetime "created_at", null: false
|
31
31
|
t.datetime "updated_at", null: false
|
32
32
|
t.text "description"
|
33
|
+
t.date "start_date"
|
33
34
|
end
|
34
35
|
|
35
36
|
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.feature "Optional date field with multiple default nil values", type: :feature do
|
4
|
+
scenario "Immediately setting the date when none of the collection is set", js: true do
|
5
|
+
project_1 = Project.create name: "P1", start_date: nil
|
6
|
+
project_2 = Project.create name: "P2", start_date: nil
|
7
|
+
visit collection_edit_projects_path(ids: "#{project_1.id}~#{project_2.id}")
|
8
|
+
page.should have_selector '.collection_start_date'
|
9
|
+
end
|
10
|
+
end
|
@@ -1,8 +1,10 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe ActionView::Helpers::FormBuilder do
|
4
|
-
let(:
|
5
|
-
let(:
|
4
|
+
let(:employee_1){ Employee.create section: 'SE1' }
|
5
|
+
let(:employee_2){ Employee.create section: 'SE1' }
|
6
|
+
let(:collection_class) { Employee::Collection }
|
7
|
+
let(:arguments){ {form_object: collection_class.new([employee_1, employee_2])} }
|
6
8
|
subject{ described_class.new :collection, arguments[:form_object], @template, {}}
|
7
9
|
before do
|
8
10
|
# http://pivotallabs.com/testing-custom-form-builder/
|
@@ -14,13 +16,16 @@ describe ActionView::Helpers::FormBuilder do
|
|
14
16
|
|
15
17
|
describe '.collection_ids' do
|
16
18
|
it 'returns the collection ids as hidden fields' do
|
17
|
-
subject.collection_ids.should
|
18
|
-
subject.collection_ids.should
|
19
|
-
|
19
|
+
#subject.collection_ids.should eq %|<input type="hidden" name="ids" value="#{employee_1.id}~#{employee_2.id}" />|
|
20
|
+
subject.collection_ids.should have_tag :input, with: {
|
21
|
+
type: 'hidden',
|
22
|
+
name: 'ids',
|
23
|
+
value: "#{employee_1.id}~#{employee_2.id}"
|
24
|
+
}
|
20
25
|
end
|
21
26
|
|
22
27
|
it "does not raise when the object is not a collection object" do
|
23
|
-
arguments[:form_object] =
|
28
|
+
arguments[:form_object] = employee_1
|
24
29
|
expect{ subject.collection_ids }.not_to raise_error
|
25
30
|
end
|
26
31
|
end
|
@@ -29,39 +34,38 @@ describe ActionView::Helpers::FormBuilder do
|
|
29
34
|
it "generates proper output" do
|
30
35
|
expect( subject ).to receive(:input).and_return "<simple-form-content>Simple Form Content</simple-form-content>".html_safe
|
31
36
|
html = subject.optional_input(:section)
|
32
|
-
doc = Nokogiri::HTML(html)
|
33
|
-
doc.css("[name='ids[]'][value='#{employee.id}']").should be_present # add ids if not yet set
|
34
37
|
|
35
|
-
|
36
|
-
|
38
|
+
html.should have_tag :input, with: {name: 'ids', value: "#{employee_1.id}~#{employee_2.id}"}
|
39
|
+
html.should have_tag :div, with: {
|
40
|
+
class: 'optional-input optional-attribute-container section active',
|
41
|
+
'data-attribute' => 'section',
|
42
|
+
'data-one' => false
|
43
|
+
}
|
37
44
|
end
|
38
45
|
end
|
39
46
|
|
40
47
|
describe '#get_optional_classes' do
|
41
48
|
|
42
49
|
describe 'active/inactive' do
|
43
|
-
it "does not include active when record has no value" do
|
44
|
-
|
50
|
+
it "does not include active when one record has no value and the other one has" do
|
51
|
+
employee_1.section = nil
|
45
52
|
subject.get_optional_classes(:section).should_not include'active'
|
46
53
|
subject.get_optional_classes(:section).should include'inactive'
|
47
54
|
end
|
48
55
|
|
49
|
-
it "includes active when
|
50
|
-
|
56
|
+
it "includes active when collection has an empty value" do
|
57
|
+
subject.object.section = ''
|
51
58
|
subject.get_optional_classes(:section).should include'active'
|
52
59
|
subject.get_optional_classes(:section).should_not include'inactive'
|
53
60
|
end
|
54
61
|
|
55
62
|
it 'includes active when two records have the same value' do
|
56
|
-
employee_2 = Employee.create section: 'SE1'
|
57
|
-
arguments[:form_object] = Employee::Collection.new([employee, employee_2])
|
58
63
|
subject.get_optional_classes(:section).should include'active'
|
59
64
|
subject.get_optional_classes(:section).should_not include'inactive'
|
60
65
|
end
|
61
66
|
|
62
67
|
it 'does not include active when two records have different values' do
|
63
|
-
employee_2 = Employee.create section: 'SE2'
|
64
|
-
arguments[:form_object] = Employee::Collection.new([employee, employee_2])
|
68
|
+
employee_2.section = 'SE2' # = Employee.create section: 'SE2'
|
65
69
|
subject.get_optional_classes(:section).should_not include'active'
|
66
70
|
subject.get_optional_classes(:section).should include'inactive'
|
67
71
|
end
|
@@ -69,17 +73,16 @@ describe ActionView::Helpers::FormBuilder do
|
|
69
73
|
|
70
74
|
describe 'one' do
|
71
75
|
it "includes one if only one record is present" do
|
76
|
+
arguments[:form_object] = collection_class.new([employee_1])
|
72
77
|
subject.get_optional_classes(:section).should include'one'
|
73
78
|
end
|
74
79
|
|
75
80
|
it "includes one if the form record is not a collection but a normal record" do
|
76
|
-
arguments[:form_object] =
|
81
|
+
arguments[:form_object] = employee_1
|
77
82
|
subject.get_optional_classes(:section).should include'one'
|
78
83
|
end
|
79
84
|
|
80
85
|
it "does not include one for a collection having more than one records" do
|
81
|
-
employee_2 = Employee.create section: 'SE2'
|
82
|
-
arguments[:form_object] = Employee::Collection.new([employee, employee_2])
|
83
86
|
subject.get_optional_classes(:section).should_not include'one'
|
84
87
|
end
|
85
88
|
end
|
@@ -61,52 +61,96 @@ RSpec.describe RecordCollection::Base do
|
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
|
-
describe '#
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
64
|
+
describe '#mixed_values_for_attribute?' do
|
65
|
+
context "TestCollection" do
|
66
|
+
let(:collection_class){ ActiveCollectionTest }
|
67
|
+
describe 'boolean attribute' do
|
68
|
+
let(:record) { Struct.new(:check1) }
|
69
|
+
|
70
|
+
it 'returns true for mixed falsy boolean values' do
|
71
|
+
expect( collection_class.new([record.new, record.new(false)]).mixed_values_for_attribute?(:check1)).to be true
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'returns false for all truthy values' do
|
75
|
+
expect( collection_class.new([record.new(true), record.new(true)]).mixed_values_for_attribute?(:check1)).to be false
|
76
|
+
end
|
75
77
|
end
|
76
78
|
|
77
|
-
|
78
|
-
|
79
|
+
describe 'untyped attribute' do
|
80
|
+
let(:record) { Struct.new(:notes) }
|
81
|
+
it 'returns true for mixed values truthy and falsy' do
|
82
|
+
collection = collection_class.new([record.new, record.new('NOTE2')])
|
83
|
+
expect( collection.mixed_values_for_attribute? :notes ).to be true
|
84
|
+
end
|
85
|
+
|
86
|
+
it 'returns true for mixed truthy values' do
|
87
|
+
collection = collection_class.new([record.new('NOTE1'), record.new('NOTE2')])
|
88
|
+
expect( collection.mixed_values_for_attribute? :notes ).to be true
|
89
|
+
end
|
90
|
+
|
91
|
+
it 'returns the value for all the same values, and sets the value if set_if_nil is given' do
|
92
|
+
collection = collection_class.new([record.new('NOTE2'), record.new('NOTE2')])
|
93
|
+
expect( collection.mixed_values_for_attribute? :notes, set_if_nil: true ).to be false
|
94
|
+
expect( collection.notes ).to eq 'NOTE2'
|
95
|
+
end
|
96
|
+
|
97
|
+
it "does not set value if there are mixed values" do
|
98
|
+
collection = collection_class.new([record.new('NOTE1'), record.new('NOTE2')])
|
99
|
+
expect( collection.mixed_values_for_attribute? :notes, set_if_nil: true ).to be true
|
100
|
+
collection.notes.should be_nil
|
101
|
+
end
|
79
102
|
end
|
80
103
|
end
|
104
|
+
end
|
81
105
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
end
|
106
|
+
describe '#uniform_collection_value' do
|
107
|
+
context "TestCollection" do
|
108
|
+
let(:collection_class){ ActiveCollectionTest }
|
109
|
+
describe 'boolean attribute' do
|
110
|
+
let(:record) { Struct.new(:check1) }
|
88
111
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
end
|
112
|
+
it 'returns false for mixed falsy boolean values' do
|
113
|
+
expect( collection_class.new([record.new, record.new(false)]).uniform_collection_value(:check1)).to be false
|
114
|
+
end
|
93
115
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
expect( collection.notes ).to be nil
|
98
|
-
end
|
116
|
+
it 'returns nil for mixes boolean values' do
|
117
|
+
expect( collection_class.new([record.new, record.new(true)]).uniform_collection_value(:check1)).to be nil
|
118
|
+
end
|
99
119
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
expect( collection.notes ).to eq 'NOTE2'
|
120
|
+
it 'returns true for all truthy values' do
|
121
|
+
expect( collection_class.new([record.new(true), record.new(true)]).uniform_collection_value(:check1)).to be true
|
122
|
+
end
|
104
123
|
end
|
105
124
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
125
|
+
describe 'untyped attribute' do
|
126
|
+
let(:record) { Struct.new(:notes) }
|
127
|
+
it 'returns nil for mixed values truthy and falsy' do
|
128
|
+
collection = collection_class.new([record.new, record.new('NOTE2')])
|
129
|
+
expect( collection.uniform_collection_value :notes ).to be nil
|
130
|
+
end
|
131
|
+
|
132
|
+
it 'returns nil for mixed truthy values' do
|
133
|
+
collection = collection_class.new([record.new('NOTE1'), record.new('NOTE2')])
|
134
|
+
expect( collection.uniform_collection_value :notes ).to be nil
|
135
|
+
end
|
136
|
+
|
137
|
+
it 'returns the value for all the same values, but does not set the value' do
|
138
|
+
collection = collection_class.new([record.new('NOTE2'), record.new('NOTE2')])
|
139
|
+
expect( collection.uniform_collection_value :notes ).to eq 'NOTE2'
|
140
|
+
expect( collection.notes ).to be nil
|
141
|
+
end
|
142
|
+
|
143
|
+
it 'returns the value for all the same values, and sets the value if set_if_nil is given' do
|
144
|
+
collection = collection_class.new([record.new('NOTE2'), record.new('NOTE2')])
|
145
|
+
expect( collection.uniform_collection_value :notes, set_if_nil: true ).to eq 'NOTE2'
|
146
|
+
expect( collection.notes ).to eq 'NOTE2'
|
147
|
+
end
|
148
|
+
|
149
|
+
it 'returns the value for all the same values, and does not set the value if set_if_nil is given, but already set (eg: by invalid form)' do
|
150
|
+
collection = collection_class.new([record.new('NOTE2'), record.new('NOTE2')], notes: 'Invalid set form value')
|
151
|
+
expect( collection.uniform_collection_value :notes, set_if_nil: true ).to eq 'NOTE2'
|
152
|
+
expect( collection.notes ).to eq 'Invalid set form value'
|
153
|
+
end
|
110
154
|
end
|
111
155
|
end
|
112
156
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: record_collection
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benjamin ter Kuile
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -304,6 +304,34 @@ dependencies:
|
|
304
304
|
- - ">="
|
305
305
|
- !ruby/object:Gem::Version
|
306
306
|
version: '0'
|
307
|
+
- !ruby/object:Gem::Dependency
|
308
|
+
name: simple_form
|
309
|
+
requirement: !ruby/object:Gem::Requirement
|
310
|
+
requirements:
|
311
|
+
- - ">="
|
312
|
+
- !ruby/object:Gem::Version
|
313
|
+
version: '0'
|
314
|
+
type: :development
|
315
|
+
prerelease: false
|
316
|
+
version_requirements: !ruby/object:Gem::Requirement
|
317
|
+
requirements:
|
318
|
+
- - ">="
|
319
|
+
- !ruby/object:Gem::Version
|
320
|
+
version: '0'
|
321
|
+
- !ruby/object:Gem::Dependency
|
322
|
+
name: rspec-html-matchers
|
323
|
+
requirement: !ruby/object:Gem::Requirement
|
324
|
+
requirements:
|
325
|
+
- - ">="
|
326
|
+
- !ruby/object:Gem::Version
|
327
|
+
version: '0'
|
328
|
+
type: :development
|
329
|
+
prerelease: false
|
330
|
+
version_requirements: !ruby/object:Gem::Requirement
|
331
|
+
requirements:
|
332
|
+
- - ">="
|
333
|
+
- !ruby/object:Gem::Version
|
334
|
+
version: '0'
|
307
335
|
- !ruby/object:Gem::Dependency
|
308
336
|
name: active_attr
|
309
337
|
requirement: !ruby/object:Gem::Requirement
|
@@ -475,6 +503,7 @@ files:
|
|
475
503
|
- spec/dummy/db/migrate/20150204125014_create_projects.rb
|
476
504
|
- spec/dummy/db/migrate/20150721122805_add_description_to_projects.rb
|
477
505
|
- spec/dummy/db/migrate/20151215123553_add_project_id_to_employees.rb
|
506
|
+
- spec/dummy/db/migrate/20151225113902_add_start_date_to_projects.rb
|
478
507
|
- spec/dummy/db/schema.rb
|
479
508
|
- spec/dummy/lib/assets/.keep
|
480
509
|
- spec/dummy/log/.keep
|
@@ -485,6 +514,7 @@ files:
|
|
485
514
|
- spec/features/disabled_boolean_spec.rb
|
486
515
|
- spec/features/multi_select_spec.rb
|
487
516
|
- spec/features/optional_boolean_with_normal_resource_spec.rb
|
517
|
+
- spec/features/optional_date_field_all_nil_spec.rb
|
488
518
|
- spec/features/optional_text_field_with_normal_resource_spec.rb
|
489
519
|
- spec/features/optionals_with_one_record_spec.rb
|
490
520
|
- spec/features/translations_spec.rb
|
@@ -596,6 +626,7 @@ test_files:
|
|
596
626
|
- spec/dummy/db/migrate/20150204125014_create_projects.rb
|
597
627
|
- spec/dummy/db/migrate/20150721122805_add_description_to_projects.rb
|
598
628
|
- spec/dummy/db/migrate/20151215123553_add_project_id_to_employees.rb
|
629
|
+
- spec/dummy/db/migrate/20151225113902_add_start_date_to_projects.rb
|
599
630
|
- spec/dummy/db/schema.rb
|
600
631
|
- spec/dummy/lib/assets/.keep
|
601
632
|
- spec/dummy/log/.keep
|
@@ -606,6 +637,7 @@ test_files:
|
|
606
637
|
- spec/features/disabled_boolean_spec.rb
|
607
638
|
- spec/features/multi_select_spec.rb
|
608
639
|
- spec/features/optional_boolean_with_normal_resource_spec.rb
|
640
|
+
- spec/features/optional_date_field_all_nil_spec.rb
|
609
641
|
- spec/features/optional_text_field_with_normal_resource_spec.rb
|
610
642
|
- spec/features/optionals_with_one_record_spec.rb
|
611
643
|
- spec/features/translations_spec.rb
|