Sha256: 1d3b802774694027a418e065e35d31c8ec92c6bf7de29cbc247d0d94b98ee37e

Contents?: true

Size: 1.53 KB

Versions: 2

Compression:

Stored size: 1.53 KB

Contents

require 'spec_helper'

describe Turnip::ScenarioContext do
  let(:context) { Turnip::ScenarioContext.new(feature, scenario) }
  let(:feature) { stub(:active_tags => feature_tags) }
  let(:feature_tags) { %w(feature both) }
  let(:scenario) { stub(:active_tags => scenario_tags) }
  let(:scenario_tags) { %w(scenario both) }
  let(:unique_tags) { (feature_tags + scenario_tags).uniq }

  describe '#initialize' do
    let(:feature) { stub }
    let(:scenario) { stub }

    it 'keeps track of the feature' do
      Turnip::ScenarioContext.new(feature, scenario).feature.should eq(feature)
    end

    it 'keeps track of the scenario' do
      Turnip::ScenarioContext.new(feature, scenario).scenario.should eq(scenario)
    end
  end

  describe '#available_background_steps' do
    it 'gathers the steps for the feature tags' do
      Turnip::StepModule.should_receive(:all_steps_for).with(*feature_tags)
      context.available_background_steps
    end
  end

  describe '#available_scenario_steps' do
    it 'gathers the steps for the unique scenario and feature tags' do
      Turnip::StepModule.should_receive(:all_steps_for).with(*unique_tags)
      context.available_scenario_steps
    end
  end

  describe '#backgrounds' do
    it 'delegates to the feature' do
      feature.should_receive :backgrounds
      context.backgrounds
    end
  end

  describe '#modules' do
    it 'gathers the modules for the unique scenario and feature tags' do
      Turnip::StepModule.should_receive(:modules_for).with(*unique_tags)
      context.modules
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
turnip-0.3.1 spec/scenario_context_spec.rb
turnip-0.3.0 spec/scenario_context_spec.rb