objectify 0.0.3 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. data/.document +5 -0
  2. data/.gitignore +47 -2
  3. data/.rspec +1 -0
  4. data/Gemfile +1 -1
  5. data/Gemfile.lock +105 -16
  6. data/LICENSE.txt +20 -0
  7. data/README.md +230 -0
  8. data/Rakefile +14 -7
  9. data/lib/objectify.rb +1 -26
  10. data/lib/objectify/config/action.rb +31 -0
  11. data/lib/objectify/config/context.rb +97 -0
  12. data/lib/objectify/config/policies.rb +18 -0
  13. data/lib/objectify/executor.rb +21 -0
  14. data/lib/objectify/injector.rb +39 -0
  15. data/lib/objectify/instantiator.rb +14 -0
  16. data/lib/objectify/instrumentation.rb +12 -0
  17. data/lib/objectify/logging.rb +22 -0
  18. data/lib/objectify/policy_chain_executor.rb +27 -0
  19. data/lib/objectify/rails/application.rb +16 -0
  20. data/lib/objectify/rails/controller.rb +117 -0
  21. data/lib/objectify/rails/helpers.rb +14 -0
  22. data/lib/objectify/rails/log_subscriber.rb +59 -0
  23. data/lib/objectify/rails/railtie.rb +11 -0
  24. data/lib/objectify/rails/renderer.rb +47 -0
  25. data/lib/objectify/rails/routing.rb +97 -0
  26. data/lib/objectify/resolver.rb +27 -0
  27. data/lib/objectify/resolver_locator.rb +73 -0
  28. data/lib/objectify/route.rb +4 -0
  29. data/lib/objectify/version.rb +1 -1
  30. data/objectify.gemspec +13 -8
  31. data/spec/config/action_spec.rb +79 -0
  32. data/spec/config/context_spec.rb +137 -0
  33. data/spec/config/policies_spec.rb +23 -0
  34. data/spec/executor_spec.rb +47 -0
  35. data/spec/injector_spec.rb +88 -0
  36. data/spec/instantiator_spec.rb +22 -0
  37. data/spec/policy_chain_executor_spec.rb +60 -0
  38. data/spec/rails/renderer_spec.rb +63 -0
  39. data/spec/rails/routing_spec.rb +171 -0
  40. data/spec/resolver_locator_spec.rb +109 -0
  41. data/spec/resolver_spec.rb +28 -0
  42. data/spec/route_spec.rb +11 -0
  43. data/spec/spec_helper.rb +13 -5
  44. metadata +142 -62
  45. data/spec/objectify_spec.rb +0 -60
@@ -1,60 +0,0 @@
1
- require 'spec_helper'
2
- require 'objectify'
3
-
4
- Object.send :include, Objectify
5
-
6
- describe "an objectified hash" do
7
- subject { {:key => "value", :another_key => "another value"}.objectify }
8
-
9
- its(:key) { should == "value" }
10
- it { subject.another_key.should == "another value" }
11
- it { subject.send(:key).should == "value" }
12
- end
13
-
14
- describe "an objectified hash with nested hashes" do
15
- let(:objectified) { {:key => {:nested_key => "value"}}.objectify }
16
-
17
- it "should allow nested hashes to be accessed via accessors" do
18
- objectified.key.nested_key.should == "value"
19
- end
20
- end
21
-
22
- describe "an array with nested hashes" do
23
- let(:objectified) { [{:key => {:nested_key => [{:first => "first_value"}]}}].objectify }
24
-
25
- it "should allow arrays nested hashes to be accessed via accessors" do
26
- objectified[0].key == {:nested_key => [{:first => "first_value"}]}
27
- end
28
-
29
- it "should allow arrays nested nested hashes to be accessed via accessors" do
30
- objectified[0].key.nested_key.should == [{:first => "first_value"}]
31
- end
32
-
33
- it "should allow arrays nested nested arrays hashes to be accessed via accessors" do
34
- objectified[0].key.nested_key[0].first.should == "first_value"
35
- end
36
-
37
- it "should allow arrays nested hashes to be mapped" do
38
- objectified[0].key.map {|item| item[0].class }.should == [Symbol]
39
- end
40
- end
41
-
42
- describe "an array with nested hashes constructed with Objectify()" do
43
- let(:objectified) { Objectify([{:key => {:nested_key => [{:first => "first_value"}]}}]) }
44
-
45
- it "should allow arrays nested hashes to be accessed via accessors" do
46
- objectified[0].key == {:nested_key => [{:first => "first_value"}]}
47
- end
48
-
49
- it "should allow arrays nested nested hashes to be accessed via accessors" do
50
- objectified[0].key.nested_key.should == [{:first => "first_value"}]
51
- end
52
-
53
- it "should allow arrays nested nested arrays hashes to be accessed via accessors" do
54
- objectified[0].key.nested_key[0].first.should == "first_value"
55
- end
56
-
57
- it "should allow arrays nested hashes to be mapped" do
58
- objectified[0].key.map {|item| item[0].class }.should == [Symbol]
59
- end
60
- end