Permalink
Browse files

implemented first acceptance spec

  • Loading branch information...
0 parents commit 7ec9eaee183b98342214820c52ad17d99c2db568 @phifty committed Oct 27, 2010
Showing with 131 additions and 0 deletions.
  1. +4 −0 .gitignore
  2. +20 −0 LICENSE
  3. +6 −0 README.rdoc
  4. +54 −0 Rakefile
  5. +3 −0 spec/acceptance/storage.configuration
  6. +41 −0 spec/acceptance/storage_spec.rb
  7. +3 −0 spec/spec_helper.rb
@@ -0,0 +1,4 @@
+.idea
+pkg
+html
+doc
20 LICENSE
@@ -0,0 +1,20 @@
+Copyright (c) 2010 Philipp Brüll
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,6 @@
+
+= General Object Mapper
+
+== Development
+
+GOM is still in an early phase of development. Any bug report and contribution is welcome!
@@ -0,0 +1,54 @@
+require 'rubygems'
+gem 'rspec'
+require 'spec'
+require 'rake/rdoctask'
+require 'rake/gempackagetask'
+require 'spec/rake/spectask'
+
+task :default => :spec
+
+specification = Gem::Specification.new do |specification|
+ specification.name = "gom"
+ specification.version = "0.0.1"
+ specification.date = "2010-10-27"
+
+ specification.authors = [ "Philipp Bruell" ]
+ specification.email = "b.phifty@gmail.com"
+ specification.homepage = "http://github.com/phifty/gom"
+ specification.rubyforge_project = "gom"
+
+ specification.summary = ""
+ specification.description = ""
+
+ specification.has_rdoc = true
+ specification.files = [ "README.rdoc", "LICENSE", "Rakefile" ] + Dir["lib/**/*"] + Dir["spec/**/*"]
+ specification.extra_rdoc_files = [ "README.rdoc" ]
+ specification.require_path = "lib"
+
+ specification.test_files = Dir["spec/**/*_spec.rb"]
+end
+
+Rake::GemPackageTask.new(specification) do |package|
+ package.gem_spec = specification
+end
+
+desc "Generate the rdoc"
+Rake::RDocTask.new do |rdoc|
+ rdoc.rdoc_files.add [ "README.rdoc", "lib/**/*.rb" ]
+ rdoc.main = "README.rdoc"
+ rdoc.title = ""
+end
+
+desc "Run all specs in spec directory"
+Spec::Rake::SpecTask.new do |task|
+ task.spec_files = FileList["spec/lib/**/*_spec.rb"]
+end
+
+namespace :spec do
+
+ desc "Run all integration specs in spec/acceptance directory"
+ Spec::Rake::SpecTask.new(:acceptance) do |task|
+ task.spec_files = FileList["spec/acceptance/**/*_spec.rb"]
+ end
+
+end
@@ -0,0 +1,3 @@
+
+test:
+ adapter: test
@@ -0,0 +1,41 @@
+require File.expand_path(File.join(File.dirname(__FILE__), "..", "spec_helper"))
+
+class TestAdapter < GOM::Storage::Adapter
+
+ OBJECTS = {
+ "house_1" => {
+ "number" => 5
+ }
+ }.freeze
+
+ def fetch_object(id)
+ OBJECTS[id]
+ end
+
+end
+
+GOM::Storage.register_adapter :test, TestAdapter
+
+GOM::Storage.read_configuration File.join(File.dirname(__FILE__), "storage.configuration")
+
+class House
+
+ attr_reader :id
+ attr_accessor :number
+
+end
+
+describe "storage" do
+
+ describe "fetching an object" do
+
+ it "should return the correct object" do
+ house = GOM::Storage.fetch "house_1"
+ house.should_not be_nil
+ house.id.should == "house_1"
+ house.number.should == 5
+ end
+
+ end
+
+end
@@ -0,0 +1,3 @@
+require 'rubygems'
+gem 'rspec', '1.3.0'
+require 'spec'

0 comments on commit 7ec9eae

Please sign in to comment.