Sha256: 4dafd685f24725e11cc45e2c57cbec7698514f2621b426664e06194d72d6c901

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

require 'spec_helper'

describe PGit::Bilateral::HandleBack do
  describe '#execute!' do
    it 'should call #reask on the parent_question' do
      stories = double('stories')
      question = instance_double('Interactive::Question', reask!: nil)
      response = instance_double('Interactive::Response', back?: true)
      options = {response: response, parent_question: question, stories: stories}

      back_handler = PGit::Bilateral::HandleBack.new(options)
      back_handler.execute!

      expect(question).to have_received(:reask!)
    end

    it 'should not call #reask on the parent question if response is not back' do
      stories = double('stories')
      question = instance_double('Interactive::Question', reask!: nil)
      response = instance_double('Interactive::Response', back?: false)
      options = {response: response, parent_question: question, stories: stories}

      back_handler = PGit::Bilateral::HandleBack.new(options)
      back_handler.execute!

      expect(question).not_to have_received(:reask!)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pgit-1.0.0 spec/pgit/bilateral/handle_back_spec.rb