Skip to content

Instantly share code, notes, and snippets.

View sandeshbodake's full-sized avatar
🚀
All set !!!

Sandesh sandeshbodake

🚀
All set !!!
View GitHub Profile
class WHBStateMachine {
val whbStateMachine = StateMachine.create<WHBState, WHBEvent, WHBSideEffect> {
}
}
sealed class WHBState {
object Work: WHBState()
object Home: WHBState()
object Bed: WHBState()
}
sealed class WHBEvent {
object TakeTrain: WHBEvent()
object Sleep: WHBEvent()
object Wake: WHBEvent()
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.50"
implementation "com.tinder.statemachine:statemachine:0.2.0"
}
# 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")
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
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
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
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
# Employee class
class Employee
# checkin method
def check_in
'Check-in completed'
end
end
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