volt 0.9.5.pre11 → 0.9.5.pre12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2c855e92da3bc6bcee176d539ae365747bfe848e
4
- data.tar.gz: ca339e18a47c685787f2e55eed17bd49f2c5de13
3
+ metadata.gz: e995f18c906a2379a9a631a32783910067905c19
4
+ data.tar.gz: fee2b9fc14654a0a3369b72f3e3a3d315af7715b
5
5
  SHA512:
6
- metadata.gz: 7ec01b186962830327f074a0c061ed6a41c4735ac12516175a666d1175a016da1a649b0dbf3be8275de78f8467df593d3d7d35dcfdf3453e5ebfa16dabf59257
7
- data.tar.gz: ae01a3abe872c61cadd82426be2e940242d533bbd66a7cc342187a8a3b24ad139af02b3e5bcc036183af9c785234f62b6757cbca3fa82e68a2b017089938b210
6
+ metadata.gz: ccaf2f6f632456efcb2851802d691ae992b150fe0cc84f05d8f7476cebb3b848556f18c11850052fde1a315af3d82fd4c3983c2d5bd1ba4092445451a5da3489
7
+ data.tar.gz: da08f6eeef5a27ac152827cde226539718e33fb33f6b3c3cdfa2f4a8f783be86b9a7bad1a514a6170b9a83132f55fee31aa59f611915c17bf8db9b1458bd04e1
data/CHANGELOG.md CHANGED
@@ -17,6 +17,8 @@
17
17
  - All volt CLI tasks now can run from inside of any directory in the volt app (or the root)
18
18
  - Asset precompilation has been reworked to use Sprockets::Manifest. The results are written to /public, and an index.html file is created. The entire app loading up until the websocket connect can be served statically (via nginx for example) All js and css is written to a single file.
19
19
  - The ```generate gem``` generator has been improved to setup a dummy app and integration specs out of the box.
20
+ - Tasks can now set (only set, not read) cookies on the client using the ```cookies``` collection.
21
+ - Added ```login_as(user)``` method to Tasks and HttpController's.
20
22
 
21
23
  ### Changed
22
24
  - fix issue with ```raw``` and promises (#275)
@@ -25,6 +27,7 @@
25
27
  - Redid the initializer load order so all initializers run before any controllers/models/views are loaded.
26
28
  - Added error message for when an unserializable object is returned from a Task
27
29
  - Fixed issue with disable_encryption option
30
+ - Fixed issue with select's not selecting options when options are dynamically loaded
28
31
 
29
32
  ## 0.9.4
30
33
  ### Lingo Change
@@ -1,6 +1,7 @@
1
1
  require 'volt/models/errors'
2
2
  require 'volt/models/validators/format_validator'
3
3
  require 'volt/models/validators/email_validator'
4
+ require 'volt/models/validators/inclusion_validator'
4
5
  require 'volt/models/validators/length_validator'
5
6
  require 'volt/models/validators/numericality_validator'
6
7
  require 'volt/models/validators/phone_number_validator'
@@ -0,0 +1,25 @@
1
+ module Volt
2
+ class InclusionValidator
3
+ def self.validate(model, field_name, args)
4
+ errors = {}
5
+ value = model.get(field_name)
6
+
7
+ if args.is_a?(Array)
8
+ list = args
9
+ message = nil
10
+ elsif args.is_a?(Hash)
11
+ list = args[:in]
12
+ message = args[:message]
13
+ fail 'A list to match against must be specified' unless list.is_a?(Array)
14
+ else
15
+ fail 'The arguments to inclusion validator must be an array or a hash'
16
+ end
17
+
18
+ unless list.include?(value)
19
+ errors[field_name] = [message || "must be one of #{list.join(', ')}"]
20
+ end
21
+
22
+ errors
23
+ end
24
+ end
25
+ end
@@ -52,6 +52,8 @@ module Volt
52
52
  add_each(content, false)
53
53
  elsif content =~ /.each_with_index\s+do\s+\|/
54
54
  add_each(content, true)
55
+ elsif content[0] == '#'
56
+ # A comment binding, just ignore it.
55
57
  else
56
58
  add_content_binding(content)
57
59
  end
@@ -89,7 +89,7 @@ module Volt
89
89
  end
90
90
 
91
91
  def css_file(locator)
92
- @assets << [:css_file, prepare_locator(locator, ['css','scss'])]
92
+ @assets << [:css_file, prepare_locator(locator, ['css','scss','sass'])]
93
93
  end
94
94
 
95
95
  def prepare_locator(locator, valid_extensions)
data/lib/volt/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Volt
2
2
  module Version
3
- STRING = '0.9.5.pre11'
3
+ STRING = '0.9.5.pre12'
4
4
  end
5
5
  end
@@ -158,3 +158,5 @@
158
158
 
159
159
  <p>{{ raw 'some <br /> code' }}</p>
160
160
  <p>{{ raw Promise.new.resolve('some <br /> other code') }}</p>
161
+
162
+ {{ # comment binding }}
@@ -0,0 +1,57 @@
1
+ require 'spec_helper'
2
+
3
+ describe Volt::InclusionValidator do
4
+ subject { Volt::InclusionValidator.validate(*use_params) }
5
+ let(:use_params) { [model, field_name, options] }
6
+
7
+ let(:model) { Volt::Model.new name: name }
8
+ let(:field_name) { :name }
9
+ let(:name) { 'John' }
10
+
11
+ describe '.validate' do
12
+ describe 'when options is an array' do
13
+ let(:options) { %w(John Susie Mary) }
14
+
15
+ describe 'when name is "John"' do
16
+ let(:name) { 'John' }
17
+ it { expect(subject).to eq({}) }
18
+ end
19
+
20
+ describe 'when name is "Bill"' do
21
+ let(:name) { 'Bill' }
22
+ it do
23
+ expect(subject).to eq(name: ['must be one of John, Susie, Mary'])
24
+ end
25
+ end
26
+ end
27
+
28
+ describe 'when options is a Hash' do
29
+ let(:options) do
30
+ { in: %w(John Susie Mary), message: 'Choose one from the list.' }
31
+ end
32
+
33
+ describe 'when name is "John"' do
34
+ let(:name) { 'John' }
35
+ it { expect(subject).to eq({}) }
36
+ end
37
+
38
+ describe 'when name is "Bill"' do
39
+ let(:name) { 'Bill' }
40
+ it do
41
+ expect(subject).to eq(name: ['Choose one from the list.'])
42
+ end
43
+ end
44
+ end
45
+
46
+ describe 'when options not a Fixnum or a Hash' do
47
+ let(:options) { 'string' }
48
+
49
+ it 'raises an exception' do
50
+ expect { subject }.to raise_error(
51
+ RuntimeError,
52
+ 'The arguments to inclusion validator must be an array or a hash'
53
+ )
54
+ end
55
+ end
56
+ end
57
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: volt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.5.pre11
4
+ version: 0.9.5.pre12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Stout
@@ -484,6 +484,7 @@ files:
484
484
  - lib/volt/models/validations/validations.rb
485
485
  - lib/volt/models/validators/email_validator.rb
486
486
  - lib/volt/models/validators/format_validator.rb
487
+ - lib/volt/models/validators/inclusion_validator.rb
487
488
  - lib/volt/models/validators/length_validator.rb
488
489
  - lib/volt/models/validators/numericality_validator.rb
489
490
  - lib/volt/models/validators/phone_number_validator.rb
@@ -714,6 +715,7 @@ files:
714
715
  - spec/models/validators/block_validations_spec.rb
715
716
  - spec/models/validators/email_validator_spec.rb
716
717
  - spec/models/validators/format_validator_spec.rb
718
+ - spec/models/validators/inclusion_validator_spec.rb
717
719
  - spec/models/validators/length_validator_spec.rb
718
720
  - spec/models/validators/phone_number_validator_spec.rb
719
721
  - spec/models/validators/shared_examples_for_validators.rb
@@ -984,6 +986,7 @@ test_files:
984
986
  - spec/models/validators/block_validations_spec.rb
985
987
  - spec/models/validators/email_validator_spec.rb
986
988
  - spec/models/validators/format_validator_spec.rb
989
+ - spec/models/validators/inclusion_validator_spec.rb
987
990
  - spec/models/validators/length_validator_spec.rb
988
991
  - spec/models/validators/phone_number_validator_spec.rb
989
992
  - spec/models/validators/shared_examples_for_validators.rb