akkounts/spec/features/settings/experiments_spec.rb
2023-06-16 14:34:32 +02:00

41 lines
1.3 KiB
Ruby

require 'rails_helper'
RSpec.describe 'Experimental Settings', type: :feature do
let(:user) { create :user, cn: 'jimmy', ou: 'kosmos.org' }
before do
login_as user, scope: :user
end
describe 'Adding a nostr pubkey' do
scenario 'Without nostr browser extension available' do
visit setting_path(:experiments)
expect(page).to have_content("No browser extension found")
expect(page).to have_css('button[data-settings--nostr-pubkey-target=setPubkey]:disabled')
end
# scenario 'Successfully saving a key' do
# Note: Needs a more complex JS testing setup (maybe poltergeist), not
# worth it for now
# end
end
context "With pubkey configured" do
before do
user.update! nostr_pubkey: "07e188a1ff87ce171d517b8ed2bb7a31b1d3453a0db3b15379ec07b724d232f3"
end
scenario 'Remove nostr pubkey from account' do
visit settings_experiments_path
expect(page).to have_field("nostr_public_key",
with: "07e188a1ff87ce171d517b8ed2bb7a31b1d3453a0db3b15379ec07b724d232f3",
disabled: true)
click_link "Remove"
expect(page).to_not have_field("nostr_public_key")
expect(page).to have_content("verify your public key")
expect(user.reload.nostr_pubkey).to be_nil
end
end
end