Sha256: 5178f85ad4b7578f4556c5dc5e09f0d756df15967cd24ab6ddfc0a52eff3828e

Contents?: true

Size: 1.78 KB

Versions: 3

Compression:

Stored size: 1.78 KB

Contents

require "#{File.dirname(__FILE__)}/../spec_helper"


describe 'Background, Unit', :unit_test => true do

  let(:clazz) { CukeModeler::Background }
  let(:background) { clazz.new }


  describe 'common behavior' do

    it_should_behave_like 'a model'
    it_should_behave_like 'a named model'
    it_should_behave_like 'a described model'
    it_should_behave_like 'a stepped model'
    it_should_behave_like 'a sourced model'
    it_should_behave_like 'a parsed model'

  end


  describe 'unique behavior' do

    it 'contains steps' do
      steps = [:step_1, :step_2]
      everything = steps

      background.steps = steps

      expect(background.children).to match_array(everything)
    end


    describe 'comparison' do

      it 'can gracefully be compared to other types of objects' do
        # Some common types of object
        [1, 'foo', :bar, [], {}].each do |thing|
          expect { background == thing }.to_not raise_error
          expect(background == thing).to be false
        end
      end

    end


    describe 'background output' do

      it 'is a String' do
        expect(background.to_s).to be_a(String)
      end


      context 'from abstract instantiation' do

        let(:background) { clazz.new }


        it 'can output an empty background' do
          expect { background.to_s }.to_not raise_error
        end

        it 'can output a background that has only a name' do
          background.name = 'a name'

          expect { background.to_s }.to_not raise_error
        end

        it 'can output a background that has only a description' do
          background.description = 'a description'

          expect { background.to_s }.to_not raise_error
        end

      end

    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cuke_modeler-1.0.4 testing/rspec/spec/unit/background_unit_spec.rb
cuke_modeler-1.0.3 testing/rspec/spec/unit/background_unit_spec.rb
cuke_modeler-1.0.2 testing/rspec/spec/unit/background_unit_spec.rb