diff --git a/app/views/dashboards/_analytics.html.erb b/app/views/dashboards/_analytics.html.erb index 24e76fbb7..b87a2fb61 100644 --- a/app/views/dashboards/_analytics.html.erb +++ b/app/views/dashboards/_analytics.html.erb @@ -12,12 +12,12 @@
- <%= @user.listings.count %> + <%= @user.listings.size %> Listings created
- <%= @user.credits.count %> + <%= @user.unspent_credits_count %> Credits available
diff --git a/spec/system/dashboards/user_visits_dashboard_spec.rb b/spec/system/dashboards/user_visits_dashboard_spec.rb new file mode 100644 index 000000000..79ffefb14 --- /dev/null +++ b/spec/system/dashboards/user_visits_dashboard_spec.rb @@ -0,0 +1,30 @@ +require "rails_helper" + +RSpec.describe "Dashboard", type: :system, js: true do + let(:user) { create(:user) } + let(:listing) { create(:listing) } + + before do + sign_in user + end + + context "when looking at analytics counters" do + it "shows the count of unspent credits" do + Credit.add_to(user, 2) + + Credits::Buyer.call( + purchaser: user, + purchase: listing, + cost: 1, + ) + Credit.counter_culture_fix_counts + user.reload + + visit dashboard_path + + within "main > header" do + expect(page).to have_text("1") + end + end + end +end