Sha256: 06ea8b7b85da7b690b99ae58dad3e2f3d9aa23d15c0405362d6e46100390a8e1

Contents?: true

Size: 684 Bytes

Versions: 2

Compression:

Stored size: 684 Bytes

Contents

ENV['RAILS_ENV'] = 'test'
ENV['RAILS_ROOT'] = File.join(File.dirname(__FILE__), 'rails3.1')

require File.expand_path('config/environment', ENV['RAILS_ROOT'])

require 'rspec/rails'
require 'capybara/rails'

# some useful matchers for rails form stuff
RSpec::Matchers.define :have_error_on do |selector|
  match do |page|
    page.has_selector? ".field_with_errors \##{selector}"
  end
end

RSpec::Matchers.define :have_no_error_on do |selector|
  match do |page|
    page.has_no_selector? ".field_with_errors \##{selector}"
  end
end


RSpec::Matchers.define :have_rendered_error_on do |selector|
  match do |page|
    page.has_selector? ".errors li[data-for=#{selector}]"
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
edifice-forms-0.5.1 spec/spec_helper.rb
edifice-forms-0.5.0 spec/spec_helper.rb