<commit_before>require 'fileutils'
require 'spec_helper'
require 'torquebox-messaging'

describe "torquebox-messaging with datamapper" do

  deploy <<-END.gsub(/^ {4}/,'')

    application:
      root: #{File.dirname(__FILE__)}/../apps/sinatra/datamapper-messaging
      env: development
    web:
      context: /datamapper-messaging
    ruby:
      version: #{RUBY_VERSION[0,3]}
    queues:
      /queue/backchannel:
  END

  before(:each) do
    @queue = TorqueBox::Messaging::Queue.new( '/queue/backchannel' )
  end

  after(:all) do
    db = File.join(File.dirname(__FILE__), '..', 'apps', 'sinatra',
                   'datamapper-messaging', 'dm-messaging-test.db')
    FileUtils.rm_f(db)
  end
  
  it "should support always_backgrounded jobs on DataMapper::Resource" do
    visit '/datamapper-messaging/foo/hello'
    page.should have_content('success')
    @queue.receive( :timeout => 120_000 ).should == 'hello'
  end

  it "should support ad hoc backgrounded jobs on DataMapper::Resource" do
    visit '/datamapper-messaging/bar/world'
    page.should have_content('success')
    @queue.receive( :timeout => 120_000 ).should == 'world'
  end

end

<commit_msg>Pend two datamapper integs until datamapper releases JRuby 1.7 support<commit_after>require 'fileutils'
require 'spec_helper'
require 'torquebox-messaging'

describe "torquebox-messaging with datamapper" do

  deploy <<-END.gsub(/^ {4}/,'')

    application:
      root: #{File.dirname(__FILE__)}/../apps/sinatra/datamapper-messaging
      env: development
    web:
      context: /datamapper-messaging
    ruby:
      version: #{RUBY_VERSION[0,3]}
    queues:
      /queue/backchannel:
  END

  before(:each) do
    @queue = TorqueBox::Messaging::Queue.new( '/queue/backchannel' )
  end

  after(:all) do
    db = File.join(File.dirname(__FILE__), '..', 'apps', 'sinatra',
                   'datamapper-messaging', 'dm-messaging-test.db')
    FileUtils.rm_f(db)
  end
  
  it "should support always_backgrounded jobs on DataMapper::Resource" do
    pending 'JRuby 1.7-compatible do_sqlite3 release' if JRUBY_VERSION =~ /^1\.7/
    visit '/datamapper-messaging/foo/hello'
    page.should have_content('success')
    @queue.receive( :timeout => 120_000 ).should == 'hello'
  end

  it "should support ad hoc backgrounded jobs on DataMapper::Resource" do
    pending 'JRuby 1.7-compatible do_sqlite3 release' if JRUBY_VERSION =~ /^1\.7/
    visit '/datamapper-messaging/bar/world'
    page.should have_content('success')
    @queue.receive( :timeout => 120_000 ).should == 'world'
  end

end


{'fraction_non_alphanumeric': 0.13616855247756535, 'fraction_numerical': 0.016387046429964885, 'mean_word_length': 3.3979416809605487, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5006556', 'n_tokens_mistral': 938, 'n_tokens_neox': 847, 'n_words': 191}