Answer the question
In order to leave comments, you need to log in
I don't understand how to test a method in a rails model?
I have a method
def self.test(test_id)
Admin.joins(:test_roles).where('admins_role.test_id = ?', test_id)
end
has_and_belongs_to_many :test_roles {join_table: :admins_role, class_name: 'Role'}
Answer the question
In order to leave comments, you need to log in
What model method? Admin?
If yes, then saw the sinter
describe Admin do
it '#self.test' do
expect(described_class.test(zalupa_id)).to eq('ya_obeshau_chitat_dokumentaciu')
end
end
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question