.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