judge 1.5.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +273 -14
- data/app/assets/javascripts/judge.js +391 -0
- data/app/controllers/judge/validations_controller.rb +9 -0
- data/app/models/judge/validation.rb +53 -0
- data/config/routes.rb +3 -0
- data/lib/generators/judge/install/install_generator.rb +42 -0
- data/lib/judge.rb +13 -8
- data/lib/judge/config.rb +39 -0
- data/lib/judge/controller.rb +35 -0
- data/lib/judge/each_validator.rb +5 -4
- data/lib/judge/engine.rb +5 -0
- data/lib/judge/form_builder.rb +19 -24
- data/lib/judge/html.rb +5 -7
- data/lib/judge/message_collection.rb +2 -1
- data/lib/judge/message_config.rb +2 -1
- data/lib/judge/validator.rb +3 -1
- data/lib/judge/validator_collection.rb +1 -1
- data/lib/judge/version.rb +2 -2
- data/lib/tasks/judge_tasks.rake +4 -0
- data/{lib/generators/judge/templates → vendor/assets/javascripts}/json2.js +4 -5
- data/{lib/generators/judge/templates → vendor/assets/javascripts}/underscore.js +451 -285
- metadata +94 -87
- data/.gitignore +0 -9
- data/.travis.yml +0 -21
- data/Gemfile +0 -3
- data/Rakefile +0 -11
- data/judge.gemspec +0 -23
- data/lib/generators/judge/judge_generator.rb +0 -21
- data/lib/generators/judge/templates/judge.js +0 -330
- data/spec/each_validator_spec.rb +0 -17
- data/spec/form_builder_spec.rb +0 -68
- data/spec/html_spec.rb +0 -14
- data/spec/javascripts/JudgeSpec.js +0 -509
- data/spec/javascripts/fixtures/form.html +0 -538
- data/spec/javascripts/helpers/customMatchers.js +0 -20
- data/spec/javascripts/helpers/jasmine-jquery.js +0 -204
- data/spec/javascripts/helpers/jquery-1.5.1.min.js +0 -18
- data/spec/javascripts/helpers/json2.js +0 -487
- data/spec/javascripts/helpers/underscore.js +0 -1060
- data/spec/javascripts/support/jasmine.yml +0 -79
- data/spec/javascripts/support/jasmine_config.rb +0 -6
- data/spec/javascripts/support/jasmine_runner.rb +0 -21
- data/spec/javascripts/support/runner.js +0 -51
- data/spec/message_collection_spec.rb +0 -73
- data/spec/setup.rb +0 -75
- data/spec/support/factories.rb +0 -23
- data/spec/support/locale/en.yml +0 -18
- data/spec/support/setup.rb +0 -72
- data/spec/support/spec_helper.rb +0 -13
- data/spec/support/validators/city_validator.rb +0 -9
- data/spec/validator_collection_spec.rb +0 -21
- data/spec/validator_spec.rb +0 -33
@@ -1,21 +0,0 @@
|
|
1
|
-
require "support/spec_helper"
|
2
|
-
|
3
|
-
describe Judge::ValidatorCollection do
|
4
|
-
|
5
|
-
let(:vc) { Judge::ValidatorCollection.new(FactoryGirl.build(:user), :name) }
|
6
|
-
|
7
|
-
it "contains validators" do
|
8
|
-
vc.validators.should be_an Array
|
9
|
-
vc.validators.first.should be_a Judge::Validator
|
10
|
-
end
|
11
|
-
|
12
|
-
it "converts to json correctly" do
|
13
|
-
vc.to_json.should be_a String
|
14
|
-
end
|
15
|
-
|
16
|
-
it "is enumerable" do
|
17
|
-
vc.should be_an Enumerable
|
18
|
-
vc.should respond_to :each
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
data/spec/validator_spec.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
require "support/spec_helper"
|
2
|
-
|
3
|
-
describe Judge::Validator do
|
4
|
-
|
5
|
-
before(:each) do
|
6
|
-
user = FactoryGirl.build(:user)
|
7
|
-
amv = User.validators_on(:name).first
|
8
|
-
@validator = Judge::Validator.new(user, :name, amv)
|
9
|
-
end
|
10
|
-
|
11
|
-
it "has correct kind attr" do
|
12
|
-
@validator.kind.should eql :presence
|
13
|
-
end
|
14
|
-
|
15
|
-
it "has hash in options attr" do
|
16
|
-
@validator.options.should be_a Hash
|
17
|
-
end
|
18
|
-
|
19
|
-
it "has Judge::MessageCollection in messages attr" do
|
20
|
-
@validator.messages.should be_a Judge::MessageCollection
|
21
|
-
end
|
22
|
-
|
23
|
-
describe "#to_hash" do
|
24
|
-
it "converts to hash with correct properties" do
|
25
|
-
hash = @validator.to_hash
|
26
|
-
hash.should be_a Hash
|
27
|
-
hash[:kind].should be_a Symbol
|
28
|
-
hash[:options].should be_a Hash
|
29
|
-
hash[:messages].should be_a Hash
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|