shoulda-matchers
shoulda-matchers copied to clipboard
Simple one-liner tests for common Rails functionality
I'm creating this issue as a reminder to remove this deprecated method. https://github.com/thoughtbot/shoulda-matchers/blob/3e9d69ba7b6cc37251deb08f1a8866c97cf2bc0c/lib/shoulda/matchers/active_record/define_enum_for_matcher.rb#L206-L212
I am running into problems using `allow_value` with an alias attribute. This is my model, which has a column called `custom_data`, aliased as `metadata`. ``` class Widget < ApplicationRecord alias_attribute...
Suggestion: instead of creating the table manually, use the command 'bundle exec rake active_storage: install: migrations'.
The uniqueness validation matcher generates a fake class when the scope name ends on _type. This fake class is a duplicate of the original class. In most cases this is...
Hello, I'm trying to validate the existence of a HABTM relationship on my models, having one of the models defining is primary key as a composite key (using `rails_composite_keys`). My...
So, let's say we have: ``` # app/models/product.rb class Product < ApplicationRecord has_many :prices validates :code, presence: true, uniqueness: true validate :custom_validation def custom_validation prices.length > 1 end end ```...
Allows to create tests checking set foreign_type ```ruby class Visitor < ActiveRecord::Base belongs_to :location, foreign_type: :facility_type, polymorphic: true end class Hotel < Location has_many :visitors, inverse_of: :location, foreign_type: :facility_type, as:...
Would you guys be open to a PR to add a method into the `have_db_column` chain that checks the `sql_type` of the column? Currently there is only one for `type`...
I found an issue when I use the STI model on my apps ``` ruby class ApplicationRecord < ActiveRecord::Base self.abstract_class = true end class ContentSource < ApplicationRecord end class Facebook...