[email protected]

On Sun, Feb 2, 2014 at 1:05 AM, <[email protected]> wrote:

>   Today's Topic Summary
>
> Group: http://groups.google.com/group/sequel-talk/topics
>
>    - after_commit with transactional 
> tests<#143f1d820a09225f_group_thread_0>[1 Update]
>    - Sequel 4.7.0 Released <#143f1d820a09225f_group_thread_1> [1 Update]
>
>   after_commit with transactional 
> tests<http://groups.google.com/group/sequel-talk/t/e89064531f272e3f>
>
>    Sean West <[email protected]> Feb 01 10:36PM -0800
>
>    I'm utilizing the after_commit hook to run some background jobs and it
>    is
>    working great. I am running into problems with the tests though as
>    each
>    test is transactional and triggering a rollback, so after_commit is
>    never
>    called.
>
>    I am using Test::Unit for my tests with the run method overridden as
>    suggested by the 'Testing with Sequel' document:
>
>    http://sequel.jeremyevans.net/rdoc/files/doc/testing_rdoc.html
>
>    class SequelTestCase < Test::Unit::TestCase
>    def run(*args, &block)
>    result = nil
>    Sequel::Model.db.transaction(:rollback=>:always){result = super}
>    result
>    endend
>
>
>    What is the best way to ensure that the after_commit hooks are called
>    when
>    running the tests? I imagine others have run into this problem before
>    as
>    well, however I can't find any clues out there for Sequel. Is there
>    something simple I'm missing?
>
>    I'm currently hacking my way around it by simply calling the
>    after_commit
>    method directly from my test.
>
>    Using Sequel 4.6.0
>
>    Thanks!
>
>    - Sean
>
>
>
>   Sequel 4.7.0 
> Released<http://groups.google.com/group/sequel-talk/t/7048d484a422e5eb>
>
>    Jeremy Evans <[email protected]> Feb 01 09:38AM -0800
>
>    Sequel 4.7.0 has been released!
>
>    = New Features
>
>    * Alternatives for the more complex virtual row method calls have
>    been added:
>
>    # Window Functions using SQL::Function#over
>    # before: select{sum(:over, :args=>:col1, :partition=>:col2){}}
>    select{sum(:col1).over(:partition=>:col2)}
>
>    # count(*) using SQL::Function#*
>    # before: select{count(:*){}}
>    select{count{}.*}
>
>    # count(distinct col) using SQL::Function#distinct
>    # before: select{count(:distinct, :col){}}
>    select{count(:col).distinct}
>
>    Additionally, schema qualified functions are now supported via
>    SQL::QualifiedIdentifier#function, and quoted functions are now
>    supported via SQL::Identifier#function on some databases:
>
>    # "func"("col")
>    select{func.function(:col)}
>
>    # "schema"."func"("col1")
>    select{schema__func.function(:col1)}
>
>    If the database does not support quoting function names, then
>    Sequel will not quote them.
>
>    * An update_or_create plugin has been added, for updating a matching
>    object if one exists, or creating an object if it does not. For
>    example, the following code will update the number of copies sold
>    for album with the name 'Hello', or it will create an album with
>    the name 'Hello' and 1000 number of copies sold:
>
>    Album.plugin :update_or_create
>    Album.update_or_create(:name=>'Hello') do |album|
>    album.num_copies_sold = 1000
>    end
>
>    You can also use a shorter form of this, with two hashes:
>
>    Album.update_or_create({:name=>'Hello'}, {:num_copies_sold=>1000})
>
>    This plugin also adds a method named find_or_new, which does the
>    same thing as update_or_create, except it doesn't persist any
>    changes.
>
>    * A :raise_on_save_failure option has been added for one_to_many,
>    pg_array_to_many, and many_to_pg_array associations. This mirrors
>    the Model.raise_on_save_failure setting, and if set to false, it
>    will make the add/remove methods return nil instead of raising
>    an error if there is a validation/hook error when saving the
>    associated record.
>
>    * The validates_unique validation in validation_helpers now supports a
>    :dataset option to provide the base dataset to use to check
>    uniqueness. This is useful when the model itself uses a filtered
>    dataset, but the unique index in the database is on an unfiltered
>    dataset.
>
>    The auto_validations plugin uses this option to ensure that unique
>    validations are setup correctly in subclasses using single table
>    inheritance.
>
>    = Other Improvements
>
>    * Sequel now automatically rolls back transactions in killed threads
>    on ruby 2.0+. It is still impossible to do so on ruby 1.9.
>
>    * In the instance_hooks plugin, validation instance hooks are now
>    not cleared until after a successful save.
>
>    * Composite unique key constraint violations are now recognized
>    and raised as Sequel::UniqueConstraintViolation on SQLite.
>
>    * Primary key unique constraint violations are now recognized and
>    and raised as Sequel::UniqueConstraintViolation on Microsoft
>    SQL Server and SQLAnywhere.
>
>    * If an exception occurs when using a cursor in the postgres adapter,
>    and an exception also occurs when closing the cursor when cleaning
>    up, the initial exception is now raised.
>
>    * You can now get tables in a specific schema in the jdbc adapter
>    using the :schema option to Database#tables. This was already
>    supported in most jdbc subadapters because they implement #tables
>    using database specific code instead of looking at the JDBC
>    metadata, but it should now work for all jdbc subadapters.
>
>    * Sequel::SQLTime#to_s is now defined and returns a string in
>    HH:MM:SS format (leaving off the date).
>
>    = Backwards Compatibility
>
>    * The odbc adapter's :driver option is no longer deprecated, as reports
>    were received that it still works.
>
>    * If you were re-adding instance validation hooks using instance_hooks
>    after a save failure, and then retrying the save, you may now end up
>    with duplicate validations. You no longer need to re-add validation
>    hooks unless the object was saved successfully.
>
>    Thanks,
>    Jeremy
>
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "sequel-talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/sequel-talk.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to