Sha256: 09fec0b8f5f276bd9324ba8e83ddd06bdae9c5e47958baafdefa895bde6a6d95

Contents?: true

Size: 1.33 KB

Versions: 22

Compression:

Stored size: 1.33 KB

Contents

# encoding: utf-8 -- You should see a paragraph character: ยง
# File: macro-collection_spec.rb

require_relative '../spec_helper'
require_relative '../../lib/macros4cuke/macro-collection'	# Load the class under test

module Macros4Cuke # Open this namespace to get rid of module qualifier prefixes

describe MacroCollection do

  let(:singleton) { MacroCollection.instance() }

  context "Initialization:" do
    it "should be empty" do
      singleton.macro_steps.should be_empty
    end

  end

  context "Provided services:" do
    let(:sample_substeps) do
      snippet = <<-SNIPPET
  Given I landed in the homepage
  When I click "Sign in"
  And I fill in "Username" with "<userid>"
  And I fill in "Password" with "<password>"
  And I click "Submit"
SNIPPET

      snippet
    end

    it "should accept the addition of a new macro-step" do
      phrase = "[enter my credentials]"
      lambda { singleton.add_macro(phrase, sample_substeps, true)}.should_not raise_error
      singleton.should have(1).macro_steps

      # Error case: inserting another macro with same phrase.
      error_message = "A macro-step with phrase '[enter my credentials]' already exist."
      lambda { singleton.add_macro(phrase, sample_substeps, true) }.should raise_error(Macros4Cuke::DuplicateMacroError, error_message)
    end
  end

end # describe

end # module


# End of file

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
macros4cuke-0.3.14 spec/macros4cuke/macro-collection_spec.rb
macros4cuke-0.3.13 spec/macros4cuke/macro-collection_spec.rb
macros4cuke-0.3.12 spec/macros4cuke/macro-collection_spec.rb
macros4cuke-0.3.11 spec/macros4cuke/macro-collection_spec.rb
macros4cuke-0.3.10 spec/macros4cuke/macro-collection_spec.rb
macros4cuke-0.3.09 spec/macros4cuke/macro-collection_spec.rb
macros4cuke-0.3.08 spec/macros4cuke/macro-collection_spec.rb
macros4cuke-0.3.07 spec/macros4cuke/macro-collection_spec.rb
macros4cuke-0.3.06 spec/macros4cuke/macro-collection_spec.rb
macros4cuke-0.3.03 spec/macros4cuke/macro-collection_spec.rb
macros4cuke-0.3.02 spec/macros4cuke/macro-collection_spec.rb
macros4cuke-0.3.01 spec/macros4cuke/macro-collection_spec.rb
macros4cuke-0.3.00 spec/macros4cuke/macro-collection_spec.rb
macros4cuke-0.2.22 spec/macros4cuke/macro-collection_spec.rb
macros4cuke-0.2.21 spec/macros4cuke/macro-collection_spec.rb
macros4cuke-0.2.20 spec/macros4cuke/macro-collection_spec.rb
macros4cuke-0.2.19 spec/macros4cuke/macro-collection_spec.rb
macros4cuke-0.2.18 spec/macros4cuke/macro-collection_spec.rb
macros4cuke-0.2.17 spec/macros4cuke/macro-collection_spec.rb
macros4cuke-0.2.16 spec/macros4cuke/macro-collection_spec.rb