Sha256: 108e9256f0bc758514bef629346834e3fd70a70c4dff23303085d536f21e71a6
Contents?: true
Size: 1.16 KB
Versions: 3
Compression:
Stored size: 1.16 KB
Contents
require 'spec_helper' require 'hobo/paths' require 'hobo/config/file' describe Hobo::Config::File do before do Hobo.project_path = nil FakeFS.activate! end after do FakeFS::FileSystem.clear FakeFS.deactivate! end def fake_config { :string => "string", :integer => 0, :boolean => true, :hash => { :test => true }, :array => [ 1 ] } end describe "save" do it "should save config hash to specified file" do Hobo::Config::File.save "test.yaml", fake_config File.read("test.yaml").should match /string: string/ end end describe "load" do it "should load config hash from file" do Hobo::Config::File.save "test.yaml", fake_config fake_config().should eq Hobo::Config::File.load("test.yaml") end it "should return empty hash if file does not exist" do Hobo::Config::File.load("test.yaml").should eq({}) end it "should raise error if file can't be parsed" do File.write("test.yaml", "##Invalid yaml file") expect { Hobo::Config::File.load("test.yaml") }.to raise_error(RuntimeError, "Invalid hobo configuration (test.yaml)") end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
hobo-inviqa-0.0.4 | spec/hobo/config/file_spec.rb |
hobo-inviqa-0.0.3 | spec/hobo/config/file_spec.rb |
hobo-inviqa-0.0.2 | spec/hobo/config/file_spec.rb |