Sha256: e80635379d4862f2ee7e69ff5056c2a5449abd0bf6004022067f6e665c90ec89

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 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.strip == expected
  end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nql-0.0.3 spec/spec_helper.rb
nql-0.0.2 spec/spec_helper.rb