Sha256: ebb6b0796874270d4bbe5f59ea4880d56ce2e427a17952c4a0c4e4dd108107ce

Contents?: true

Size: 1.04 KB

Versions: 4

Compression:

Stored size: 1.04 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

4 entries across 4 versions & 1 rubygems

Version Path
nql-0.1.1 spec/spec_helper.rb
nql-0.1.0 spec/spec_helper.rb
nql-0.0.5 spec/spec_helper.rb
nql-0.0.4 spec/spec_helper.rb