Sha256: f67b143112800109ea25c361f53eddd24bfc8b6f195aa9b96236ad95e0535751

Contents?: true

Size: 1.73 KB

Versions: 4

Compression:

Stored size: 1.73 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')

describe AlexaSkillsRuby::JsonObjects::SkillsResponse do

  let(:response_json) do
    {
      'version' => "1.0",
      'sessionAttributes' => {
        'supportedHoriscopePeriods' => {
          'daily' => true,
          'weekly' => false,
          'monthly' => false
        }
      },
      'response' => {
        'outputSpeech' => {
          'type' => "PlainText",
          'text' => "Today will provide you a new learning opportunity.  Stick with it and the possibilities will be endless. Can I help you with anything else?"
        },
        'card' => {
          'type' => "Simple",
          'title' => "Horoscope",
          'content' => "Today will provide you a new learning opportunity.  Stick with it and the possibilities will be endless."
        },
        'reprompt' => {
          'outputSpeech' => {
            'type' => "PlainText",
            'text' => "Can I help you with anything else?"
          }
        },
        'shouldEndSession' => false
      }
    }
  end

  it 'generates example json' do
    sr = AlexaSkillsRuby::JsonObjects::SkillsResponse.new
    r = sr.response
    sr.session_attributes = {'supportedHoriscopePeriods' => {'daily' => true, 'weekly' => false, 'monthly' => false}}
    r.set_output_speech_text("Today will provide you a new learning opportunity.  Stick with it and the possibilities will be endless. Can I help you with anything else?")
    r.set_simple_card('Horoscope', 'Today will provide you a new learning opportunity.  Stick with it and the possibilities will be endless.')
    r.set_reprompt_speech_text('Can I help you with anything else?')
    r.should_end_session = false

    expect(sr.as_json).to eq response_json
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
alexa_skills_ruby-1.0.0 spec/unit/json_objects/skills_response_spec.rb
alexa_skills_ruby-0.0.7 spec/unit/json_objects/skills_response_spec.rb
alexa_skills_ruby-0.0.6 spec/unit/json_objects/skills_response_spec.rb
alexa_skills_ruby-0.0.5 spec/unit/json_objects/skills_response_spec.rb