Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: yagooar/Transformerb
base: 5747e7dd27
...
head fork: yagooar/Transformerb
compare: c2b88b2dc0
  • 2 commits
  • 5 files changed
  • 0 commit comments
  • 1 contributor
Commits on Apr 14, 2012
Mateusz Sojka Prepared for validation testing 575e7d9
Mateusz Sojka Fixed gemfile c2b88b2
4 Gemfile
View
@@ -1,12 +1,12 @@
source "http://rubygems.org"
# Add dependencies required to use your gem here.
# Example:
- gem "activesupport", ">= 2.3.5"
+gem "activesupport", ">= 2.3.5"
+gem "fastercsv"
# Add dependencies to develop your gem here.
# Include everything needed to run rake, tests, features, etc.
group :development do
gem "rspec", "~> 2.8.0"
gem "pry"
- gem "fastercsv"
end
4 Gemfile.lock
View
@@ -1,7 +1,7 @@
GEM
remote: http://rubygems.org/
specs:
- activesupport (3.2.2)
+ activesupport (3.2.3)
i18n (~> 0.6)
multi_json (~> 1.0)
coderay (1.0.5)
@@ -9,7 +9,7 @@ GEM
fastercsv (1.5.4)
i18n (0.6.0)
method_source (0.7.1)
- multi_json (1.1.0)
+ multi_json (1.2.0)
pry (0.9.8.4)
coderay (~> 1.0.5)
method_source (~> 0.7.1)
13 lib/transformerb.rb
View
@@ -1,9 +1,3 @@
-require File.join(File.dirname(__FILE__), 'transformerb/etl.rb')
-require File.join(File.dirname(__FILE__), 'transformerb/transformer.rb')
-require File.join(File.dirname(__FILE__), 'transformerb/entity.rb')
-require File.join(File.dirname(__FILE__), 'transformerb/adapters/memory.rb')
-require File.join(File.dirname(__FILE__), 'transformerb/adapters/csv_adapter.rb')
-
require 'rubygems'
require 'active_support/inflector'
@@ -15,3 +9,10 @@
else
require 'csv'
end
+
+require File.join(File.dirname(__FILE__), 'transformerb/etl.rb')
+require File.join(File.dirname(__FILE__), 'transformerb/transformer.rb')
+require File.join(File.dirname(__FILE__), 'transformerb/validations.rb')
+require File.join(File.dirname(__FILE__), 'transformerb/entity.rb')
+require File.join(File.dirname(__FILE__), 'transformerb/adapters/memory.rb')
+require File.join(File.dirname(__FILE__), 'transformerb/adapters/csv_adapter.rb')
3  spec/fixtures/test_csv_missing_id.csv
View
@@ -0,0 +1,3 @@
+"id","First Name","Last Name"
+,"lionel","Messi"
+2,"xavier","Hernandez"
21 spec/lib/transformerb/etl_spec.rb
View
@@ -98,4 +98,25 @@
end
end
+ describe 'field validation' do
+ before do
+ @transformation = Transformerb::Etl.transform do
+ extract :csv, 'spec/fixtures/test_csv_missing_id.csv'
+
+ transform do
+ define :id do
+ validates :presence => true
+ end
+
+ end
+ end
+
+ end
+
+ it 'marks entities with missing id as not valid' do
+ @transformation.select { |entity| entity.valid? }.size.should == 1
+ end
+
+ end
+
end

No commit comments for this range

Something went wrong with that request. Please try again.