如何解决如何使用窗帘和康康舞?
尝试使用can?
方法和存根当前功能。
class UserDecorator < Draper::Decorator
delegate_all
def some_helper
can? :read,object
end
end
RSpec.describe UserDecorator,type: :decorator do
before { allow(subject).to receive(:current_ability) { Ability.new } }
subject { User.new.decorate }
it { subject.some_helper }
end
但是我收到错误消息:user does not implement: current_ability.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。