Skip to content

Instantly share code, notes, and snippets.

@azusa
azusa / jira.env
Last active Sep 20, 2018
jiraをsystemdで起動するときのユニット設定のサンプル
View jira.env
JAVA_HOME=/usr/java/default
View gist:5f54d64141a3130db4806334153eb522
[git][* master]:$ bundle exec rake [~/pact-example/animal-service]
SPEC_OPTS='' /home/vagrant/.rbenv/versions/2.3.3/bin/ruby -S pact verify --pact-helper /home/vagrant/pact-example/animal-service/spec/service_consumers/pact_helper.rb
Reading pact at /home/vagrant/pact-example/animal-service/spec/service_consumers/pacts/zoo_app-animal_service.json
An error occurred in a `before(:suite)` hook.
Failure/Error: raise "Could not find config.ru file at #{Pact.configuration.config_ru_path} Please configure the service provider app or create a config.ru file in the root directory of the project. See https://github.com/realestate-com-au/pact/blob/master/documentation/verifying-pacts.md for more information."
RuntimeError:
Could not find config.ru file at ./config.ru Please configure the service provider app or create a config.ru file in the root directory of the project. See https://github.com/realestate-com-au/pact/blob/master/documentation/verifying-pacts.md for more infor
View gist:4b9c01028013ed187eec9a422022e342
[git][* master]:$ bundle exec rake [~/pact-example/animal-service]
SPEC_OPTS='' /home/vagrant/.rbenv/versions/2.3.3/bin/ruby -S pact verify --pact-helper /home/vagrant/pact-example/animal-service/spec/service_consumers/pact_helper.rb
Reading pact at /home/vagrant/pact-example/animal-service/spec/service_consumers/pacts/zoo_app-animal_service.json
An error occurred in a `before(:suite)` hook.
Failure/Error: raise "Could not find config.ru file at #{Pact.configuration.config_ru_path} Please configure the service provider app or create a config.ru file in the root directory of the project. See https://github.com/realestate-com-au/pact/blob/master/documentation/verifying-pacts.md for more information."
RuntimeError:
Could not find config.ru file at ./config.ru Please configure the service provider app or create a config.ru file in the root directory of the project. See https://github.com/realestate-com-au/pact/blob/master/documentation/verifying-pacts.md for more infor
@azusa
azusa / gist:d85b8a016a92365df9419cc0a4e4d059
Created Feb 26, 2017
bundle exec rspec spec/service_providers/animal_service_client_spec.rb
View gist:d85b8a016a92365df9419cc0a4e4d059
[git][* master]:$ bundle exec rspec spec/service_providers/animal_service_client_spec.rb [~/pact-example/zoo-app]
F
Failures:
1) AnimalServiceClient get_alligator returns a alligator
Got 1 failure and 1 other error:
1.1) Failure/Error: expect(subject.get_alligator).to eq(Alligator.new('Betty'))
View gist:b9442d827d1831327ec60fbaa688e136
{
"consumer": {
"name": "Zoo App"
},
"provider": {
"name": "Animal Service"
},
"interactions": [
{
"description": "a request for an alligator",
View PrivateMethodTest.java
import java.util.HashMap;
import java.util.Map;
public class PrivateMethod {
// 結果が入っているとしましょう
private int result = new HashMap<String, String>();
public void execute(){
this.result = doExecute();
View PrivateMethod.java
import java.util.HashMap;
import java.util.Map;
public class PrivateMethod {
// 結果が入っているとしましょう
private int result = new HashMap<String, String>();
public void execute(){
doExecute();
@azusa
azusa / CalculatorTest.java
Last active Dec 31, 2015
Singletonをモックするテスト
View CalculatorTest.java
package jp.fieldnotes.sample.singleton;
import org.hamcrest.CoreMatchers;
import org.hamcrest.MatcherAssert;
import org.junit.Test;
import java.math.BigDecimal;
import static org.mockito.Mockito.*;
import static org.junit.Assert.*;
@azusa
azusa / TaxSingleton.java
Last active Dec 31, 2015
Singletonの例
View TaxSingleton.java
package jp.fieldnotes.sample.singleton;
import java.math.BigDecimal;
/*:
* 消費税率を返します。実際にはデータベースのマスター等から期間に応じて適用税率を返すことになります。<br/>
* 諸外国にある小数点以下の桁を含む税率には対応しましたが、軽減税率はちょっと本題を外れるのでオミット。
*/
public class TaxSingleton {
@azusa
azusa / Calculator.java
Last active Dec 31, 2015
計算ロジック
View Calculator.java
package jp.fieldnotes.sample.singleton;
import java.math.BigDecimal;
import java.math.MathContext;
import java.math.RoundingMode;
public class Calculator {
TaxSingleton singleton = TaxSingleton.getInstance();