Skip to content

Instantly share code, notes, and snippets.

@dmacvicar
Created September 2, 2010 08:43
Show Gist options
  • Save dmacvicar/562061 to your computer and use it in GitHub Desktop.
Save dmacvicar/562061 to your computer and use it in GitHub Desktop.
diff --git a/spec/fixture_spec.rb b/spec/fixture_spec.rb
index 638e652..a571693 100644
--- a/spec/fixture_spec.rb
+++ b/spec/fixture_spec.rb
@@ -163,4 +163,39 @@ describe "IniParse" do
IniParse.parse(@fixture).to_ini.should == @fixture
end
end
+
+ describe 'oscrc.ini fixture' do
+ before(:all) do
+ @fixture = fixture('oscrc.ini')
+ end
+
+ it 'should parse without any errors' do
+ lambda { IniParse.parse(@fixture) }.should_not raise_error
+ end
+
+ it 'should have the correct sections' do
+ IniParse.parse(@fixture).lines.keys.should == [
+ 'https://api.opensuse.org', 'http://api.host.org'
+ ]
+ end
+
+ it 'should have the correct options' do
+ # Test the keys from one section.
+ doc = IniParse.parse(@fixture)
+ section = doc['https://api.opensuse.org']
+
+ section.lines.keys.should == [
+ 'user', 'pass', 'passx'
+ ]
+
+ section['user'].should == 'someusername'
+ section['pass'].should == 'somepassword'
+ section['passx'].should == 'EiujkhfdJEEEjDDJJjDJDJD233232=='
+ end
+
+ it 'should be identical to the original when calling #to_ini' do
+ IniParse.parse(@fixture).to_ini.should == @fixture
+ end
+ end
+
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment