Skip to content

Commit

Permalink
Create DigitalProductVersions
Browse files Browse the repository at this point in the history
  • Loading branch information
aktfrikshun authored Apr 7, 2022
1 parent 3d6c253 commit ec17a20
Show file tree
Hide file tree
Showing 10 changed files with 85 additions and 6 deletions.
1 change: 1 addition & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,7 @@ GEM

PLATFORMS
x86_64-darwin-19
x86_64-darwin-20

DEPENDENCIES
aasm (~> 5.2.0)
Expand Down
1 change: 1 addition & 0 deletions app/models/digital_product.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
class DigitalProduct < ApplicationRecord
has_many :digital_product_versions
end
3 changes: 3 additions & 0 deletions app/models/digital_product_version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class DigitalProductVersion < ApplicationRecord
belongs_to :digital_product
end
19 changes: 19 additions & 0 deletions db/migrate/20220405005734_create_digital_product_versions.rb
Original file line number Diff line number Diff line change
@@ -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
20 changes: 19 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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"
Expand Down
16 changes: 16 additions & 0 deletions spec/factories/digital_product.rb
Original file line number Diff line number Diff line change
@@ -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
16 changes: 16 additions & 0 deletions spec/factories/digital_product_versions.rb
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions spec/features/admin/omb_cx_reporting_collections_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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
5 changes: 5 additions & 0 deletions spec/models/digital_product_version_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
require 'rails_helper'

RSpec.describe DigitalProductVersion, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end
4 changes: 2 additions & 2 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit ec17a20

Please sign in to comment.