Skip to content

Instantly share code, notes, and snippets.

@azusa
azusa / jira.env
Last active September 20, 2018 07:05
jiraをsystemdで起動するときのユニット設定のサンプル
JAVA_HOME=/usr/java/default
[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
[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 February 26, 2017 12:08
bundle exec rspec spec/service_providers/animal_service_client_spec.rb
[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'))
@azusa
azusa / gist:b9442d827d1831327ec60fbaa688e136
Created February 24, 2017 14:40
zoo_app-animal_service.json
{
"consumer": {
"name": "Zoo App"
},
"provider": {
"name": "Animal Service"
},
"interactions": [
{
"description": "a request for an alligator",
import java.util.HashMap;
import java.util.Map;
public class PrivateMethod {
// 結果が入っているとしましょう
private int result = new HashMap<String, String>();
public void execute(){
this.result = doExecute();
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 December 31, 2015 14:49
Singletonをモックするテスト
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 December 31, 2015 14:49
Singletonの例
package jp.fieldnotes.sample.singleton;
import java.math.BigDecimal;
/*:
* 消費税率を返します。実際にはデータベースのマスター等から期間に応じて適用税率を返すことになります。<br/>
* 諸外国にある小数点以下の桁を含む税率には対応しましたが、軽減税率はちょっと本題を外れるのでオミット。
*/
public class TaxSingleton {
@azusa
azusa / Calculator.java
Last active December 31, 2015 14:49
計算ロジック
package jp.fieldnotes.sample.singleton;
import java.math.BigDecimal;
import java.math.MathContext;
import java.math.RoundingMode;
public class Calculator {
TaxSingleton singleton = TaxSingleton.getInstance();