Sha256: f0e25a96a58a7a4a6b657189de96d5e814c2d5d360da0b513b1e4a74df95bc2d
Contents?: true
Size: 1.49 KB
Versions: 3
Compression:
Stored size: 1.49 KB
Contents
require 'spec_helper' describe "Text file format" do before :each do VersionInfo.file_format = :text @test_module = Module.new @test_module.send :include, VersionInfo @test_module::VERSION.file_name = nil end it "has default filename" do @test_module::VERSION.file_name.should == Dir.pwd + '/' + 'VERSION' end it "is initalized" do @test_module::VERSION.to_hash.should == {:major => 0, :minor => 0, :patch => 0 } end it "can save " do io = StringIO.new File.should_receive(:open).and_yield(io) @test_module::VERSION.bump(:minor) @test_module::VERSION.save io.string.should == "0.1.0\n" end it "can save custom data " do io = StringIO.new File.should_receive(:open).and_yield(io) @test_module::VERSION.bump(:minor) @test_module::VERSION.author = 'jcangas' @test_module::VERSION.email = 'jorge.cangas@gmail.com' @test_module::VERSION.save io.string.should == <<END 0.1.0 author: jcangas email: jorge.cangas@gmail.com END end it "can load " do io = StringIO.new("1.2.3") File.should_receive(:open).and_yield(io) @test_module::VERSION.load @test_module::VERSION.to_hash.should == {:major => 1, :minor => 2, :patch => 3 } end it "can load custom data " do io = StringIO.new("1.2.3\nauthor: jcangas\n") File.should_receive(:open).and_yield(io) @test_module::VERSION.load @test_module::VERSION.to_hash.should == {:major => 1, :minor => 2, :patch => 3, :author => 'jcangas' } end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
version_info-1.7.7 | spec/version_info/text_format_spec.rb |
version_info-1.7.6 | spec/version_info/text_format_spec.rb |
version_info-1.7.5 | spec/version_info/text_format_spec.rb |