-
-
Notifications
You must be signed in to change notification settings - Fork 258
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Write system test for happy path of creating a new schema entry
- Loading branch information
1 parent
ba830e3
commit deacacc
Showing
4 changed files
with
60 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -195,3 +195,5 @@ gem "pagy", "> 8" | |
gem "csv" | ||
|
||
gem "avo-meta", github: "avo-hq/avo-meta", branch: "main" | ||
|
||
gem "store_model" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
require "rails_helper" | ||
|
||
RSpec.describe "UserMeta", type: :system do | ||
let!(:user) { create :user } | ||
let!(:schema) { create :meta_schema } | ||
|
||
it "allows to add new entries to the user meta schema" do | ||
visit "/admin/resources/meta_schemas" | ||
|
||
click_on "User" | ||
end | ||
|
||
it "allows to add new entries to the user meta schema, which can instantly be used" do | ||
visit "/admin/resources/meta_schemas" | ||
|
||
within "#avo_meta_schemas_list" do | ||
find("td", text: "User").click | ||
end | ||
|
||
click_on "Edit" | ||
|
||
click_on "Add a new property" | ||
|
||
fill_in "Name", with: "nickname" | ||
select "string", from: find('select[name*="[schema_entries_attributes]["][name*="][type]"]')[:id] | ||
select "text", from: find('select[name*="[schema_entries_attributes]["][name*="][as]"]')[:id] | ||
|
||
save | ||
|
||
expect(page).to have_text("Meta schema was successfully updated") | ||
|
||
# assert that the new attribute is actually present and editable | ||
visit avo.resources_user_path(User.last) | ||
|
||
expect(page).to have_text("Meta") | ||
expect(page).to have_text("NICKNAME") | ||
|
||
click_on "Edit" | ||
|
||
fill_in "user_meta_nickname", with: "Ace Ventura" | ||
|
||
save | ||
|
||
expect(page).to have_text("Ace Ventura") | ||
end | ||
end |