Sha256: 71adf6976d00f7b216c5cc64d8c2bfd26230ff19e02dbb0174fe980dfc9fb0df

Contents?: true

Size: 1.6 KB

Versions: 8

Compression:

Stored size: 1.6 KB

Contents

require File.expand_path('../../spec_helper', __FILE__)

describe 'XCRes::ResourcesAggregateAnalyzer' do

  def subject
    XCRes::ResourcesAggregateAnalyzer
  end

  before do
    @analyzer = subject.new
    @analyzer.logger = stub('Logger', :log)
  end

  describe '#analyze' do
    it 'should return all sections' do
      bundle_section_a = stub('Bundle Section A')
      bundle_section_b = stub('Bundle Section B')
      loose_image_section = stub('Loose Images Section')
      xcassets_section = stub('XCAssets Section')

      XCRes::ResourcesAnalyzer::BundleResourcesAnalyzer.any_instance
        .expects(:analyze).returns([bundle_section_a, bundle_section_b])
      XCRes::ResourcesAnalyzer::LooseResourcesAnalyzer.any_instance
        .expects(:analyze).returns(loose_image_section)
      XCRes::ResourcesAnalyzer::XCAssetsAnalyzer.any_instance
        .expects(:analyze).returns(xcassets_section)

      @analyzer.analyze.should.eql?([bundle_section_a, bundle_section_b, loose_image_section, xcassets_section])
    end

    it 'should return only bundle sections if there are no loose images' do
      bundle_section = stub('Bundle Section')
      xcassets_section = stub('XCAssets Section')

      XCRes::ResourcesAnalyzer::BundleResourcesAnalyzer.any_instance
        .expects(:analyze).returns(bundle_section)
      XCRes::ResourcesAnalyzer::LooseResourcesAnalyzer.any_instance
        .expects(:analyze).returns([])
      XCRes::ResourcesAnalyzer::XCAssetsAnalyzer.any_instance
        .expects(:analyze).returns(xcassets_section)

      @analyzer.analyze.should.eql?([bundle_section, xcassets_section])
    end
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
xcres-0.6.1 spec/unit/analyzer/resources_aggregate_analyzer_spec.rb
xcres-0.6.0 spec/unit/analyzer/resources_aggregate_analyzer_spec.rb
xcres-0.5.0 spec/unit/analyzer/resources_aggregate_analyzer_spec.rb
xcres-0.4.4 spec/unit/analyzer/resources_aggregate_analyzer_spec.rb
xcres-0.4.3 spec/unit/analyzer/resources_aggregate_analyzer_spec.rb
xcres-0.4.2 spec/unit/analyzer/resources_aggregate_analyzer_spec.rb
xcres-0.4.1 spec/unit/analyzer/resources_aggregate_analyzer_spec.rb
xcres-0.4.0 spec/unit/analyzer/resources_aggregate_analyzer_spec.rb