Sha256: f227b6493104b87b357af79e1342e54ff7554f1c1f4197538c90c5754e1adbba

Contents?: true

Size: 981 Bytes

Versions: 6

Compression:

Stored size: 981 Bytes

Contents

require_relative 'spec_helper'

describe Settings do

  include GivenFilesystemSpecHelpers
  
  context "given config file" do
    before(:each) do
      @settings = Settings.new( File.expand_path('../../data/trollolorc',__FILE__) )
    end
    
    it "is not verbose by default" do
      expect(@settings.verbose).to be false
    end
    
    it "reads config file" do
      expect(@settings.developer_public_key).to eq "mykey"
      expect(@settings.member_token).to eq "mytoken"
    end
  end
  
  context "non-existent config file" do
    use_given_filesystem
  
    before(:each) do
      @config_file = given_dummy_file
      @settings = Settings.new(@config_file)
    end

    it "saves config file" do
      @settings.developer_public_key = "mypublickey"
      @settings.member_token = "mymembertoken"
      @settings.save_config
      
      expect(File.read(@config_file)).to eq "---\ndeveloper_public_key: mypublickey\nmember_token: mymembertoken\n"
    end
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
trollolo-0.0.9 spec/unit/settings_spec.rb
trollolo-0.0.8 spec/unit/settings_spec.rb
trollolo-0.0.7 spec/unit/settings_spec.rb
trollolo-0.0.6 spec/unit/settings_spec.rb
trollolo-0.0.5 spec/unit/settings_spec.rb
trollolo-0.0.4 spec/unit/settings_spec.rb