mirror of
https://github.com/discourse/discourse.git
synced 2024-11-30 01:54:02 +08:00
6e161d3e75
The most common thing that we do with fab! is: fab!(:thing) { Fabricate(:thing) } This commit adds a shorthand for this which is just simply: fab!(:thing) i.e. If you omit the block, then, by default, you'll get a `Fabricate`d object using the fabricator of the same name.
30 lines
1.3 KiB
Ruby
30 lines
1.3 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
describe "User preferences for Account", type: :system do
|
|
fab!(:user)
|
|
let(:user_account_preferences_page) { PageObjects::Pages::UserPreferencesAccount.new }
|
|
let(:avatar_selector_modal) { PageObjects::Modals::AvatarSelector.new }
|
|
before { sign_in(user) }
|
|
|
|
describe "avatar-selector modal" do
|
|
it "saves custom picture and system assigned pictures" do
|
|
user_account_preferences_page.open_avatar_selector_modal(user)
|
|
expect(avatar_selector_modal).to be_open
|
|
|
|
avatar_selector_modal.select_avatar_upload_option
|
|
file_path = File.absolute_path(file_from_fixtures("logo.jpg"))
|
|
attach_file(file_path) { avatar_selector_modal.click_avatar_upload_button }
|
|
expect(avatar_selector_modal).to have_user_avatar_image_uploaded
|
|
avatar_selector_modal.click_primary_button
|
|
expect(avatar_selector_modal).to be_closed
|
|
expect(user_account_preferences_page).to have_custom_uploaded_avatar_image
|
|
|
|
user_account_preferences_page.open_avatar_selector_modal(user)
|
|
avatar_selector_modal.select_system_assigned_option
|
|
avatar_selector_modal.click_primary_button
|
|
expect(avatar_selector_modal).to be_closed
|
|
expect(user_account_preferences_page).to have_system_avatar_image
|
|
end
|
|
end
|
|
end
|