Sha256: ed6d022af0d2d750b8b5fb4465093b97bc868df94657830186cdb4d67cdb8e2d

Contents?: true

Size: 1.45 KB

Versions: 3

Compression:

Stored size: 1.45 KB

Contents

require 'spec_helper'

feature 'Admin FAQ', :js do
  stub_authorization!

  given!(:admin_user) { create(:admin_user) }

  background do
    visit spree.admin_path
    click_link 'Configuration'
  end

  scenario 'have faq tab in configuration sidebar' do
    expect(page).to have_text 'FAQ'
  end

  context 'create new category' do

    background do
      click_link 'FAQ'
      click_link 'New Category'
    end

    scenario 'save with valid name' do
      fill_in 'Name', with: 'Shopping'
      click_button 'Create'
      within_table('listing_faq') do
        expect(page).to have_text 'Shopping'
      end
    end

    scenario 'error when empty name' do
      click_button 'Create'
      expect(page).to have_text 'Name can\'t be blank'
    end
  end

  context 'modify' do

    given!(:question_category) { create(:question_category, name: 'Shopping') }
    given!(:question) do
      create(:question,
        question_category: question_category,
        question: 'Do you sell stuff?',
        answer: 'Think so..')
    end

    background do
      click_link 'FAQ'
    end

    scenario 'update category' do
      within_table('listing_faq') do
        expect(page).to have_text 'Shopping'
        click_icon :edit
      end
      expect(page).to have_text 'Editing Category Questions'

      fill_in 'Category Name', with: 'Selling'
      click_button 'Update'

      within_table 'listing_faq' do
        expect(page).to have_text 'Selling'
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spree-faq-2.2.0 spec/features/admin/faq_spec.rb
spree-faq-2.1.0 spec/features/admin/faq_spec.rb
spree-faq-2.0.0 spec/features/admin/faq_spec.rb