Sha256: cbcabce8909f166d4d5fa24686b88fc6da7a6a933a8325fb36c8599af18aea2b

Contents?: true

Size: 1.57 KB

Versions: 51

Compression:

Stored size: 1.57 KB

Contents

require File.join(File.dirname(__FILE__), "..", "spec_helper")

module Redcar
  describe Declarations::File do
    before do
      @tags_file = File.join(File.dirname(__FILE__), "..", "tags")
    end
    
    after do
      FileUtils.rm_f(@tags_file)
    end
    
    describe "dump and load from file" do
      describe "with no existing tags file" do
        before do
          @file = Declarations::File.new(@tags_file)
        end
        
        it "should have no tags" do
          @file.tags.should be_empty
        end
        
        it "should add new tags" do
          @file.add_tags([%w"Abc /foo class:Abc"])
          @file.tags.length.should == 1
        end
        
        describe "with tags added" do
          before do
            @file.add_tags([%w"Abc /foo class:Abc"])
          end
          
          it "should dump a tags file" do
            @file.dump
            File.exist?(@tags_file).should be_true
          end
        end
      end
      
      describe "with existing tags file" do
        before do
          file = Declarations::File.new(@tags_file)
          file.add_tags([%w"Abc /foo class:Abc"])
          file.last_updated = Time.now
          @last_updated = Time.now
          file.dump
          @file = Declarations::File.new(@tags_file)
        end
        
        it "should load up the tags" do
          @file.tags.should == [%w"Abc /foo class:Abc"]
        end
        
        it "should know the timestamp of when it was last updated" do
          @file.last_updated.to_s.should == @last_updated.to_s
        end
      end
    end
    
  end
end

Version data entries

51 entries across 51 versions & 2 rubygems

Version Path
redcar-dev-0.12.17dev plugins/declarations/spec/declarations/file_spec.rb
redcar-dev-0.12.16dev-java plugins/declarations/spec/declarations/file_spec.rb
redcar-dev-0.12.15dev-java plugins/declarations/spec/declarations/file_spec.rb
redcar-dev-0.12.14dev-java plugins/declarations/spec/declarations/file_spec.rb
redcar-dev-0.12.13dev-java plugins/declarations/spec/declarations/file_spec.rb
redcar-dev-0.12.12dev-java plugins/declarations/spec/declarations/file_spec.rb
redcar-dev-0.12.11dev-java plugins/declarations/spec/declarations/file_spec.rb
redcar-dev-0.12.10dev-java plugins/declarations/spec/declarations/file_spec.rb
redcar-dev-0.12.9dev-java plugins/declarations/spec/declarations/file_spec.rb
redcar-dev-0.12.8dev-java plugins/declarations/spec/declarations/file_spec.rb
redcar-dev-0.12.7dev-java plugins/declarations/spec/declarations/file_spec.rb
redcar-dev-0.12.6dev-java plugins/declarations/spec/declarations/file_spec.rb
redcar-dev-0.12.4dev-java plugins/declarations/spec/declarations/file_spec.rb
redcar-dev-0.12.3dev-java plugins/declarations/spec/declarations/file_spec.rb
redcar-dev-0.12.1dev-java plugins/declarations/spec/declarations/file_spec.rb
redcar-dev-0.12.0dev-java plugins/declarations/spec/declarations/file_spec.rb
redcar-0.11 plugins/declarations/spec/declarations/file_spec.rb
redcar-0.11.0dev plugins/declarations/spec/declarations/file_spec.rb
redcar-0.10 plugins/declarations/spec/declarations/file_spec.rb
redcar-0.9.2 plugins/declarations/spec/declarations/file_spec.rb