Sha256: 287839dfa8b9e01a9cde8e5bbd64715ba28bdddc03b9155af8528639038b8b46

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

require 'spec_helper'
include ActionView::RecordIdentifier

feature 'Session management' do
  background do
    @survey = create :survey
    baseversion = @survey.versions.create version: 0
    @version = Helena::VersionPublisher.publish baseversion
    @version.save
  end

  scenario 'lists all sessions of a survey' do
    session_not_completed = @survey.sessions.create version: @version, token: 'abc'
    session_completed = @survey.sessions.create version: @version, token: 'xyz', completed: true

    visit helena.admin_survey_sessions_path @survey

    within "#helena_#{dom_id session_not_completed}" do
      expect(page).to have_text 'less than a minute abc No'
    end

    within "#helena_#{dom_id session_completed}" do
      expect(page).to have_text 'less than a minute xyz Yes'
    end

    within '.breadcrumb' do
      expect(page).to have_text 'Surveys'
      expect(page).to have_text @survey.name
    end
  end

  scenario 'deletes a version' do
    session = @survey.sessions.create

    visit helena.admin_survey_sessions_path @survey
    within "#helena_#{dom_id(session)}" do
      expect { click_link 'Delete' }.to change { @survey.sessions.count }.by(-1)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
helena-0.3.3 spec/features/helena/admin/manage_session_spec.rb