$ rails console -e test --sandbox
require 'factory_bot'; include FactoryBot::Syntax::Methods| [nil, | |
| "Pending", | |
| "Pending", | |
| "Pending", | |
| "Accepted", | |
| "Accepted", | |
| "Accepted", | |
| "Accepted", | |
| "Accepted", | |
| "Accepted", |
| { | |
| "EntityId":"0688705d-ea53-4010-8cb6-570fcb44e0d4", | |
| "OrganisationId":"dce2c439-040b-448c-879c-045d99da9193", | |
| "BranchId":"4aa26861-251d-46bc-9261-194d7a343e94", | |
| "ExternalDonorBranchId":"TESCO:6316", | |
| "DonationId":"67fe8dca-de31-4500-9729-1857f450888c", | |
| "ExternalDonationId":"d565d704-2d3b-4297-992e-68b7577c779f", | |
| "DonationCreatedAt":"2023-08-07T18:29:37.000000Z", | |
| "Metadata":null, | |
| "MessageType":"OfferPending", |
| { | |
| "EntityId":"0688705d-ea53-4010-8cb6-570fcb44e0d4", | |
| "OrganisationId":"dce2c439-040b-448c-879c-045d99da9193", | |
| "BranchId":"4aa26861-251d-46bc-9261-194d7a343e94", | |
| "ExternalDonorBranchId":"TESCO:6316", | |
| "DonationId":"67fe8dca-de31-4500-9729-1857f450888c", | |
| "ExternalDonationId":"d565d704-2d3b-4297-992e-68b7577c779f", | |
| "DonationCreatedAt":"2023-08-07T18:29:37.000000Z", | |
| "Metadata":null, | |
| "MessageType":"OfferPending", |
| # Bad | |
| class MyClass | |
| COSNT_NAME = "boz" | |
| attr_reader :foo, :bar, :baz | |
| def initialize(foo, bar, baz) | |
| @foo = foo | |
| @bar = bar | |
| @baz = baz | |
| end |
| require 'nokogiri' | |
| require 'uri' | |
| require 'net/http' | |
| require 'byebug' | |
| require 'json' | |
| # Block example | |
| def requester(url, &block) | |
| uri = URI(url) | |
| res = Net::HTTP.get_response(uri) |
| require 'benchmark' | |
| require 'dry-struct' | |
| require 'ostruct' | |
| require 'hashie' | |
| require 'active_support' | |
| class ClassCar | |
| attr_accessor :wheels, :mileage | |
| end |
$ rails console -e test --sandbox
require 'factory_bot'; include FactoryBot::Syntax::Methods| def my_method | |
| # ... | |
| rescue NoMethodError => e | |
| Sentry.with_scope do |scope| | |
| scope.set_tags(foo: "bar") # <= Searchable tags | |
| scope.set_context('Model Attributes', @local_instance_variable.attributes) # <= Logs extra hash of data | |
| Sentry.capture_message("A test message") # <= Your custom message | |
| Sentry.capture_error(e) # <= Log the error | |
| end | |
| end |
| # Usage: | |
| # | |
| # Settings.configure do |c| | |
| # c.foo = "biz" | |
| # c.bar = "boo" | |
| # end | |
| # Test.config.foo | |
| # => "biz" | |
| # Test.configured? |
| web: | |
| <<: *app | |
| environment: | |
| <<: *web_environment | |
| PASSENGER_STARTUP_FILE: "spec/internal_test_hyku/config.ru" | |
| PASSENGER_ENGINE: "builtin" | |
| PASSENGER_APP_TYPE: "rack" | |
| PASSENGER_ADDRESS: "0.0.0.0" | |
| PASSENGER_PORT: "3000" | |
| PASSENGER_FRIENDLY_ERROR_PAGES: "true" |