Repo.transaction(
fn ->
if has_events_since?(filters, max_position) do
Repo.rollback(:inconsistent)
elseProposal to allow adapters to be switched at runtime in tests.
Example:
We have an EntityStore which has functions to save and find entities.
In our tests we want the ability to use different implimentations (real, dummy, in-memory etc.) in different tests.
We might want to use the real adapter in acceptance tests, a dummy one just to assert the adapter is called, and an in-memory adapter for all other tests (because it's faster).
$ gem build wisper.gemspec
Enter PEM pass phrase:
INFO: Your certificate has expired, trying to re-sign it...
ERROR: While executing gem ... (Gem::Security::Exception)
certificate /CN=kris.leech\/DC=gmail\/DC=com not valid after 2020-10-15 18:13:45 UTC
$ gem cert --re-sign -C gem-public_cert.pem -K ~/.ssh/gem-private_key.pem
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let(:model_class) do | |
| Class.new(ApplicationRecord) do | |
| self.table_name = "model_class_#{SecureRandom.uuid.delete('-')}" | |
| def self.up | |
| connection.execute("CREATE TABLE #{table_name}(id INTEGER PRIMARY KEY AUTOINCREMENT)") | |
| end | |
| def self.down | |
| ApplicationRecord.connection.execute("DROP TABLE #{table_name}") |
class MyEventHandler
include BackgroundEventHandler
def call(event)
end
end
class MyOtherEventHandler
include ForegroundEventHandler
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Add = ->(add, n) { n + add } | |
| Times = ->(times, n) { n * times } | |
| AddOne = Add.curry.call(1) | |
| TimesFour = Times.curry.call(4) | |
| AddOneTimesFour = AddOne >> TimesFour | |
| AddOneTimesFour.(2) # => 12 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require "bundler/inline" | |
| gemfile(false) do | |
| source "https://rubygems.org" | |
| gem "rspec" | |
| gem "pry-byebug" | |
| end | |
| require 'rspec/autorun' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require "bundler/inline" | |
| gemfile(false) do | |
| source "https://rubygems.org" | |
| gem "dry-struct", '0.5' | |
| gem "dry-types", '0.14' | |
| gem 'rails_event_store-rspec', '1.0.0' | |
| gem "pry-byebug" | |
| gem 'activesupport' | |
| end |
- 10:30 BG 4.5 mmol/litre
- Run:
- 6k
- 5:11 mins/km pace
- Elevation gain: 76m
- Max elevation: 107m
- 11:10 BG 6.2 mmol.litre
- Food (carbs)
- 11:50 BG 5.5 mmol/litre
- 12:30 BG 6.3 mmol/litre
ruby basic.rb
ruby aggregate_root.rb
NewerOlder