Sha256: 8bcb013ad753c85fff4d6480a67a13281babd266b245420fdda8cfab4a7982a4

Contents?: true

Size: 1.28 KB

Versions: 3

Compression:

Stored size: 1.28 KB

Contents

require 'spec_helper'

describe ElabsMatchers::Cucumber::Common do
  describe "LIST_SEPARATOR" do
    it "matches ," do
      ", ".should =~ Cucumber::LIST_SEPARATOR
    end

    it "matches and" do
      " and ".should =~ Cucumber::LIST_SEPARATOR
    end

    it "doesn't matches other things" do
      "foo".should_not =~ Cucumber::LIST_SEPARATOR
    end
  end

  describe "LIST_REGEXP" do
    it "matches just one item" do
      %Q{"Bart"}.should =~ Cucumber::LIST_REGEXP
    end

    it "matches a comma seperated list" do
      %Q{"Bart", "Lisa"}.should =~ Cucumber::LIST_REGEXP
    end

    it "matches a 'and' seperated list" do
      %Q{"Bart" and "Lisa"}.should =~ Cucumber::LIST_REGEXP
    end

    it "matches a comma and 'and' seperated list" do
      %Q{"Bart", "Lisa" and "Homer"}.should =~ Cucumber::LIST_REGEXP
    end

    it "matches a comma and 'and' seperated list with several words" do
      %Q{"Bart Simpsons", "Lisa Simpsons" and "Homer Simpsons"}.should =~ Cucumber::LIST_REGEXP
    end

    it "doesn't matches other things" do
      %Q{foo}.should_not =~ Cucumber::LIST_REGEXP
    end
  end

  describe "#human_list_to_array" do
    it "converts a LIST_REGEXP-list to an array" do
      human_list_to_array(%Q{"Bart", "Lisa" and "Homer"}).should == %w[Bart Lisa Homer]
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
elabs_matchers-0.0.3 spec/elabs_matchers/cucumber/common_spec.rb
elabs_matchers-0.0.2 spec/elabs_matchers/cucumber/common_spec.rb
elabs_matchers-0.0.1 spec/elabs_matchers/cucumber/common_spec.rb