Skip to content

Commit

Permalink
Add dashboard layout to csv import screens
Browse files Browse the repository at this point in the history
  • Loading branch information
bess committed Oct 15, 2019
1 parent 178b8d4 commit 40f428b
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
3 changes: 3 additions & 0 deletions app/controllers/zizia/csv_import_details_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# frozen_string_literal: true
module Zizia
class CsvImportDetailsController < ApplicationController
load_and_authorize_resource
with_themed_layout 'dashboard'

def index
@csv_import_details = Zizia::CsvImportDetail.order(:id).page csv_import_detail_params[:page]
end
Expand Down
2 changes: 2 additions & 0 deletions spec/dummy/app/models/ability.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ class Ability
# Define any customized permissions here.
def custom_permissions
can :manage, Zizia::CsvImport if current_user.admin?
can :manage, Zizia::CsvImportDetail if current_user.admin?

# Limits deleting objects to a the admin user
#
# if current_user.admin?
Expand Down
19 changes: 18 additions & 1 deletion spec/dummy/spec/system/csv_import_details_page_spec.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,35 @@
require 'rails_helper'
include Warden::Test::Helpers

RSpec.describe 'viewing the csv import detail page' do
let(:user) { FactoryBot.create(:user) }
let(:csv_import) { FactoryBot.create(:csv_import) }
let(:csv_import_detail) { FactoryBot.create(:csv_import_detail) }
let(:user) { FactoryBot.create(:admin) }

it 'displays the metadata when you visit the page' do
user.save
csv_import.user_id = user.id
csv_import.save
csv_import_detail.save
login_as user

visit ('/csv_import_details/index')
expect(page).to have_content('CSV Imports ID')
click_on '1'
expect(page).to have_content('Total Size')
end

it 'has the dashboard layout' do
user.save
csv_import.user_id = user.id
csv_import.save
csv_import_detail.save
login_as user

visit ('/csv_import_details/index')
expect(page).to have_content('Your activity')
visit ('csv_import_details/show/1')
expect(page).to have_content('About the Import')
expect(page).to have_content('Your activity')
end
end
3 changes: 1 addition & 2 deletions spec/dummy/spec/system/import_from_csv_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,10 @@
expect(work.title.first).to match(/Interior/)
expect(work.file_sets.first.label).to eq('cat.jpg')


# Viewing additional details after an import
visit "/csv_import_details/index"
expect(page).to have_content('Total Size')
find(:xpath, '//*[@id="content-wrapper"]/table/tbody/tr[2]/td[1]/a').click
find(:xpath, '//*[@id="content-wrapper"]/div[2]/table/tbody/tr[2]/td[1]/a').click
expect(page).to have_content('dog.jpg')
expect(page).to have_content('5.74 MB')
end
Expand Down

0 comments on commit 40f428b

Please sign in to comment.