Sha256: bfb9471ccddc557ce3944001f42e94ab37c92de7c676e5d21327840a115252d2

Contents?: true

Size: 1.21 KB

Versions: 3

Compression:

Stored size: 1.21 KB

Contents

require 'spec_helper'
require_relative '../../lib/formic/helper'

describe Formic::Helper do
  before(:each) do
    @page = Object.new
    @page.extend Formic::Helper

    @options = {}
    @block = Proc.new {}
  end

  context "#get_class" do
    it "should return the class base on the name" do
      @page.get_class(:list).should == Formic::List
    end

    it "should return class with underscore" do
      @page.get_class(:list_item).should == Formic::ListItem
    end
  end

  [
    :selection,
    :input,
    :password,
    :checkbox,
    :list,
    :list_item,
    :form,
    :tab_panel,
    :button,
    :textarea
  ].each do |element|

    it "should repond to #{element}" do
      @page.should respond_to element
    end

    it "should be initilize the object with page" do
      @object = @page.send(element, @options, &@block)
      @object.page.should == @page
    end
  end

  context "#tab" do
    before(:each) do
      tab_panel = @page.tab_panel @options, &@block
    end

    it "should repond to tab" do
      @page.should respond_to :tab
    end

    it "should be initilize the object with page" do
      @object = @page.tab.style 'Some Title', @options, &@block
      @object.page.should == @page
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
formic-0.2.5 spec/formic/helper_spec.rb
formic-0.2.1 spec/formic/helper_spec.rb
formic-0.1.0 spec/formic/helper_spec.rb