我有以下集成步骤来检查一个.credits_count
类和一个0 credits on it
.
it "show credits available at the top." do
user = Factory.create(:user)
login_as(user, :scope => :user)
page.should have_selector('.credits_count', text: '0 credits')
end
问题是当.credits_count
页面上带有文本时出现以下错误。
Credits when user is non-enabled show user credits available at the top.
Failure/Error: page.should have_selector('.credits_count', text: '0 credits')
expected css ".credits_count" with text "0 credits" to return something
# ./spec/requests/credits_spec.rb:12:in `block (3 levels) in <top (required)>'
知道为什么它没有看到.credits_count
选择器吗?
视图布局如下所示。
# app/views/layouts/application.html.haml
- if current_user
%li.credits_count
= current_user.credits_count
credits