Sha256: 89f89247eae7229c9e006ff37bd13bbd183abbe0df54d6dd7f8e0a5e6fa9b593

Contents?: true

Size: 1.7 KB

Versions: 3

Compression:

Stored size: 1.7 KB

Contents

require 'spec_helper'

describe 'Analytics Tracker', type: :feature do
  stub_authorization!

  let!(:default_store) { Spree::Store.default }
  let!(:another_store) { create(:store, name: 'Eurozone') }

  context 'index' do
    before(:each) do
      create(:tracker, store: default_store)
      create(:tracker, analytics_id: 'A200', store: another_store)
      visit spree.admin_trackers_path
    end

    it 'should have the right content' do
      expect(page).to have_content('Analytics Trackers')
    end

    it 'should have the right tabular values displayed' do
      within_row(1) do
        expect(column_text(1)).to eq('A100')
        expect(column_text(2)).to eq('Google analytics')
        expect(column_text(3)).to eq(default_store.name)
        expect(column_text(4)).to eq('Yes')
      end

      within_row(2) do
        expect(column_text(1)).to eq('A200')
        expect(column_text(2)).to eq('Google analytics')
        expect(column_text(3)).to eq('Eurozone')
        expect(column_text(4)).to eq('Yes')
      end
    end
  end

  context 'create' do
    before(:each) do
      visit spree.admin_trackers_path
    end

    it 'should be able to create a new analytics tracker', js: true do
      within('.content-header') do
        click_link 'admin_new_tracker_link'
      end
      fill_in 'tracker_analytics_id', with: 'A100'

      select2 default_store.name, from: 'Store'

      click_button 'Create'

      expect(page).to have_content('successfully created!')
      within_row(1) do
        expect(column_text(1)).to eq('A100')
        expect(column_text(2)).to eq('Google analytics')
        expect(column_text(3)).to eq(default_store.name)
        expect(column_text(4)).to eq('Yes')
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spree_analytics_trackers-2.1.1 spec/features/admin/configuration/analytics_tracker_spec.rb
spree_analytics_trackers-2.1.0 spec/features/admin/configuration/analytics_tracker_spec.rb
spree_analytics_trackers-2.0.0 spec/features/admin/configuration/analytics_tracker_spec.rb