summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2013-07-20 18:15:46 -0600
committermo khan <mo@mokhan.ca>2013-07-20 18:15:46 -0600
commit64879137b1f71004f576ca01defc177c9654da7b (patch)
tree8ba90c6670f60530b42cb2f4b29a3b0052c589bf
parent8b74491e2eed3f9a4a4e3c0a7d2a4f457c2d2494 (diff)
add specs for default data row mapper
-rw-r--r--Gemfile.lock2
-rw-r--r--spec/unit/default_data_row_mapper_spec.rb24
2 files changed, 25 insertions, 1 deletions
diff --git a/Gemfile.lock b/Gemfile.lock
index d90d142..af61291 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
- humble (0.0.1374365339)
+ humble (0.0.1374365736)
sequel
GEM
diff --git a/spec/unit/default_data_row_mapper_spec.rb b/spec/unit/default_data_row_mapper_spec.rb
new file mode 100644
index 0000000..cfc6ce5
--- /dev/null
+++ b/spec/unit/default_data_row_mapper_spec.rb
@@ -0,0 +1,24 @@
+require "spec_helper"
+class Book
+ attr_reader :id, :name
+
+ def initialize(attributes)
+ @id = attributes[:id]
+ @name = attributes[:name]
+ end
+end
+
+describe Humble::DefaultDataRowMapper do
+ let(:sut) { Humble::DefaultDataRowMapper.new(configuration) }
+ let(:configuration) { { :type => Book } }
+
+ let(:result) { sut.map_from({:id => 1, :name => 'blah'}) }
+
+ it "should map the id" do
+ result.id.should == 1
+ end
+
+ it "should map the name" do
+ result.name.should == "blah"
+ end
+end