jacksop has quit [Remote host closed the connection]
lightstalker has joined #ruby
lalitmee has joined #ruby
absolutejam has joined #ruby
jottr_ has joined #ruby
absolutejam has quit [Ping timeout: 245 seconds]
rafadc has quit [Ping timeout: 245 seconds]
rafadc has joined #ruby
mochiyoda has quit [Quit: Konversation terminated!]
mochiyoda has joined #ruby
absolutejam has joined #ruby
jottr_ has quit [Ping timeout: 258 seconds]
amateur_rubyist has joined #ruby
absolutejam has quit [Ping timeout: 246 seconds]
jottr_ has joined #ruby
jottr_ has quit [Ping timeout: 245 seconds]
ramfjord has joined #ruby
ur5us has joined #ruby
ramfjord has quit [Ping timeout: 258 seconds]
alfiemax has quit [Remote host closed the connection]
Yuyu0 has joined #ruby
star_prone1 has quit [Ping timeout: 245 seconds]
star_prone has joined #ruby
jmcgnh_ has joined #ruby
jmcgnh has quit [Ping timeout: 268 seconds]
jmcgnh_ is now known as jmcgnh
jmcgnh is now known as jmcgnh_
jmcgnh_ is now known as jmcgnh
absolutejam has joined #ruby
cthulchu_ has joined #ruby
cthu| has quit [Ping timeout: 248 seconds]
NL3limin4t0r_afk is now known as NL3limin4t0r
DTZUZO has quit [Ping timeout: 258 seconds]
sylario has joined #ruby
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
alfiemax has joined #ruby
Fischmiep has quit [Quit: WeeChat 2.3]
ur5us has quit [Remote host closed the connection]
Technodrome has joined #ruby
ur5us has joined #ruby
queip has quit [Ping timeout: 245 seconds]
ur5us has quit [Ping timeout: 246 seconds]
alfiemax has quit []
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
queip has joined #ruby
absolutejam has quit [Ping timeout: 246 seconds]
amateur_rubyist has quit [Remote host closed the connection]
absolutejam has joined #ruby
amateur_rubyist has joined #ruby
DaRock has joined #ruby
haengma has joined #ruby
cyclonis_ has joined #ruby
cyclonis has quit [Ping timeout: 246 seconds]
haengma has quit [Ping timeout: 272 seconds]
esrse` has quit [Ping timeout: 245 seconds]
lose has joined #ruby
paprika has joined #ruby
paprika has quit [Client Quit]
tsujp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
teclator has quit [Ping timeout: 246 seconds]
cyclonis_ has quit [Read error: Connection reset by peer]
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
dino has joined #ruby
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
cyclonis has joined #ruby
gheegh has joined #ruby
reber has joined #ruby
x86sk has quit [Quit: Connection closed for inactivity]
<gheegh>
hey all. Question. I have a gem i wrote that i'm tyring to improve the speed of. Basically, every time it runs, it loads its config file from disk (0.04s) and deserializes data (0.04) taking almost a 10th of a second. Not that big of a problem, except that this is called HUNDREDS of times per each process. This ends up adding almost 10 seconds to a job process. I was looking at adding the data to the bottom of the config.rb
<gheegh>
file itself already processed, but I guess that's deprecated now? Any thoughts on how to eliminate the IO and preprocessing?
ramfjord has joined #ruby
ramfjord has quit [Ping timeout: 244 seconds]
AJA4350 has joined #ruby
teclator has joined #ruby
dino has quit [Quit: Leaving]
schneider has quit [Ping timeout: 272 seconds]
schneider has joined #ruby
queip has quit [Ping timeout: 248 seconds]
amateur_rubyist has quit [Remote host closed the connection]
cd has joined #ruby
amateur_rubyist has joined #ruby
queip has joined #ruby
lalitmee has quit [Remote host closed the connection]
amateur_rubyist has quit [Ping timeout: 246 seconds]
ur5us has joined #ruby
amateur_rubyist has joined #ruby
ur5us has quit [Ping timeout: 245 seconds]
dionysus69 has quit [Ping timeout: 248 seconds]
cyclonis_ has joined #ruby
amateur_rubyist has quit [Ping timeout: 245 seconds]
cyclonis has quit [Ping timeout: 244 seconds]
DTZUZO has joined #ruby
stryek has joined #ruby
cyclonis_ has quit [Quit: -a- Connection Timed Out]
<NL3limin4t0r>
gheegh: Does the info change during runtime?
<gheegh>
no
<gheegh>
right now, i'm just throwing them into hashes that are in the source code itself.. which is a bit clumsy.. but it might work.. if that owrks, then i'll generate a rake/bin type task that takes the config data and genreates a class that has this data in it.. so we can update the config in a nice yaml format and then produce the cached/computed file..
<gheegh>
so that the data is loaed, pre-computed, on source code load
<NL3limin4t0r>
I'd say load it once when your gem is loaded, and assign it to a constant or class instance variable. Then use that instead of loading it from the file each time. Constants should stay loaded.
<gheegh>
because the other slow part is that we compute indexes on the data..
<gheegh>
yeah.. that's the plan. Thanks for the feedback!
<gheegh>
good to konw i'm not doing it totally wrong
<NL3limin4t0r>
You can also change the file format to use YAML or JSON instead if that better suits your needs.
tsujp has joined #ruby
<NL3limin4t0r>
Rails loads it's config into `Rails.conf` for example. Which is just an class instance variable accessor.
absolutejam has quit [Ping timeout: 272 seconds]
<havenwood>
gheegh: fwiw, Marshal loads faster than YAML
<havenwood>
gheegh: if you don't need gems, Ruby starts faster with --disable-all
cyclonis has joined #ruby
BrianWGray has joined #ruby
<NL3limin4t0r>
Don't mind my comment about `Rails.conf` that's not entirely valid. They hide it somewhere else, but most gems do something like `GemName.config`.
<gheegh>
yeah, its nto the ruby part.. but it's a Gem
Milos has quit [Ping timeout: 245 seconds]
Milos_ has joined #ruby
<gheegh>
i have that in my Gem the GemName. config
leitz has joined #ruby
<gheegh>
but i'm trying to cache what that does when it loads the file
<leitz>
Anyone familiar with "Ruby Deep Dive" by Jesus Castello, and care to comment?
<havenwood>
gheegh: Does the config need to be human readable and editable?
amateur_rubyist has quit [Client Quit]
<gheegh>
so, the problem is that the gem is called every time we need to parse a URL
<gheegh>
and so this conf file gets initialized over and over again
<gheegh>
no, i can generate a config file from teh raw one that's not readable..
absolutejam has joined #ruby
<NL3limin4t0r>
`@config ||= load_stuff` should only load @config if it's falsey. If @config is a class instance variable it should stay loaded as long as the class is loaded.
grilix has joined #ruby
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
<NL3limin4t0r>
^ or module
<gheegh>
right
<NL3limin4t0r>
Can you provide a small code snippet?
<gheegh>
Yea, let me get this part sorted then I will..
<gheegh>
its got a module_function method that is the main "callable" called .parse and this pulls data from the config when it needs it
<gheegh>
and in the config they're all modules with memoized instance variablels
<gheegh>
but every time the Gem.parse is called, it reloads the config
lucasb has joined #ruby
<gheegh>
or at least prints the puts i added in the memoized work part
absolutejam has quit [Ping timeout: 245 seconds]
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
absolutejam has joined #ruby
grilix has quit [Quit: Ooops]
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
involans has quit [Quit: involans]
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
star_prone has quit [Quit: Leaving.]
bmurt has joined #ruby
cyclonis has joined #ruby
cyclonis has quit [Excess Flood]
bmurt has quit [Ping timeout: 245 seconds]
Fischmiep has joined #ruby
suukim has quit [Quit: Konversation terminated!]
andikr has quit [Ping timeout: 258 seconds]
andikr has joined #ruby
bmurt has joined #ruby
al2o3-cr has quit [Quit: WeeChat 2.5]
doshirae has quit [Ping timeout: 272 seconds]
al2o3-cr has joined #ruby
andikr has quit [Ping timeout: 268 seconds]
Sp4rKy has quit [Quit: leaving]
Sp4rKy has joined #ruby
Sp4rKy_ has joined #ruby
FastJack has quit [Ping timeout: 264 seconds]
Fischmiep has quit [Quit: WeeChat 2.3]
Fischmiep has joined #ruby
queip has quit [Ping timeout: 268 seconds]
haengma has joined #ruby
andikr has joined #ruby
haengma has quit [Ping timeout: 268 seconds]
luminousnine has quit [Quit: Toodles]
baojg has quit [Remote host closed the connection]
xfbs has quit [Ping timeout: 250 seconds]
spectra has quit [Ping timeout: 248 seconds]
queip has joined #ruby
gb_away has quit [Ping timeout: 245 seconds]
queip has quit [Ping timeout: 272 seconds]
wald0 has joined #ruby
gb_away has joined #ruby
queip has joined #ruby
chalkmonster has joined #ruby
leitz has quit [Ping timeout: 245 seconds]
john2496 has joined #ruby
dionysus69 has joined #ruby
gigetoo has quit [Ping timeout: 248 seconds]
spectra has joined #ruby
gigetoo has joined #ruby
mustmodify__ has joined #ruby
dionysus69 has quit [Read error: Connection reset by peer]
involans has joined #ruby
ur5us has joined #ruby
dionysus69 has joined #ruby
involans has quit [Remote host closed the connection]
involans has quit [Remote host closed the connection]
mistym has joined #ruby
mistym has quit [Changing host]
mistym has joined #ruby
spectra has quit [Ping timeout: 248 seconds]
Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
aecepoglu[m] has quit [Ping timeout: 248 seconds]
Seance[m] has quit [Ping timeout: 248 seconds]
involans has joined #ruby
leitz has joined #ruby
<mustmodify__>
Is there a regex that will match any character in utf8 that isn't in latin1? I gather that would be characters taking up more than 1 byte.
Yxhuvud has joined #ruby
asio has quit [Ping timeout: 245 seconds]
gigetoo has quit [Ping timeout: 245 seconds]
ur5us has quit [Ping timeout: 245 seconds]
marahin has quit [Ping timeout: 248 seconds]
gigetoo has joined #ruby
asio has joined #ruby
dionysus69 has quit [Ping timeout: 272 seconds]
mustmodify__ has left #ruby [#ruby]
mustmodify__ has joined #ruby
marahin has joined #ruby
marahin has quit [Changing host]
marahin has joined #ruby
schneider has quit [Ping timeout: 272 seconds]
Seance[m] has joined #ruby
aecepoglu[m] has joined #ruby
Swyper has joined #ruby
creat has joined #ruby
absolutejam has quit [Ping timeout: 245 seconds]
absolutejam has joined #ruby
john2496 has quit [Remote host closed the connection]
<NL3limin4t0r>
gheegh: I'd say create another handle that caches the result of `parse` and uses that instead.
luminousnine has joined #ruby
luminousnine has quit [Changing host]
luminousnine has joined #ruby
jacksop has joined #ruby
xfbs has joined #ruby
gigetoo has quit [Ping timeout: 248 seconds]
chalkmonster has quit [Quit: WeeChat 2.5]
gigetoo has joined #ruby
john2496 has joined #ruby
<leitz>
Should I take that as a "no" on "Ruby Deep Dive"? :)
spectra has joined #ruby
<NL3limin4t0r>
mustmodify__: You can provide a range not to match. `/[^\u{0}-\u{FF}]/`
<NL3limin4t0r>
leitz: It's a no from me at least.
sh7d_ has quit [Ping timeout: 248 seconds]
sh7d has joined #ruby
chambln has quit [Ping timeout: 245 seconds]
<NL3limin4t0r>
mustmodify__: Basic ascii is 0000-007F.
<mustmodify__>
NL3limin4t0r: thank you!
mustmodify__ has left #ruby [#ruby]
<leitz>
NL3limin4t0r, thanks! I'm happy to support Ruby authors and trainers, and always happy to add to my accumulation of material.
johnny56_ has quit [Ping timeout: 272 seconds]
johnny56 has joined #ruby
reber has quit [Read error: Connection reset by peer]
jacksop has quit [Remote host closed the connection]
drnerdius has joined #ruby
drnerdius has quit [Quit: Quit]
drnerdius has joined #ruby
drnerdius has quit [Client Quit]
drnerdius has joined #ruby
baojg has joined #ruby
SeepingN has joined #ruby
sh7d has quit [Ping timeout: 248 seconds]
sh7d has joined #ruby
lxsameer has quit [Ping timeout: 244 seconds]
absolutejam has quit [Ping timeout: 244 seconds]
Swyper has quit [Remote host closed the connection]
rippa has joined #ruby
involans has quit [Quit: involans]
involans has joined #ruby
nowhere_man has joined #ruby
wald0 has quit [Ping timeout: 272 seconds]
wald0 has joined #ruby
lxsameer has joined #ruby
emptyflask has joined #ruby
FastJack has joined #ruby
drnerdius has quit [Ping timeout: 244 seconds]
drnerdius has joined #ruby
nowhere_man has quit [Ping timeout: 258 seconds]
suukim has joined #ruby
nowhere_man has joined #ruby
ur5us has joined #ruby
ellcs1 has joined #ruby
involans has joined #ruby
schneider has joined #ruby
al-damiri has joined #ruby
ur5us has quit [Ping timeout: 245 seconds]
Technodrome has joined #ruby
Tempesta has quit [Quit: See ya!]
TomyWork has quit [Ping timeout: 246 seconds]
haengma has joined #ruby
haengma has quit [Remote host closed the connection]
haengma has joined #ruby
andikr has quit [Remote host closed the connection]
Tempesta has joined #ruby
emptyflask has quit [Ping timeout: 244 seconds]
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gix has joined #ruby
john2496 has quit [Remote host closed the connection]
john2496 has joined #ruby
emptyflask has joined #ruby
cthulchu_ has quit [Ping timeout: 258 seconds]
Swyper has joined #ruby
drnerdius has quit [Remote host closed the connection]
Sp4rKy_ has quit [Quit: Lost terminal]
emptyflask has quit [Ping timeout: 258 seconds]
akem-hp has quit [Remote host closed the connection]
akem-hp has joined #ruby
Swyper has quit [Remote host closed the connection]
<nius>
How should I handle path inputs to a ruby program? (with argv)?
<nius>
i.e. ../file is a valid input
<nius>
also /file
<nius>
also file
ellcs1 has quit [Ping timeout: 264 seconds]
akem-hp has quit [Remote host closed the connection]
<nius>
looks like Pathname.new is the way to go
akem-hp has joined #ruby
<nius>
Is it correct to use Pathname.new(Dir.pwd).join(ARGV[0]) if the user is running the command in the desired directory? (e.g. `my-cat ../file.txt`)
akem-hp has quit [Remote host closed the connection]
crankharder has quit [Ping timeout: 246 seconds]
nowhere_man has quit [Ping timeout: 248 seconds]
haengma has quit [Remote host closed the connection]
fphilipe_ has quit [Ping timeout: 248 seconds]
vjacob has quit [Ping timeout: 272 seconds]
john2496 has quit [Remote host closed the connection]
queip has quit [Ping timeout: 245 seconds]
phroa has joined #ruby
queip has joined #ruby
emptyflask has joined #ruby
cthulchu has joined #ruby
haengma has joined #ruby
Exuma has joined #ruby
schneider has quit [Ping timeout: 272 seconds]
DaRock has quit [Ping timeout: 248 seconds]
r29v has joined #ruby
john2496 has joined #ruby
drnerdius has joined #ruby
drnerdius has quit [Remote host closed the connection]
impermanence has joined #ruby
drnerdius has joined #ruby
drnerdius has quit [Remote host closed the connection]
emptyflask has quit [Ping timeout: 245 seconds]
<adam12>
nius: Could use File.expand_path(ARGV[0], Dir.pwd)
Guest33 has joined #ruby
<adam12>
nius: There is likely nothing wrong with your approach either, tho I don't know if it expands symlinks. That may or may not be an issue for you.
<adam12>
(I can't think if my solution will expand symlinks either, tbh)
<nius>
yeah that's fine, thx
<nius>
just writing a little tool to automatically show a local files encrypted counterpart in encfs
rippa has quit [Ping timeout: 245 seconds]
Guest33 has quit [Client Quit]
plasticchicken has joined #ruby
rippa has joined #ruby
drnerdius has joined #ruby
yann-kaelig has quit [Quit: yann-kaelig]
ramfjord has joined #ruby
haengma has quit [Remote host closed the connection]
drnerdius has quit [Client Quit]
drnerdius has joined #ruby
drnerdius has quit [Client Quit]
drnerdius has joined #ruby
haengma has joined #ruby
drnerdius has quit [Client Quit]
drnerdius has joined #ruby
banisterfiend has joined #ruby
ravenous_ has joined #ruby
drnerdius has quit [Remote host closed the connection]
cd has quit [Read error: Connection reset by peer]
poontangmessiah has joined #ruby
haengma has quit [Remote host closed the connection]
impermanence has quit [Ping timeout: 245 seconds]
suukim has quit [Quit: Konversation terminated!]
Exuma has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
akem-hp has joined #ruby
psilly0 has joined #ruby
<psilly0>
Hello all, i am writing a spec test for a my sequel insert code
<psilly0>
I am new to ruby. what is a good spec test? connecting to DB and reading the table that i will write to?
Exuma has joined #ruby
NL3limin4t0r has quit [Quit: WeeChat 1.9.1]
drnerdius has joined #ruby
al-damiri has quit [Quit: Connection closed for inactivity]
griffindy has joined #ruby
<leitz>
adam12, can I borrow some of your XML-fu? I'm trying to figure out why I keep having to remove the first few sections of an XML file before processing works.
pep7 has quit [Read error: Connection reset by peer]
poontangmessiah has quit [Remote host closed the connection]
<adam12>
leitz: Post your question. Whether I have an answer or any XML-fu is another.
<leitz>
Hehe...
<psilly0>
Hello all, i am writing a spec test for a my sequel insert code. I am new to ruby. what is a good spec test? connecting to DB and reading the table that i will write to?
griffindy has quit [Ping timeout: 246 seconds]
<leitz>
I have some largish XML files that I parse. I don't know a lot of XML; what I do know is that I have to manually munge the first several sections to get the file to parse via Nokogiri. Normally I'd assume the error was mine, but since I have to do the equivalent of htmlentities on the XML, I don't have a high regard for the author.
SeepingN has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<leitz>
If I'm doing something wrong, because I don't know XML, please let me know what to look up and fix.
Swyper has joined #ruby
absolutejam has joined #ruby
<psilly0>
Hello all, i am writing a spec test for a mySQL insert using suquel gem in some code. I am new to ruby. what is a good spec test? connecting to DB and reading the table that i will write to?
<leitz>
psilly0, didn't we talk about this a few days ago?
<psilly0>
yea but i got some many differnt answer i don’t know which i correct
<leitz>
You really want to look at Mocks, likely with RSpec. There are other options, but that's the one I know to recommend.
<adam12>
leitz: I looked over your code but nothing stands out. Can you make something quick and easy I can reproduce locally? Busy day for me. Don't have a ton of time to sit around digging deep into things.
<psilly0>
ill look into that thanks lietz
<leitz>
You want to do one simple test to ensure you can pull data from your actual DB, and then Mock the rest.
<adam12>
psilly0: What makes you want to spec this anyways? Pretty sure Sequel ships with like 50,000 lines of tests.
<leitz>
adam12, will do. I'll set up a simple test with both types of file.
<psilly0>
upper mgmt said everything should have a spec test
<adam12>
(64,356 lines actually)
<leitz>
Also, adam12, this has stumped me for months. Take your time. :)
<adam12>
psilly0: You should ask them to write the first one for you.
<adam12>
psilly0: This is what we did back in 2004, first versions of Rails. Until everyone realized it's a huge waste of time.
<psilly0>
im afarid
haengma has joined #ruby
wald0 has quit [Ping timeout: 246 seconds]
drnerdius has quit [Read error: Connection reset by peer]
drnerdius has joined #ruby
Swyper has quit [Remote host closed the connection]
Swyper has joined #ruby
<leftylink>
I would say this. I agree with previously-given opinions that say that it is not the job of the client to test that insert does in fact insert. that's a job for sequel's tests. however it does seem reasonable to test that the piece of code that registers a user does in fact register a user
<leftylink>
you may replace the phrase "register a user" with any other phrase as appropriate to the code in question
<leftylink>
"saves a recipe"
<leftylink>
"adds a song to the playlist"
<leftylink>
"foos a bar"
Swyper has quit [Remote host closed the connection]
wald0 has joined #ruby
Swyper has joined #ruby
<psilly0>
thanks you
fphilipe_ has joined #ruby
frich has joined #ruby
Swyper has quit [Remote host closed the connection]
<leitz>
Again, any help you can provide is much appreciated.
queip has quit [Ping timeout: 245 seconds]
lalitmee has joined #ruby
wald0 has quit [Quit: Lost terminal]
john2496_ has joined #ruby
john2496 has quit [Read error: Connection reset by peer]
Swyper has quit [Remote host closed the connection]
thebananaking has quit [Quit: Connection closed for inactivity]
Swyper has joined #ruby
Swyper has quit [Remote host closed the connection]
Swyper has joined #ruby
schneider has joined #ruby
queip has joined #ruby
<ramfjord>
Really, you guys aren
<ramfjord>
Really, you guys aren't fans of testing queries/inserts on a test DB? Personally I feel like eventually some user is going to input some value that gets rejected or processed differently by your DB than you expect, and it will be nice to add that specific input to a list of test cases
<ramfjord>
Same reason I get a little annoyed that rails ships with SQLite as the default test DB
<ramfjord>
would rather make my test DB as similar to prod as possible
<ramfjord>
pretty easy to make one for your dev environment these days with docker-compose
wildtrees has joined #ruby
fphilipe_ has quit [Ping timeout: 246 seconds]
Swyper has quit [Remote host closed the connection]
Swyper has quit [Remote host closed the connection]
Swyper has joined #ruby
ravenous_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Swyper has quit [Remote host closed the connection]
Swyper has joined #ruby
Swyper has quit [Remote host closed the connection]
Swyper has joined #ruby
Technodrome has joined #ruby
tpanarch1st has joined #ruby
<leitz>
A lot of folks don't know, or care for, containers.
Swyper has quit [Remote host closed the connection]
<leitz>
Further, testing the database's data is usually not the application's responsibility. The data should be sanitized before input, or you might want to run clean up routines regularly.
<leitz>
Mocks allow you to test faster, without waiting on the database, and with specific data sets to test.
<leitz>
You don't have to worry about a user changing your data, or the DBA doing work on something, or the network being flakey, etc.
Swyper has joined #ruby
<ramfjord>
That's why you use a local test database with teh schema dumped from prod - no waiting on anyone, no problem when the DBA does anything
<leitz>
Nothing wrong with full tests right before deployment, but the usual Developer tests lots of times before being close to production.
<ramfjord>
Also means that you can take advantage of DB specific behavior, and test thing like complicated views for your application
<ramfjord>
we use lateral join a bit, for instance, which won't work on non-postgres. But it's useful to be able to put out a PR that migrates the view, runs the tests, validates they pass on example data
cadeskywalker has quit [Ping timeout: 248 seconds]
<ramfjord>
FactoryBot makes it easy to generate the test data for each test on the fly
Swyper has quit [Remote host closed the connection]
ur5us has joined #ruby
<ramfjord>
especailly if you're constructing any complicated query in teh application IMO it's better to test on an actual DB with the same version and schema as your prod DB
Swyper has joined #ruby
<ramfjord>
Using containers just makes it so the dev only needs to install docker, not necessarily rbenv/rvm, whatever C library dependencies you have, a database, npm, webpacker, bundler... etc
<ramfjord>
don't have to use them in prod to get that advantage
Swyper has quit [Remote host closed the connection]
Swyper has joined #ruby
lalitmee has quit [Quit: Leaving]
<ramfjord>
you also won't catch issues with stuff like parsing dates incorrectly if you've made the mistake of using the postgres timstamp type, losing precision on jsonb float fields... There are a ton of things that you won't catch without running tests on the actual DB
<ramfjord>
but you shouldn't use the prod db
<ramfjord>
you should use a local test DB
<adam12>
ramfjord: I might test if the database field has a constraint I care about, but generally, no. And realistically, with psilly0's question, Sequel by default raises on save failure. So assert SomeModel.create(attributes) should be enough.
tpanarch1st_ has joined #ruby
tpanarch1st has quit [Ping timeout: 272 seconds]
<adam12>
ramfjord: I might test queries / subsets I care about, especially if they are security-risky. I might create 2 records for users and ensure that only the one I flag as an administrator is included in the subset for administrators. That kind of thing.
<adam12>
I _especially_ will not stub/mock the database. It's been too painful in the past.
<ramfjord>
If it raises on save failure by default, that just means your prod import will fail when it chokes on a bad field. Maybe you even want to test that the import skips and logs rows which are poorly formatted. I'd probably write at least 2 tests for each import: success case, failure case. And validate that the failure outputs the proper response/error
<ramfjord>
I've also seen too mnay people burned by mocking the database
<ramfjord>
stupid stuff like not realizing that their role didn't have access to the table they were using
<ramfjord>
but that stuff can end up costing money
imjameshall has joined #ruby
cadeskywalker has joined #ruby
Swyper has quit [Remote host closed the connection]
imjameshall has quit [Client Quit]
fphilipe_ has quit [Ping timeout: 246 seconds]
Swyper has joined #ruby
Swyper has quit [Remote host closed the connection]
Swyper has joined #ruby
absolutejam1 has quit [Ping timeout: 272 seconds]
Swyper has quit [Remote host closed the connection]
queip has quit [Ping timeout: 272 seconds]
evdubs has quit [Remote host closed the connection]
evdubs has joined #ruby
queip has joined #ruby
Swyper has joined #ruby
Eiam has joined #ruby
Swyper has quit [Remote host closed the connection]
fphilipe_ has joined #ruby
dbugger has quit [Ping timeout: 264 seconds]
BTRE has quit [Remote host closed the connection]
<cthulchu>
do we do functional in Ruby?
haengma has quit [Remote host closed the connection]
haengma has joined #ruby
duckpuppy has quit [Ping timeout: 248 seconds]
john2496_ has quit [Remote host closed the connection]
Freshnuts has joined #ruby
schneider has quit [Ping timeout: 258 seconds]
absolutejam1 has joined #ruby
bmurt has joined #ruby
ur5us has quit [Remote host closed the connection]
ur5us has joined #ruby
lxsameer has quit [Ping timeout: 258 seconds]
ur5us has quit [Ping timeout: 248 seconds]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]