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
| const characters = ["Walter", "Jeffrey", "Donald"]; | |
| const maude = "Maude"; |
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
| const newCharacters = [...characters, "Maude"]; | |
| stateChanges.push(newCharacters); | |
| // stateChanges: | |
| // [ | |
| // ["Walter", "Jeffrey", "Donald"], | |
| // ["Walter", "Jeffrey", "Donald", "Maude"], | |
| // ] |
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
| characters.push("Maude"); | |
| stateChanges.push(characters); | |
| // stateChanges: | |
| // [ | |
| // ["Walter", "Jeffrey", "Donald", "Maude"], | |
| // ["Walter", "Jeffrey", "Donald", "Maude"], | |
| // ] |
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
| const stateChanges = [characters]; // start with the initial state |
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 characters = ["Walter", "Jeffrey", "Donald"]; |
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
| import { reducer, actions } from "./characters"; | |
| it("creates a character", () => { | |
| const newCharacter = { id: 42, firstName: "Jeffrey", lastName: "Lebowski" }; | |
| const action = actions.create(newCharacter); | |
| const state = reducer(undefined, action); | |
| expect(state.byId[42]).toEqual(newCharacter); | |
| expect(state.allIds).toEqual([42]); | |
| }); |
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
| // This is a Jest spec that explores some of the different ways to alter | |
| // arrays and objects without mutating state. I'm trying different approaches | |
| // available using: | |
| // | |
| // * Vanilla JS | |
| // * Immutable.js | |
| // * Lodash | |
| // * Rambda | |
| // | |
| // The motivation for this is largely to work with a Redux store. |
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 'capybara' | |
| require 'pry' | |
| Capybara.register_driver :selenium do |app| | |
| Capybara::Selenium::Driver.new(app, browser: :chrome) | |
| end | |
| Capybara.default_driver = :selenium | |
| browser = Capybara.current_session |
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('fileutils') | |
| require('tempfile') | |
| class AddRspec | |
| def self.call | |
| new.call | |
| end | |
| def call | |
| spec_filepaths.each { |spec_filepath| process_file(spec_filepath) } |
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 'benchmark/ips' | |
| class FooBar | |
| attr_accessor :foo, :bar | |
| def initialize(foo:, bar:) | |
| self.foo = foo | |
| self.bar = bar | |
| end | |
| end |