This file contains 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
### Keybase proof | |
I hereby claim: | |
* I am noelrappin on github. | |
* I am noelrap (https://keybase.io/noelrap) on keybase. | |
* I have a public key whose fingerprint is 9D10 BE61 2831 3E78 345C F8B3 789C 84D0 FC55 9E5B | |
To claim this, I am signing this object: |
This file contains 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
PriceCalculator | |
def initialize(*items) | |
end | |
def calculate | |
200 | |
end | |
end |
This file contains 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
PriceCalculator do | |
it "returns the price of one item" do | |
calculator = PriceCalcuator.new(Item.new(price: 200)) | |
expect(calcuator.calculate).to eq(200) | |
end | |
end |
This file contains 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
# Rubocop file I use for book code | |
# Note, this is code I work on by myself, so some. things that I don't do I may not have covered | |
AllCops: | |
Exclude: | |
- "db/schema.rb" | |
- ".bundle/**/*" | |
- "bin/**/*" | |
- "vendor/**/*" |
This file contains 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
class Editable { | |
constructor(text) { | |
@text = text | |
@originalText = "" | |
@status = "notEditing" | |
} | |
startEdit { | |
@status = "editing" |
This file contains 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
type Editable | |
= BeingEdited String String | |
| NotBeingEdited String |
This file contains 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
edit : Editable -> Editable | |
edit x = | |
case x of | |
BeingEdited old new -> | |
x | |
NotBeingEdited value -> | |
BeingEdited value value |
This file contains 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
save : Editable -> Editable | |
save x = | |
case x of | |
BeingEdited _ new -> | |
NotBeingEdited new | |
NotBeingEdited _ -> | |
x | |
This file contains 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
displayEditable : Editable -> HTML | |
displayEditable editable = | |
case editable of | |
BeingEdited old new -> | |
textarea [] [ text new ] | |
NotBeingEdited value -> | |
div [] [ text value ] |
This file contains 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
RSpec.configure do |config| | |
config.before(:each, type: :system) do | |
driven_by :rack_test | |
end | |
config.before(:each, type: :system, js: true) do | |
driven_by :selenium_chrome_headless | |
end | |
end |