Sha256: f6b2485fce62bd6f2974530586ea514dbd7a98d76ae660382686227a853d0ea5

Contents?: true

Size: 1.45 KB

Versions: 5

Compression:

Stored size: 1.45 KB

Contents

RSpec.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

5 entries across 5 versions & 1 rubygems

Version Path
spree-faq-2.4.0 spec/features/admin/faq_spec.rb
spree-faq-2.3.0 spec/features/admin/faq_spec.rb
spree-faq-2.2.1 spec/features/admin/faq_spec.rb
spree-faq-2.1.1 spec/features/admin/faq_spec.rb
spree-faq-2.0.1 spec/features/admin/faq_spec.rb