Skip to content

Commit

Permalink
Write test for warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
binarygit committed Jul 25, 2024
1 parent b808f0f commit 5e1d2d0
Showing 1 changed file with 9 additions and 2 deletions.
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" do
visit "/admin/resources/comments"

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

0 comments on commit 5e1d2d0

Please sign in to comment.