Skip to content

Commit b29eb8e

Browse files
authored
#894 - Moves admin dashboard feature spec to system specs (#1021)
Migrates admin dashboard spec to system specs, fixes a bug where it was reference the wrong method for the org logo
1 parent 4fe4b66 commit b29eb8e

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

app/views/admin/dashboard.html.erb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@
112112
<ul class="users-list clearfix">
113113
<% @recent_organizations.each do |org| %>
114114
<li>
115-
<%= image_tag(org&.logo_path) %>
115+
<%= image_tag(org&.logo)
116+
%>
116117
<%= link_to org.name, admin_organization_path(org), class: "users-list-name" %>
117118
<span class="users-list-date"><%= time_ago_in_words(org.created_at) %></span>
118119
</li>

spec/features/admin/dashboard_spec.rb renamed to spec/system/admin/dashboard_system_spec.rb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
RSpec.feature "Dashboard" do
1+
RSpec.describe "Dashboard", type: :system, js: true do
2+
subject { admin_dashboard_path }
3+
24
context "When the super admin user also has an organization assigned" do
35
before do
46
@super_admin.organization = @organization
57
@super_admin.save
68
sign_in(@super_admin)
9+
visit subject
710
end
811

9-
scenario "the side and top nav both have a link to return to their organization dashboard" do
10-
visit admin_dashboard_path
12+
it "displays a link to return to their organization dashboard on both the side and top nav" do
1113
within "section.sidebar" do
1214
expect(page).to have_xpath("//li/a[@href='#{dashboard_path(@organization.short_name)}']")
1315
end
@@ -22,10 +24,10 @@
2224
@super_admin.organization = nil
2325
@super_admin.save
2426
sign_in(@super_admin)
27+
visit subject
2528
end
2629

27-
scenario "the side and top navs DO NOT have a link to the organization dashboard" do
28-
visit admin_dashboard_path
30+
it "DOES NOT have a link to the organization dashboard in the side and top navs" do
2931
within "section.sidebar" do
3032
expect(page).not_to have_xpath("//li/a[@href='#{dashboard_path(@organization.short_name)}']")
3133
end

0 commit comments

Comments
 (0)