FIX/FEATURE: don't blow up when can't reach theme's repo, show problem themes on dashboard

This commit is contained in:
OsamaSayegh
2018-09-08 16:24:11 +03:00
committed by Sam
parent ca28548762
commit c7d81e2682
14 changed files with 139 additions and 22 deletions

View File

@ -351,4 +351,19 @@ describe AdminDashboardData do
expect(dashboard_data.out_of_date_themes).to eq(nil)
end
end
describe '#unreachable_themes' do
let(:remote) { RemoteTheme.create!(remote_url: "https://github.com/org/testtheme", last_error_text: "can't reach repo :'(") }
let!(:theme) { Fabricate(:theme, remote_theme: remote, name: "Test< Theme") }
it "outputs correctly formatted html" do
dashboard_data = described_class.new
expect(dashboard_data.unreachable_themes).to eq(
I18n.t("dashboard.unreachable_themes") + "<ul><li><a href=\"/admin/customize/themes/#{theme.id}\">Test&lt; Theme</a></li></ul>"
)
remote.update!(last_error_text: nil)
expect(dashboard_data.out_of_date_themes).to eq(nil)
end
end
end