Sha256: 02a91b01bdd5ce3250ac20535c7334dba0acb0066e20f620dcbd35a99887f58c

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

require 'nql'

Dir["#{File.dirname(__FILE__)}/models/**/*.rb"].each {|f| require f}

ActiveRecord::Migrator.migrations_path = "#{File.dirname(__FILE__)}/migrations"

RSpec::Matchers.define :have_attribute do |expected|
  match do |actual|
    actual['a']['0']['name'] == expected
  end

  failure_message_for_should do |actual|
    "expected: #{actual['a']['0']['name']}\n     got: #{expected}"
  end
end

RSpec::Matchers.define :have_predicate do |expected|
  match do |actual|
    actual['p'] == expected
  end

  failure_message_for_should do |actual|
    "expected: #{actual['p']}\n     got: #{expected}"
  end
end

RSpec::Matchers.define :have_value do |expected|
  match do |actual|
    actual['v']['0']['value'] == expected
  end

  failure_message_for_should do |actual|
    "expected: #{actual['v']['0']['value']}\n     got: #{expected}"
  end
end

RSpec::Matchers.define :produce_sql do |expected|
  match do |actual|
    actual.to_sql == expected
  end

  failure_message_for_should do |actual|
    "expected: #{actual.to_sql}\n     got: #{expected}"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nql-0.0.1 spec/spec_helper.rb