From ec17a209f61be17f9d6eefb976dd188770080a35 Mon Sep 17 00:00:00 2001 From: Allen Taylor Date: Thu, 7 Apr 2022 15:07:08 -0400 Subject: [PATCH] Create DigitalProductVersions --- Gemfile.lock | 1 + app/models/digital_product.rb | 1 + app/models/digital_product_version.rb | 3 +++ ...5005734_create_digital_product_versions.rb | 19 ++++++++++++++++++ db/schema.rb | 20 ++++++++++++++++++- spec/factories/digital_product.rb | 16 +++++++++++++++ spec/factories/digital_product_versions.rb | 16 +++++++++++++++ .../omb_cx_reporting_collections_spec.rb | 6 +++--- spec/models/digital_product_version_spec.rb | 5 +++++ spec/rails_helper.rb | 4 ++-- 10 files changed, 85 insertions(+), 6 deletions(-) create mode 100644 app/models/digital_product_version.rb create mode 100644 db/migrate/20220405005734_create_digital_product_versions.rb create mode 100644 spec/factories/digital_product.rb create mode 100644 spec/factories/digital_product_versions.rb create mode 100644 spec/models/digital_product_version_spec.rb diff --git a/Gemfile.lock b/Gemfile.lock index cd61555a2..461f9a970 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -482,6 +482,7 @@ GEM PLATFORMS x86_64-darwin-19 + x86_64-darwin-20 DEPENDENCIES aasm (~> 5.2.0) diff --git a/app/models/digital_product.rb b/app/models/digital_product.rb index 7568b51b9..d376b3851 100644 --- a/app/models/digital_product.rb +++ b/app/models/digital_product.rb @@ -1,2 +1,3 @@ class DigitalProduct < ApplicationRecord + has_many :digital_product_versions end diff --git a/app/models/digital_product_version.rb b/app/models/digital_product_version.rb new file mode 100644 index 000000000..afd82bd68 --- /dev/null +++ b/app/models/digital_product_version.rb @@ -0,0 +1,3 @@ +class DigitalProductVersion < ApplicationRecord + belongs_to :digital_product +end diff --git a/db/migrate/20220405005734_create_digital_product_versions.rb b/db/migrate/20220405005734_create_digital_product_versions.rb new file mode 100644 index 000000000..adc6ae723 --- /dev/null +++ b/db/migrate/20220405005734_create_digital_product_versions.rb @@ -0,0 +1,19 @@ +class CreateDigitalProductVersions < ActiveRecord::Migration[7.0] + def change + create_table :digital_product_versions do |t| + t.references :digital_product + t.string :store_url + t.string :platform + t.string :version_number + t.date :publish_date + t.string :description + t.string :whats_new + t.string :screenshot_url + t.string :device + t.string :language + t.string :average_rating + t.integer :number_of_ratings + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 120310cea..1b7ff795b 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2022_03_23_151052) do +ActiveRecord::Schema[7.0].define(version: 2022_04_05_005734) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -69,6 +69,24 @@ t.index ["user_id"], name: "index_collections_on_user_id" end + create_table "digital_product_versions", force: :cascade do |t| + t.bigint "digital_product_id" + t.string "store_url" + t.string "platform" + t.string "version_number" + t.date "publish_date" + t.string "description" + t.string "whats_new" + t.string "screenshot_url" + t.string "device" + t.string "language" + t.string "average_rating" + t.integer "number_of_ratings" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["digital_product_id"], name: "index_digital_product_versions_on_digital_product_id" + end + create_table "digital_products", force: :cascade do |t| t.integer "organization_id" t.integer "user_id" diff --git a/spec/factories/digital_product.rb b/spec/factories/digital_product.rb new file mode 100644 index 000000000..6e8e753e1 --- /dev/null +++ b/spec/factories/digital_product.rb @@ -0,0 +1,16 @@ +FactoryBot.define do + factory :digital_product do + organization + user + service { 'Test Service' } + url { 'test Url' } + code_repository_url { 'Test code_repository_url' } + language { 'Ruby' } + aasm_status { 'published' } + short_description { 'test product' } + long_description { ' adsfasdfadsfadfasdfasfasdfasdf' } + notes { 'Test notes' } + tags { 'red green blue' } + certified_at { Time.now } + end +end diff --git a/spec/factories/digital_product_versions.rb b/spec/factories/digital_product_versions.rb new file mode 100644 index 000000000..317bd6c09 --- /dev/null +++ b/spec/factories/digital_product_versions.rb @@ -0,0 +1,16 @@ +FactoryBot.define do + factory :digital_product_versions do + digital_product + store_url { 'https/something.com' } + platform { 'iOS' } + version_number { '1.9' } + publish_date { Date.today } + description { 'Test description' } + whats_new { 'things' } + screenshot_url { 'https://something.com/image' } + device { 'tablet' } + language { 'ObjectiveC' } + average_rating { '4.5' } + number_of_ratings { 25 } + end +end diff --git a/spec/features/admin/omb_cx_reporting_collections_spec.rb b/spec/features/admin/omb_cx_reporting_collections_spec.rb index 924729378..3c7ab07ed 100644 --- a/spec/features/admin/omb_cx_reporting_collections_spec.rb +++ b/spec/features/admin/omb_cx_reporting_collections_spec.rb @@ -55,7 +55,7 @@ end it "display successful flash message" do - expect(page).to have_content("Omb cx reporting collection was successfully created.") + expect(find(".usa-alert__text")).to have_content("Omb cx reporting collection was successfully created.") end end @@ -73,7 +73,7 @@ travel 14.minutes click_on "Update CX Service Detail Report" - expect(page).to have_content("Omb cx reporting collection was successfully created.") + expect(find(".usa-alert__text")).to have_content("Omb cx reporting collection was successfully created.") end end end @@ -85,7 +85,7 @@ end it "render a successful response" do - expect(page).to have_content("Omb cx reporting collection was successfully updated.") + expect(find(".usa-alert__text")).to have_content("Omb cx reporting collection was successfully updated.") end end end diff --git a/spec/models/digital_product_version_spec.rb b/spec/models/digital_product_version_spec.rb new file mode 100644 index 000000000..6ee8245af --- /dev/null +++ b/spec/models/digital_product_version_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe DigitalProductVersion, type: :model do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index a1d5e07e7..0f7f75f62 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -39,8 +39,8 @@ Capybara::Selenium::Driver.new(app, browser: :chrome) end # Capybara.javascript_driver = :selenium # Run feature specs with Firefox -Capybara.javascript_driver = :selenium_chrome # Run feature specs with Chrome -# Capybara.javascript_driver = :selenium_chrome_headless # Run feature specs with headless Chrome +# Capybara.javascript_driver = :selenium_chrome # Run feature specs with Chrome +Capybara.javascript_driver = :selenium_chrome_headless # Run feature specs with headless Chrome Capybara.default_max_wait_time = 3 Capybara.raise_server_errors = true