test/test_helper.rb in set_builder-2.0.0.beta1 vs test/test_helper.rb in set_builder-2.0.0.beta2

- old
+ new

@@ -4,18 +4,18 @@ require "active_support/core_ext" require "set_builder" require "pry" require "support/fake_connection" +require "minitest/reporters" +Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new - # Sample class used by tests SetBuilder::ValueMap.register(:school, [[1, "Concordia"], [2, "McKendree"]]) -class Friend - extend SetBuilder +$friend_traits = SetBuilder::Traits.new do trait('who are [not] "awesome"') do |query, scope| scope << {:conditions => {:awesome => true}} end @@ -39,30 +39,31 @@ end trait('whose "name" <string>') do |query, scope| scope << {:conditions => query.modifiers[0].build_conditions_for("friends.name")} end - - # by stubbing out scoped, we can unit test the `performed` features - def self.to_scope +end + + +class Friend + + # by stubbing out `all`, we can unit test `Set#perform` + def self.all [] end - - - + + # Stubs so that Arel can SQL - + attr_accessor :connection_pool - + def initialize @connection_pool = Fake::ConnectionPool.new end - + def connection connection_pool.connection end - - - + end Arel::Table.engine = Arel::Sql::Engine.new(Friend.new)