Admin can set bugherd API key

This commit is contained in:
Rohan Mitchell
2016-05-04 11:42:07 +10:00
parent 4d6a21254f
commit 9ac6de4215
3 changed files with 40 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
module Spree
module Admin
GeneralSettingsController.class_eval do
end
module GeneralSettingsEditPreferences
def edit
super
@preferences_general << :bugherd_api_key
end
end
GeneralSettingsController.send(:prepend, GeneralSettingsEditPreferences)
end
end

View File

@@ -23,4 +23,7 @@ Spree::AppConfiguration.class_eval do
# Monitoring
preference :last_job_queue_heartbeat_at, :string, default: nil
# External services
preference :bugherd_api_key, :string, default: nil
end

View File

@@ -0,0 +1,22 @@
require 'spec_helper'
feature 'External services' do
include AuthenticationWorkflow
describe "bugherd" do
before do
Spree::Config.bugherd_api_key = nil
login_to_admin_section
end
it "lets me set an API key" do
visit spree.edit_admin_general_settings_path
fill_in 'bugherd_api_key', with: 'abc123'
click_button 'Update'
page.should have_content 'General Settings has been successfully updated!'
expect(Spree::Config.bugherd_api_key).to eq 'abc123'
end
end
end