Skip to content

Instantly share code, notes, and snippets.

import Quick
import Nimble
@testable import TestModule
class ModuleTests: QuickSpec {
var sut: TestClass?
describe("The TestClass") {
context("in a specific state") {
it("does what ever we test for") {
// the actual test
protocol UserDefaultsProtocol {
func object(forKey defaultName: String) -> Any?
}
extension UserDefaults: UserDefaultsProtocol {}
class Demo {
var userDefaults: UserDefaultsProtocol = UserDefaults.standard
}
#!/bin/bash
# =========== Install brew ==========
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew update
# ========= Install Apps ==========
brew tap Homebrew/bundle
brew bundle
#import <kiwi.h>
#import <SomeClass.h>
SPEC_BEGIN(SomeClass)
describe(@"The SomeClass", ^{
__block Someclass *sut;
beforeAll(^{
//Nothing to do here
});
+ (void)load {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
NSError *error;
BOOL result = [[self class] jr_swizzleMethod:@selector(text) withMethod:@selector(swizzleName) error:&error];
if (!result || error) {
NSLog(@"Can't swizzle methods - %@", [error description]);
}
});
}
#!/bin/bash
#
# Automatically adds branch name to every commit message.
#
value=`cat $1`
type="$( cut -d ':' -f 1 <<< "$value" )"
contains=$(echo ${typeList[@]} | grep -o type | wc -w)
if [ contains -eq 0 ]; then
return 1
fi
#!/bin/bash
LINT=$(which swiftlint)
if [[ -e "${LINT}" ]]; then
echo "SwiftLint Start..."
else
echo "SwiftLint does not exist, download from https://github.com/realm/SwiftLint"
exit 1
fi
$LINT lint --quiet
# =========== Setup Git Hooks ==========
ln -s ./Hooks/prepare-commit-msg ../.git/hooks/prepare-commit-msg
ln -s ./Hooks/pre-commit ../.git/hooks/pre-commit
chmod +x ./Hooks/*
fastlane_version "2.49.0"
default_platform :ios
platform :ios do
before_all do
# ENV["SLACK_URL"] = "https://hooks.slack.com/services/..."
end
# Created by https://www.gitignore.io/api/xcode
### Xcode ###
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
## Build generated
build/