Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/cypress/474 add cypress db seeds #126

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions db/factories/grant_factory.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# frozen_string_literal: true

def count_words(section_title, section_text)
str = "#{section_title} #{section_text}"
str.strip.split(/\s+/).length
end

class GrantFactory
GrantFactory::SECTIONS_TEXT = [
<<-TEXT,
Expand Down Expand Up @@ -148,7 +153,23 @@ class GrantFactory
TEXT
].freeze

GrantFactory::SECTIONS_TITLE = [
'Mission',
'What We Do',
'Community Engagement and Empowerment Programs',
'Case Management Program',
'Assistance for Families With Children',
'Adult Education Guidance Program',
'Legal Services'
].freeze

def self.section_text
GrantFactory::SECTIONS_TEXT.sample
end

def self.section_info
section_text = GrantFactory::SECTIONS_TEXT.sample
section_title = GrantFactory::SECTIONS_TITLE.sample
{ text: section_text, title: section_title, wordcount: count_words(section_title, section_text) }
end
end
Loading