1. Richo Healey
  2. twat

Commits

Richo Healey  committed e4851ba

Stubbed out test for config validity

  • Participants
  • Parent commits 244c359
  • Branches master

Comments (0)

Files changed (3)

File lib/twat.rb

View file
  • Ignore whitespace
       rescue InvalidCredentials
         puts "Invalid credentials, try reauthenticating with"
         puts "twat -a #{opts[:account]}"
+      rescue ConfigVersionIncorrect
+        puts "Your config file is out of date. Run with --update-config to rememdy"
       end
     end
   end

File lib/twat/config.rb

View file
  • Ignore whitespace
     def config
       begin
         @config ||= YAML.load_file(config_path)
+        unless valid?(@config)
+          raise ConfigVersionIncorrect
+        end
       rescue Errno::ENOENT
         raise NoConfigFile
       end
     end
 
+    def valid(conf)
+      true # FIXME
+    end
+
     def save!
       File.open(config_path, 'w') do |conf|
         conf.chmod(0600)

File lib/twat/exceptions.rb

View file
  • Ignore whitespace
   class NoConfigFile < Exception; end
   class Usage < Exception; end
   class InvalidCredentials < Exception; end
+  class ConfigVersionIncorrect < Exception; end
 end