Sha256: 74d3cdc377a0305fb93887765014de31df5b4660f41b47c53c9550ce7d5b3896

Contents?: true

Size: 1.22 KB

Versions: 8

Compression:

Stored size: 1.22 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/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 "detects simple classes" do
    IB::Parser.new.find("spec/fixtures/simple_class.rb").length.should == 0
  end

  it "finds all infos" do
    puts IB::Parser.new.find_all("spec/fixtures").inspect
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ib-0.3.5 spec/parser_spec.rb
ib-0.3.4 spec/parser_spec.rb
ib-0.3.3 spec/parser_spec.rb
ib-0.3.2 spec/parser_spec.rb
ib-0.3.1 spec/parser_spec.rb
ib-0.3.0 spec/parser_spec.rb
ib-0.2.10 spec/parser_spec.rb
ib-0.2.9 spec/parser_spec.rb