-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow updating of settings through the gui
- Loading branch information
Showing
3 changed files
with
58 additions
and
0 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
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,5 @@ | ||
install: test/install | ||
local_index_path: test/index | ||
remote_index_uri: http://patcher.example.com/index | ||
login_server: http://login.example.com/ | ||
port: 12345 |
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 |
---|---|---|
@@ -1,12 +1,46 @@ | ||
require 'spec_helper' | ||
|
||
describe Launchpad::Settings do | ||
let(:settings_fixture) { 'spec/fixtures/config/settings.yml' } | ||
let(:settings_path) { 'spec/fixtures/config/current-settings.yml' } | ||
|
||
before do | ||
FileUtils.copy settings_fixture, settings_path | ||
stub_const 'Launchpad::Settings::PATH', settings_path | ||
end | ||
|
||
after do | ||
File.delete settings_path | ||
end | ||
|
||
describe '.read' do | ||
it 'should access saved settings' do | ||
expect(described_class.read :install) | ||
.to eq 'test/install' | ||
|
||
expect(described_class.read :login_server) | ||
.to eq 'http://login.example.com/' | ||
end | ||
end | ||
|
||
describe '.update' do | ||
it 'should update a given settings value' do | ||
expect { described_class.update :install, 'test/updated' } | ||
.to change { described_class.read :install } | ||
.from('test/install') | ||
.to('test/updated') | ||
end | ||
end | ||
|
||
describe '.save' do | ||
before do | ||
described_class.update :install, 'test/updated' | ||
described_class.save | ||
end | ||
|
||
it 'should update the yaml file with new values' do | ||
expect(described_class.clone.read :install) | ||
.to eq 'test/updated' | ||
end | ||
end | ||
end |