objectify 0.0.3 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +47 -2
- data/.rspec +1 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +105 -16
- data/LICENSE.txt +20 -0
- data/README.md +230 -0
- data/Rakefile +14 -7
- data/lib/objectify.rb +1 -26
- data/lib/objectify/config/action.rb +31 -0
- data/lib/objectify/config/context.rb +97 -0
- data/lib/objectify/config/policies.rb +18 -0
- data/lib/objectify/executor.rb +21 -0
- data/lib/objectify/injector.rb +39 -0
- data/lib/objectify/instantiator.rb +14 -0
- data/lib/objectify/instrumentation.rb +12 -0
- data/lib/objectify/logging.rb +22 -0
- data/lib/objectify/policy_chain_executor.rb +27 -0
- data/lib/objectify/rails/application.rb +16 -0
- data/lib/objectify/rails/controller.rb +117 -0
- data/lib/objectify/rails/helpers.rb +14 -0
- data/lib/objectify/rails/log_subscriber.rb +59 -0
- data/lib/objectify/rails/railtie.rb +11 -0
- data/lib/objectify/rails/renderer.rb +47 -0
- data/lib/objectify/rails/routing.rb +97 -0
- data/lib/objectify/resolver.rb +27 -0
- data/lib/objectify/resolver_locator.rb +73 -0
- data/lib/objectify/route.rb +4 -0
- data/lib/objectify/version.rb +1 -1
- data/objectify.gemspec +13 -8
- data/spec/config/action_spec.rb +79 -0
- data/spec/config/context_spec.rb +137 -0
- data/spec/config/policies_spec.rb +23 -0
- data/spec/executor_spec.rb +47 -0
- data/spec/injector_spec.rb +88 -0
- data/spec/instantiator_spec.rb +22 -0
- data/spec/policy_chain_executor_spec.rb +60 -0
- data/spec/rails/renderer_spec.rb +63 -0
- data/spec/rails/routing_spec.rb +171 -0
- data/spec/resolver_locator_spec.rb +109 -0
- data/spec/resolver_spec.rb +28 -0
- data/spec/route_spec.rb +11 -0
- data/spec/spec_helper.rb +13 -5
- metadata +142 -62
- data/spec/objectify_spec.rb +0 -60
data/spec/objectify_spec.rb
DELETED
@@ -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
|