In which we get just a few more tests written.
News of the day #
Supporting the NEWS
setting was pretty straightforward, even the multi-line stuff once I realized
that having carriage returns in Ruby regular expressions doesn’t work well along with ^
and $
for some reason.
(Un)Stocking the Shelves #
The next two settings to tackle are ClearStores
and RestockStores
, which clearly have to do
with vendors, but what do they really do?
|
|
Makes sense, but how are “original” items, to be restocked, identified? A couple of stored procedures, apparently:
|
|
|
|
So let’s first try a couple to tests that just give something to be cleared and to be restocked, then check the logs that it was supposedly done:
|
|
…required a surprising amount of code to actually implement. A store needs to be attached to a merchant NPC, so we added some database code for both adding an NPC as well as adding items to a store. Watching the database confirms that the non-original “Small Rock” disappears, and the log reflects that. Then:
|
|
So we watch the database and see the “Red Berries” get restocked back to 33. But the test still fails:
Waiting for log to contain "Restocked 1 store records.".
Waiting for log to contain "Restocked 1 store records.".
Waiting for log to contain "Restocked 1 store records.".
Waiting for log to contain "Restocked 1 store records.".
Waiting for log to contain "Restocked 1 store records.".
Waiting for log to contain "Restocked 1 store records.".
Waiting for log to contain "Restocked 1 store records.".
Waiting for log to contain "Restocked 1 store records.".
Waiting for log to contain "Restocked 1 store records.".
Waiting for log to contain "Restocked 1 store records.".
execution expired (Timeout::Error)
./features/lib/server_helper.rb:26:in `sleep'
./features/lib/server_helper.rb:26:in `block (2 levels) in log_contains'
./features/lib/server_helper.rb:20:in `loop'
./features/lib/server_helper.rb:20:in `block in log_contains'
./features/lib/server_helper.rb:19:in `log_contains'
./features/steps/vendor_steps.rb:27:in `/^the log shows "([^"]*)" items restocked in stores$/'
and in the log:
6/28/2016 9:52:25 PM: {SystemGo} Spawning NPCs.
6/28/2016 9:52:25 PM: {SystemGo} Deleted 1 store records.
6/28/2016 9:52:25 PM: {SystemGo} Restocked 0 store records.
6/28/2016 9:52:25 PM: {SystemGo} Master round timer started.
So the store is being restocked, but the log isn’t showing it. Drilling down through the DAL, we
find that the stored procedure is returning 0 despite having actually changed rows. @bug
and
move on, hopefully it’ll be a simple fix.
Now how much will it take to have an actual in-world NPC merchant show its stores having been cleared and/or restocked? I’m eager to find out. Tomorrow.
Useful Stuff #
- Rubular: a Ruby regular expression editor
- Jekyll-lambda theme
- Useful methods to process tables in Cucumber step definitions