spec/grinder_spec.rb in philtre-0.1.0 vs spec/grinder_spec.rb in philtre-0.1.1

- old
+ new

@@ -1,9 +1,6 @@ -require 'rspec' -require 'faker' -require 'sequel' -require 'ripar' +require_relative 'spec_helper.rb' require_relative '../lib/philtre.rb' Sequel.extension :blank Sequel.extension :core_extensions @@ -159,10 +156,12 @@ nds = grinder.transform tds nds.sql.should =~ /FROM\s+ods\s+WHERE\s*\(\s*person_id\s*=\s*212728\s*\)/ end it 'handles rollers' do + pending "Ripar optionally not loaded" unless defined? Ripar + grinder = Philtre::Grinder.new Philtre::Filter.new(person_id: 212728) tds = ds.roller do where linkage: other_ds.where( :person_id.lieu ) end tds.__class__.should == Ripar::Roller @@ -170,11 +169,11 @@ nds = grinder.transform tds nds.sql.should =~ /FROM\s+ods\s+WHERE\s*\(\s*person_id\s*=\s*212728\s*\)/ end it 'handles Models' do - Sequel::Model.db = Sequel.sqlite + Sequel::Model.db = Sequel.mock class Ods < Sequel::Model(:ods); end Philtre::Grinder.new( Philtre::Filter.new ).transform(Ods).should be_a(Sequel::Dataset) - Philtre::Grinder.new( Philtre::Filter.new ).transform(Ods).sql.should =~ /SELECT \* FROM .ods./ + Philtre::Grinder.new( Philtre::Filter.new ).transform(Ods).sql.should =~ /SELECT \* FROM ods/ end end