Sha256: 83a8a7f410e46ea69d1adba10ce97b9a33f74ef85c8a6f3920255ac69e582eb2

Contents?: true

Size: 789 Bytes

Versions: 1

Compression:

Stored size: 789 Bytes

Contents

require 'spec_helper'

describe Helena::SessionsController do
  routes { Helena::Engine.routes }

  let(:survey) { create :survey }
  let(:session) do
    baseversion = survey.versions.create version: 0
    version = Helena::VersionPublisher.publish(baseversion)
    version.save
    create :session, survey: survey, version: version, answers: [
      build(:string_answer, code: 'string_answer_1', value: 'abc'),
      build(:integer_answer, code: 'integer_answer_1', value: '123')
    ]
  end

  it 'return json result of the current session' do
    get :show, token: session.view_token, format: :json

    result = ActiveSupport::JSON.decode(response.body)
    expect(result['answer']['string_answer_1']).to eq 'abc'
    expect(result['answer']['integer_answer_1']).to eq 123
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
helena-0.3.3 spec/controllers/helena/sessions_controller_spec.rb