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
/* | |
* This script will scrape text posts from a Tumblr blog and export them as `.md` | |
* files with YAML frontmatter ready to be used in a Middleman blog. | |
* | |
* Aliases are added for the _middleman-alias_ gem so Tumblr style URLs like | |
* `/post/{id}/{slug}` will redirect to the Middleman-style URL. | |
* | |
* Although I built this for migrating to Middleman it should be pretty easy to | |
* adapt this for any similar static site generator. | |
*/ |
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
import io.mockk.Called | |
import io.mockk.every | |
import io.mockk.mockk | |
import io.mockk.verify | |
import org.junit.jupiter.api.Test | |
import java.util.function.Consumer | |
import java.util.function.Supplier | |
class NullOrUnitWasNotCalled { | |
@Test |
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
import io.mockk.mockk | |
import io.mockk.verify | |
import org.junit.jupiter.api.Test | |
class MockkUnitLambdaTest { | |
@Test | |
fun mockUnitLambda() { | |
val fn: (String) -> Unit = mockk(relaxUnitFun = true) |
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
import groovy.transform.TupleConstructor | |
import org.javers.core.JaversBuilder | |
import org.javers.core.diff.changetype.container.SetChange | |
import org.javers.core.diff.changetype.container.ValueAdded | |
import org.javers.core.metamodel.annotation.Id | |
import spock.lang.Specification | |
import static java.util.UUID.randomUUID | |
class SetPropertySpec extends Specification { |
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
package co.freeside.spock.vertx | |
import org.spockframework.runtime.extension.ExtensionAnnotation | |
import java.lang.annotation.* | |
/** | |
* Add this annotation to any specification fields that should be registered as Vert.x event bus handlers during test | |
* execution. The field will be registered on the event bus before each feature method and unregistered afterwards. If | |
* the field is `@Shared` it will be registered and unregistered at the start and end of the spec. | |
* |
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
void next() { | |
nextButton.click() | |
waitForAnimationComplete() | |
} | |
private void waitForAnimationComplete() { | |
waitFor { | |
js.exec(this.firstElement(), "return \$(arguments[0]).find(':animated').length == 0") | |
} | |
} |
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
import org.jetbrains.spek.api.dsl.describe | |
import org.jetbrains.spek.api.dsl.given | |
import org.jetbrains.spek.api.dsl.it | |
import org.jetbrains.spek.api.dsl.on | |
import org.jetbrains.spek.subject.SubjectSpek | |
import org.jetbrains.spek.subject.itBehavesLike | |
import org.junit.Assert.assertFalse | |
import org.junit.Assert.assertTrue | |
open class Thing(protected val fn: () -> Unit) { |
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
import org.jetbrains.spek.api.Spek | |
class TableSpec : Spek({ | |
describe("using a table") { | |
table { a: String, b: Int -> | |
describe("$a and $b are parameters") { | |
it("should work") { | |
assert(a is String) | |
assert(b is Int) | |
} |
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
import grails.plugin.spock.IntegrationSpec | |
import java.sql.Connection | |
import javax.sql.DataSource | |
import spock.lang.* | |
class DatabaseSchemaSpec extends IntegrationSpec { | |
@Shared def dataSource | |
@Shared List<String> tableNames |
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
import groovy.transform.* | |
@CompileStatic | |
Map<String, ?> makeMap() { | |
def map = [string: "string"] | |
map.number = 1 | |
return map | |
} | |
def map = makeMap() |
NewerOlder