Sha256: 4a7b5021e138ad486a2aa40ff434347e509ff283682bad7f30fdc6c9ee9b40d7

Contents?: true

Size: 1.37 KB

Versions: 1

Compression:

Stored size: 1.37 KB

Contents

require "spec_helper"

require "ib/parser"

describe IB::Parser do
  it "finds outlets and actions" do
    info = IB::Parser.new.find("spec/fixtures/common/custom_view.rb").first
    info[:class].should == [["CustomView", "UIView"]]
    info[:outlets].should == [
      ["greenLabel",    "UIGreenLabel"],
      ["redLabel",      "UILabel"],
      ["untyped_label", "id"],
      ["yellowLabel",   "id"]
    ]
    info[:outlet_collections].should == [
      ["greenLabelCollection",     "UIGreenLabel"],
      ["redLabelCollection",       "UILabel"],
      ["untyped_label_collection", "id"],
      ["yellowLabelCollection",    "id"]
    ]
    info[:actions].should == [
      ["someAction",              "sender", nil],
      ["segueAction",             "sender", "UIStoryboardSegue"],
      ["anotherAction",           "button", nil],
      ["actionWithComment",       "sender", nil],
      ["actionWithBrackets",      "sender", nil],
      ["actionWithoutArgs",       nil,      nil],
      ["actionWithDefaultedArgs", "sender", nil]
    ]
  end

  it "can output simple classes" do
    IB::Parser.new.find("spec/fixtures/common/simple_class.rb").length.should == 1
  end

  it "finds all infos" do
    infos = IB::Parser.new.find_all("spec/fixtures/dependency_test")
    infos.values.each do |vals| 
      vals.each do |v|
        expect(v).to be_kind_of(IB::OCInterface)
      end
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ib-0.4.1 spec/lib/ib/parser_spec.rb