judge 1.5.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. data/README.md +273 -14
  2. data/app/assets/javascripts/judge.js +391 -0
  3. data/app/controllers/judge/validations_controller.rb +9 -0
  4. data/app/models/judge/validation.rb +53 -0
  5. data/config/routes.rb +3 -0
  6. data/lib/generators/judge/install/install_generator.rb +42 -0
  7. data/lib/judge.rb +13 -8
  8. data/lib/judge/config.rb +39 -0
  9. data/lib/judge/controller.rb +35 -0
  10. data/lib/judge/each_validator.rb +5 -4
  11. data/lib/judge/engine.rb +5 -0
  12. data/lib/judge/form_builder.rb +19 -24
  13. data/lib/judge/html.rb +5 -7
  14. data/lib/judge/message_collection.rb +2 -1
  15. data/lib/judge/message_config.rb +2 -1
  16. data/lib/judge/validator.rb +3 -1
  17. data/lib/judge/validator_collection.rb +1 -1
  18. data/lib/judge/version.rb +2 -2
  19. data/lib/tasks/judge_tasks.rake +4 -0
  20. data/{lib/generators/judge/templates → vendor/assets/javascripts}/json2.js +4 -5
  21. data/{lib/generators/judge/templates → vendor/assets/javascripts}/underscore.js +451 -285
  22. metadata +94 -87
  23. data/.gitignore +0 -9
  24. data/.travis.yml +0 -21
  25. data/Gemfile +0 -3
  26. data/Rakefile +0 -11
  27. data/judge.gemspec +0 -23
  28. data/lib/generators/judge/judge_generator.rb +0 -21
  29. data/lib/generators/judge/templates/judge.js +0 -330
  30. data/spec/each_validator_spec.rb +0 -17
  31. data/spec/form_builder_spec.rb +0 -68
  32. data/spec/html_spec.rb +0 -14
  33. data/spec/javascripts/JudgeSpec.js +0 -509
  34. data/spec/javascripts/fixtures/form.html +0 -538
  35. data/spec/javascripts/helpers/customMatchers.js +0 -20
  36. data/spec/javascripts/helpers/jasmine-jquery.js +0 -204
  37. data/spec/javascripts/helpers/jquery-1.5.1.min.js +0 -18
  38. data/spec/javascripts/helpers/json2.js +0 -487
  39. data/spec/javascripts/helpers/underscore.js +0 -1060
  40. data/spec/javascripts/support/jasmine.yml +0 -79
  41. data/spec/javascripts/support/jasmine_config.rb +0 -6
  42. data/spec/javascripts/support/jasmine_runner.rb +0 -21
  43. data/spec/javascripts/support/runner.js +0 -51
  44. data/spec/message_collection_spec.rb +0 -73
  45. data/spec/setup.rb +0 -75
  46. data/spec/support/factories.rb +0 -23
  47. data/spec/support/locale/en.yml +0 -18
  48. data/spec/support/setup.rb +0 -72
  49. data/spec/support/spec_helper.rb +0 -13
  50. data/spec/support/validators/city_validator.rb +0 -9
  51. data/spec/validator_collection_spec.rb +0 -21
  52. 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
@@ -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