Sha256: 949a7213a4b8790e5bde7b5a709e5d3565b6e1e46dae83db90742802e9d5083f

Contents?: true

Size: 1.9 KB

Versions: 3

Compression:

Stored size: 1.9 KB

Contents

$:.unshift File.expand_path('../../lib', __FILE__)

require 'bacon'
require 'ovaltine/storyboard'
require 'ovaltine/objc/storyboard_formatter'

describe 'StoryboardFormatter' do

  it 'writes valid output paths' do
    storyboard = Ovaltine::Storyboard.new('Main?P', [])
    formatter  = Ovaltine::StoryboardFormatter.new(storyboard, '', '', '.')
    names = formatter.output_paths.map {|p| File.basename(p)}
    names.should.include 'Main_PStoryboard.m'
    names.should.include 'Main_PStoryboard.h'
  end

  it 'uses the prefix in output paths' do
    storyboard = Ovaltine::Storyboard.new('Main_iPhone', [])
    formatter  = Ovaltine::StoryboardFormatter.new(storyboard, 'ABC', '', '.')
    names = formatter.output_paths.map {|p| File.basename(p)}
    names.should.include 'ABCMain_iPhoneStoryboard.m'
    names.should.include 'ABCMain_iPhoneStoryboard.h'
  end

  it 'uses the prefix in the generated class name' do
    storyboard = Ovaltine::Storyboard.new('Onboarding', [])
    formatter  = Ovaltine::StoryboardFormatter.new(storyboard, 'DMU', '', '.')
    formatter.classname.should.equal 'DMUOnboardingStoryboard'
  end

  it 'uses the current year in copyright text' do
    storyboard = Ovaltine::Storyboard.new('GameOver', [])
    formatter  = Ovaltine::StoryboardFormatter.new(storyboard, 'DMU', 'Kattrali Inc.', '.')
    formatter.copyright_text.should.include "Copyright (c) #{Time.new.year}"
  end

  it 'uses the given copyright owner' do
    storyboard = Ovaltine::Storyboard.new('GameOver', [])
    formatter  = Ovaltine::StoryboardFormatter.new(storyboard, 'DMU', 'Kattrali Inc.', '.')
    formatter.copyright_text.should.include 'Kattrali Inc.'
  end

  it 'opens copyright information when not provided' do
    storyboard = Ovaltine::Storyboard.new('GameOver', [])
    formatter  = Ovaltine::StoryboardFormatter.new(storyboard, 'DMU', '', '.')
    formatter.copyright_text.downcase.should.not.include "Copyright"
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ovaltine-1.1.1 specs/storyboard_formatter_spec.rb
ovaltine-1.1.0 specs/storyboard_formatter_spec.rb
ovaltine-1.0.6 specs/storyboard_formatter_spec.rb