From 99fb3b782ae7e60dbd0d5112cc42928fb26a8845 Mon Sep 17 00:00:00 2001 From: Zach Wolfenbarger Date: Fri, 31 May 2024 17:06:58 -0500 Subject: [PATCH] Hound --- app/models/workflow.rb | 4 ++-- lib/formatter/csv/workflow.rb | 8 ++++---- spec/lib/formatter/csv/workflow_spec.rb | 20 ++++++++++++-------- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/app/models/workflow.rb b/app/models/workflow.rb index 6f3ecef07..a02db57b2 100644 --- a/app/models/workflow.rb +++ b/app/models/workflow.rb @@ -8,7 +8,7 @@ class Workflow < ApplicationRecord include Translatable include Versioning - self.ignored_columns = ["aggregation"] + self.ignored_columns = ['aggregation'] versioned association: :workflow_versions, attributes: %w(tasks first_task strings major_version minor_version) @@ -46,7 +46,7 @@ class Workflow < ApplicationRecord 'options' => {'count' => 15} }.freeze - JSON_ATTRIBUTES = %w(tasks retirement strings steps).freeze + JSON_ATTRIBUTES = %w[tasks retirement strings steps].freeze SELECTOR_PAGE_SIZE_KEY = 'subject_queue_page_size'.freeze diff --git a/lib/formatter/csv/workflow.rb b/lib/formatter/csv/workflow.rb index 79a335a28..a8eecd11c 100644 --- a/lib/formatter/csv/workflow.rb +++ b/lib/formatter/csv/workflow.rb @@ -3,12 +3,12 @@ module Csv class Workflow attr_reader :workflow_version - JSON_FIELDS = [:tasks, :strings ].freeze + JSON_FIELDS = %i[tasks strings].freeze def headers - %w(workflow_id display_name version active classifications_count pairwise - grouped prioritized primary_language first_task tutorial_subject_id - retired_set_member_subjects_count tasks retirement strings minor_version) + %w[workflow_id display_name version active classifications_count pairwise + grouped prioritized primary_language first_task tutorial_subject_id + retired_set_member_subjects_count tasks retirement strings minor_version] end def to_rows(workflow_version) diff --git a/spec/lib/formatter/csv/workflow_spec.rb b/spec/lib/formatter/csv/workflow_spec.rb index fda8db6a1..175e35b5a 100644 --- a/spec/lib/formatter/csv/workflow_spec.rb +++ b/spec/lib/formatter/csv/workflow_spec.rb @@ -1,4 +1,6 @@ -require "spec_helper" +# frozen_string_literal: true + +require 'spec_helper' RSpec.describe Formatter::Csv::Workflow do let(:workflow) { create(:workflow) } @@ -33,22 +35,24 @@ def retirement_json end let(:header) do - %w(workflow_id display_name version minor_version active classifications_count pairwise grouped prioritized primary_language first_task tutorial_subject_id retired_set_member_subjects_count tasks retirement strings) + %w[workflow_id display_name version minor_version active classifications_count pairwise grouped + prioritized primary_language first_task tutorial_subject_id retired_set_member_subjects_count + tasks retirement strings] end - describe "#headers" do - it 'should contain the required headers' do + describe '#headers' do + it 'contains the required headers' do expect(described_class.new.headers).to match_array(header) end end - describe "#to_rows" do + describe '#to_rows' do subject { described_class.new.to_rows(workflow_version) } it { is_expected.to match_array(rows) } end - context "with a versioned workflow" do + context 'with a versioned workflow' do let(:q_workflow) { build(:workflow, :question_task) } let(:tasks) { q_workflow.tasks } @@ -60,13 +64,13 @@ def retirement_json workflow.update(updates) end - describe "#to_rows on the latest version" do + describe '#to_rows on the latest version' do subject { described_class.new.to_rows(workflow_version) } it { is_expected.to match_array(rows) } end - describe "#to_rows on the previous version" do + describe '#to_rows on the previous version' do let(:workflow_version) { workflow.workflow_versions.order(:created_at).first } subject { described_class.new.to_rows(workflow_version) }