-
-
Notifications
You must be signed in to change notification settings - Fork 911
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
validate_presence_of broken in 3.0.0 #797
Comments
In 3.0, matchers are now mixed into specific example groups tagged with |
@mcmire it would be good to add that somewhere to documentation. Because if @baburdick ;) |
Great, I added a new issue for this above. Closing this one now. |
This should be reopened IMO. I'm running Ruby: 2.2.3
source 'https://rubygems.org'
ruby '2.2.3'
gem 'rails', '~> 4.2.4'
# other gems ...
group :test do
gem 'shoulda-matchers'
gem 'capybara'
gem 'simplecov', require: false
end
group :development, :test do
gem 'rspec-rails'
gem 'factory_girl_rails'
end
ENV["RAILS_ENV"] ||= 'test'
require 'simplecov' if ENV['COV']
require 'spec_helper'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'shoulda/matchers'
require 'capybara/rspec'
# This line has the downside of increasing the boot-up time by
# auto-requiring all files in the support directory.
# Alternatively, in the individual `*_spec.rb` files, manually
# require only the support files necessary.
#
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
# Checks for pending migrations before tests are run.
# If you are not using ActiveRecord, you can remove this line.
ActiveRecord::Migration.maintain_test_schema!
RSpec.configure do |config|
config.use_transactional_fixtures = true
config.infer_base_class_for_anonymous_controllers = false
config.infer_spec_type_from_file_location!
config.include FactoryGirl::Syntax::Methods
config.include Capybara::DSL
end
suppress_warnings { BCrypt::Engine::DEFAULT_COST = 4 } Model file ( class Foo
include ActiveModel::Model
attr_accessor :title, :body
validates :title, presence: true
end Model spec ( require 'rails_helper'
RSpec.describe Foo, type: :model do
it { should validate_presence_of(:title) }
end Output from running
Adding Please advise. |
@brianjlandau Requiring shoulda-matchers manually in |
@mcmire Got it, thanks! Surprised auto-configuring has caused so much trouble, I always found it worked perfectly. But thanks for pointing me in the way of documentation for this. |
@mcmire thanks. Your info helped! |
Downgrading to 2.8.0 fixes this:
I have the recommended configuration in
spec/spec_helper.rb
:The text was updated successfully, but these errors were encountered: