rspec-virtus
rspec-virtus copied to clipboard
Allow new RSpec matcher syntax
Currently We have to use old syntax for matching:
it { expect(described_class).to have_attribute(:title) }
It would be much nicer if we could keep the old implementation, as well as using the new and improved version:
it { is_expected.to have_attribute(:title) }
There is a difference between these two examples, the former is a class level and the latter is an instance level expectation.
The latter one works if you define described_class
as subject
context 'attributes' do
subject { described_class }
it { is_expected.to have_attribute(:title) }
end