Skip to content

Instantly share code, notes, and snippets.

@catmando
catmando / rspec-example.md
Last active June 24, 2021 13:59
RSPEC Example

Here is a sample spec, there is a bug in the spec (not in the models.)

What is the bug?

describe Order do
  describe "#submit" do

    before do
 @book = Book.new(:title => "RSpec Intro", :price => 20)
@catmando
catmando / SimpleHSComponent.md
Last active June 24, 2021 14:07
A simple Hyperstack Component

Here is a simple Rails Model and a Hyperstack Component. The Hyperstack Component uses Opal Ruby. Opal is a version of Ruby that runs on the Browser.

Hyperstack is a gem that wraps React with a Ruby DSL.

class Order < ApplicationRecord
  ...
  scope :shipped, -> () { where(status: :shipped) }
  ...
end