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
| class WHBStateMachine { | |
| val whbStateMachine = StateMachine.create<WHBState, WHBEvent, WHBSideEffect> { | |
| } | |
| } |
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
| sealed class WHBState { | |
| object Work: WHBState() | |
| object Home: WHBState() | |
| object Bed: WHBState() | |
| } | |
| sealed class WHBEvent { | |
| object TakeTrain: WHBEvent() | |
| object Sleep: WHBEvent() | |
| object Wake: WHBEvent() |
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
| dependencies { | |
| implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.50" | |
| implementation "com.tinder.statemachine:statemachine:0.2.0" | |
| } |
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
| # script for truncate database tables | |
| conn = ActiveRecord::Base.connection | |
| if conn | |
| postgres = "SELECT tablename FROM pg_catalog.pg_tables WHERE schemaname='public'" | |
| tables = conn.execute(postgres).map { |r| r['tablename'] } | |
| tables.each do |t| | |
| if !["databasechangeloglock", "databasechangelog"].include?(t) | |
| conn.execute("ALTER SEQUENCE \"#{t}_id_seq\" RESTART WITH 1") |
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 'rails_helper' | |
| RSpec.describe 'Sample' do | |
| describe 'TDD Example' do | |
| it 'should return sorted array in ascending order' do | |
| input = [34, 3, 12, 2] | |
| expect(sort_array(input)).to eq [2, 3, 12, 34] | |
| end | |
| it 'should return sorted array in ascending order' do |
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 'rails_helper' | |
| RSpec.describe 'Sample', type: :request do | |
| describe 'TDD Example' do | |
| it 'should return sorted array in ascending order' do | |
| input = [34, 3, 12, 2] | |
| expect(sort_array(input)).to eq [2, 3, 12, 34] | |
| end | |
| it 'should return sorted array in ascending order' do |
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 'rails_helper' | |
| RSpec.describe 'Sample', type: :request do | |
| describe 'TDD Example' do | |
| it 'should return sorted array in ascending order' do | |
| input = [34, 3, 12, 2] | |
| expect(sort_array(input)).to eq [2, 3, 12, 34] | |
| end | |
| end | |
| end |
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 'rails_helper' | |
| RSpec.describe 'Sample' do | |
| describe 'TDD Example' do | |
| it 'should return sorted array in ascending order' do | |
| input = [34, 3, 12, 2] | |
| expect(sort_array(input)).to eq [2, 3, 12, 34] | |
| end | |
| end | |
| end |
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
| # Employee class | |
| class Employee | |
| # checkin method | |
| def check_in | |
| 'Check-in completed' | |
| end | |
| end |
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 'spec_helper' | |
| RSpec.describe Employee do | |
| # check Employee class creates an instance | |
| it 'should creates an employee object' do | |
| employee = Employee.new | |
| expect(employee).to be_kind_of(Employee) | |
| end | |
| # check Employee class invoke check_in() method |