Open maebeale opened 4 years ago
@maebeale I can take a look at this. I've worked with Factory Bot before, never with traits, though. Can't be that much of a lift (hopefully) :).
Awesome and thank you, @leosoaivan !
If it's helpful, here's something I've used in another project:
factory :ticket_pickup do
pickup_quantity "1"
ticket
trait :with_ticket_quantity_of_5 do
pickup_quantity "5"
association :ticket, :with_quantity_of_5
end
end
I'll get setup with the project today. Let you know if I have any issues getting setup!
Any and all feedback welcome on the README, CONTRIBUTING, and background.md docs as you get set up, @leosoaivan ! :)
It appears I can't get docker-compose up
to run a local server on 3000.
voices-of-consent(develop) $ docker-compose up
Starting voices-of-consent_db_1 ... done
Starting voices-of-consent_redis_1 ... done
Starting voices-of-consent_mailcatcher_1 ... done
Attaching to voices-of-consent_mailcatcher_1, voices-of-consent_db_1, voices-of-consent_redis_1
db_1 | 2019-10-13 00:59:52.822 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
db_1 | 2019-10-13 00:59:52.822 UTC [1] LOG: listening on IPv6 address "::", port 5432
redis_1 | 1:C 13 Oct 2019 00:59:52.818 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
redis_1 | 1:C 13 Oct 2019 00:59:52.818 # Redis version=5.0.6, bits=64, commit=00000000, modified=0, pid=1, just started
redis_1 | 1:C 13 Oct 2019 00:59:52.818 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
redis_1 | 1:M 13 Oct 2019 00:59:52.820 * Running mode=standalone, port=6379.
redis_1 | 1:M 13 Oct 2019 00:59:52.820 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
redis_1 | 1:M 13 Oct 2019 00:59:52.820 # Server initialized
redis_1 | 1:M 13 Oct 2019 00:59:52.820 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
redis_1 | 1:M 13 Oct 2019 00:59:52.820 * DB loaded from disk: 0.000 seconds
redis_1 | 1:M 13 Oct 2019 00:59:52.820 * Ready to accept connections
db_1 | 2019-10-13 00:59:52.827 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_1 | 2019-10-13 00:59:52.845 UTC [24] LOG: database system was interrupted; last known up at 2019-10-13 00:56:34 UTC
mailcatcher_1 | Starting MailCatcher
mailcatcher_1 | ==> smtp://0.0.0.0:1025
mailcatcher_1 | /usr/lib/ruby/gems/2.5.0/gems/thin-1.5.1/lib/thin/server.rb:104: warning: constant ::Fixnum is deprecated
mailcatcher_1 | ==> http://0.0.0.0:1080/
db_1 | 2019-10-13 00:59:53.129 UTC [24] LOG: database system was not properly shut down; automatic recovery in progress
db_1 | 2019-10-13 00:59:53.131 UTC [24] LOG: redo starts at 0/1871170
db_1 | 2019-10-13 00:59:53.131 UTC [24] LOG: invalid record length at 0/1876F88: wanted 24, got 0
db_1 | 2019-10-13 00:59:53.131 UTC [24] LOG: redo done at 0/1876F50
db_1 | 2019-10-13 00:59:53.142 UTC [1] LOG: database system is ready to accept connections
Have I got the wrong port, perhaps?
@leosoaivan hey there! hmmm. i don't use the docker rendition, but someone just submitted a PR that changed that from docker-compose start
to docker-compose up
. i'll see if i can reproduce the docker problem, but in the meantime would you try docker-compose start
? (or consider using the local services option until we get this figured out.)
@maebeale just a quick update. Haven't been able to get it running locally either with docker-compose start or up.
Nevertheless, it might be moot, since I'm mostly focusing on the test suite for now. Now that everything is green, I'll be able to take a closer look at those traits in the coming days!
Thanks for the update, @leosoaivan ! Did you try the non-docker implementation? Someone else is testing the docker setup, so hopefully that'll get resolved in the next day or so. Great news about the traits! Thank you!
@leosoaivan hello there! are you still planning to work on this?
Hi @maebeale thanks for checking in, and my apologies for dropping off the face of the Earth.
Aside from the user factories in #374 , I've had some trouble getting these other ones going. I don't have much bandwidth to currently tackle them, so it may be worth unassigning me.
Thanks, @leosoaivan ! I took a hiatus on this one too. :) Ok, I'll remove you here, but would love it if we could help you get things working again -- if you want to get involved again, that is! You're in slack, right? Maybe post something there? We're having a hack night tomorrow, so there will be some help available 7pm-9pm EST. https://www.meetup.com/Code-for-Good-DC/events/268436980/
I can work on setting up traits for boxes!
We have need for varied
user
,box_request
,box
, andbox_item
factory traits (We have existing factories) for use in tests, and later to create seed data.If we had
box
traits that mimic the methods in the box model such asdesign_claimed
,design_completed
,shipping_claimed
,shipping_completed
where the relevant*_by_id
,*_at
, andaasm_state
were populated, that'd be amazing. Foruser
, we need a trait for each constant in the Permission model.This would allow us to skip all the cajoling we had to do in
box_spec.rb
. Instead, it'd be so awesome to be able to call something like:designer = create(:designer)
bc there was already a traitdesigner
on user who had an associatedcreate(:user_permission, name: Permission::BOX_DESIGNER)
assembled_box = create(:box, :is_assembled)
, which also has/mimics the traits :is_designed, :is_researched, box_request#is_reviewed, etc, bc our/box_requests
index needs all the prior lifecycle phase to be true and all future lifecycle phases to be untrue to display correctly.box_item_with_research_needed = create(:box_item_research_needed)
that is a trait on box_item that who has an associatedcreate(:inventory_type, research_needed: true)
You might want to check out:
box_rb
aasm
blocks in thebox_request
andbox.rb
modelsbox_requests/index.html.erb
orlocalhost:3000/box_requests
in your local browserdatabase-diagram.png
, linked from READMEspec/models/box_spec.rb
to see how we can manually walk box_requests along in the process.