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 setting_path(:experiments) expect(page).to have_field("nostr_public_key", with: "npub1qlsc3g0lsl8pw8230w8d9wm6xxcax3f6pkemz5measrmwfxjxteslf2hac", 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