spec/views/hyrax/admin/stats/show.html.erb_spec.rb in hyrax-1.1.1 vs spec/views/hyrax/admin/stats/show.html.erb_spec.rb in hyrax-2.0.0.beta1
- old
+ new
@@ -1,18 +1,22 @@
-describe "hyrax/admin/stats/show.html.erb", type: :view do
+RSpec.describe "hyrax/admin/stats/show.html.erb", type: :view do
let(:presenter) do
Hyrax::AdminStatsPresenter.new({}, 5)
end
+
before do
assign(:presenter, presenter)
allow(presenter).to receive(:top_formats).and_return([])
+ allow(presenter).to receive(:works_count).and_return(total: 0)
+ allow(presenter).to receive(:depositors).and_return([])
end
context "default depositors" do
let(:top_5_active_users) do
(1..5).map { |i| double(label: i.to_s, value: i) }
end
+
before do
allow(presenter).to receive(:active_users).and_return(top_5_active_users)
render
end
it "shows top 5 depositors and option to view more" do
@@ -23,9 +27,10 @@
context "top 20 depositors" do
let(:top_20_active_users) do
(1..20).map { |i| double(label: i.to_s, value: i) }
end
+
before do
allow(presenter).to receive(:active_users).and_return(top_20_active_users)
allow(presenter).to receive(:limit).and_return(20)
render
end