Permalink
Browse files

fixed the configuration specs

  • Loading branch information...
1 parent 989588e commit 99c1cab336289e41341dec8d4eb7d14951b315ab @phifty committed May 30, 2011
Showing with 17 additions and 9 deletions.
  1. +6 −0 .travis.yml
  2. +2 −0 README.rdoc
  3. +4 −4 lib/gom/storage/configuration.rb
  4. +3 −3 spec/lib/gom/storage/configuration_spec.rb
  5. +2 −2 spec/spec_helper.rb
View
6 .travis.yml
@@ -1,2 +1,8 @@
notifications:
disable: true
+rvm:
+ - 1.8.7
+ - 1.9.2
+ - rbx
+ - ree
+ - jruby
View
2 README.rdoc
@@ -8,6 +8,8 @@ is plugged-in via an adapter interface. Currently, the following adapters are pr
* filesystem - http://github.com/phifty/gom-filesystem-adapter
* couchdb - http://github.com/phifty/gom-couchdb-adapter
+http://travis-ci.org/phifty/gom.png
+
== Configuration
At the beginning of your program the storage configuration should be done with the <tt>GOM::Storage.configure</tt>
View
8 lib/gom/storage/configuration.rb
@@ -13,7 +13,7 @@ class GOM::Storage::Configuration
not_nil :name, :adapter
nested {
view {
- not_nil :name, :adapter_type
+ not_nil :name, :kind
}
}
}
@@ -83,9 +83,9 @@ def self.configure(&block)
end
def self.view(hash)
- type = hash[:adapter_type]
- method_name = :"#{type}_view"
- raise NotImplementedError, "the view type '#{type}' doesn't exists" unless self.respond_to?(method_name)
+ kind = hash[:kind]
+ method_name = :"#{kind}_view"
+ raise NotImplementedError, "the view kind '#{kind}' doesn't exists" unless self.respond_to?(method_name)
self.send method_name, hash
end
View
6 spec/lib/gom/storage/configuration_spec.rb
@@ -13,12 +13,12 @@
adapter :test
view {
name :test_object_class_view
- adapter_type :class
+ kind :class
model_class Object
}
view {
name :test_map_view
- adapter_type :map_reduce
+ kind :map_reduce
map_function "function(document) { }"
reduce_function "function(key, values) { }"
}
@@ -113,7 +113,7 @@
end
it "should raise a #{NotImplementedError} if the view type is invalid" do
- @configuration["view"] << { :name => "test", :adapter_type => "invalid" }
+ @configuration["view"] << { :name => "test", :kind => "invalid" }
lambda do
@configuration.views[:test_invalid_view]
end.should raise_error(NotImplementedError)
View
4 spec/spec_helper.rb
@@ -12,12 +12,12 @@
adapter :fake_adapter
view {
name :test_object_class_view
- adapter_type :class
+ kind :class
model_class Object
}
view {
name :test_map_view
- adapter_type :map_reduce
+ kind :map_reduce
map_function "function(document) { }"
reduce_function "function(key, values) { }"
}

0 comments on commit 99c1cab

Please sign in to comment.