Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write test for warnings #3057

Merged
merged 2 commits into from
Jul 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require "rails_helper"
require "rails/generators"

RSpec.feature "ResourceMissingModels", type: :feature do
RSpec.feature "AvoWarning", type: :feature do
before :all do
Rails::Generators.invoke("avo:resource", ["bad", "--quiet", "--skip"], {destination_root: Rails.root})
end
Expand All @@ -13,12 +13,19 @@
end
end

it "tests the message" do
it "displays bad model warning" do
visit "/admin/resources/comments"

click_on_sidebar_item "Fish"
expect(page).to have_text "Avo::Resources::Bad does not have a valid model assigned. It failed to find the Bad model."
expect(page).to have_text "Please create that model or assign one using self.model_class = YOUR_MODEL"
expect(page).to have_link href: "https://docs.avohq.io/3.0/resources.html#self_model_class"
end

it "displays menu editor warning" do
visit "/admin/resources/comments"

expect(page).to have_text "The menu editor is available exclusively with the Pro license or above. Consider upgrading to access this feature."
expect(page).to have_link href: "https://docs.avohq.io/3.0/menu-editor.html"
end
end
Loading