경로에 따라Turnip에 쓰인feature에 다른 유형을 추가하는 방법
어제@hanachin_선생님load 상수 이름을 다시 쓰는 importasgem 소개입니다.
내일은 @hanachin_씨의 Ruby로 JavaScript의 Template literals 따라하기입니다.
Turnip으로 여러 type의feature 견본 응용 프로그램 쓰기
창고는 다음과 같다.
https://github.com/hanachin/turnip_example
Turnip 테스트는 다음과 같습니다.
metadata[:type]
는:model
모델specmetadata[:type]
는:system
의 시스템 스펙트럼Turnip.type 영원히 하나
Turnip.type을 설정하면 Turnip의 example 메타데이터 type을 변경할 수 있습니다.
하지만 Turnip.type은 하나만 설정할 수 있습니다!
예를 들어 모델 스펙이나 시스템 스펙 다 Ghekin으로 쓰려고 하면 곤란해요.
Turnip의 example 그룹에 대해 다른 type을 설정하는 방법
define_derived_metadata를 사용하면 덮어쓸 수 있습니다!도시락
예를 들어
spec/models/article.feature
의 type을 모델로 변경하려면 다음과 같은 file_path
옵션에서feature와 일치하는 정규 표현식을 지정하고 덮어쓰십시오 metadata[:type]
.RSpec.configure do |config|
config.define_derived_metadata(:file_path => %r{/spec/models/.*.feature}) do |metadata|
metadata[:type] = :model
end
end
모델 이외의feature가 시스템 스펙으로 작동하고자 하는 경우 다음과 같이 기본Turnip.type
을:system
,spec/models
이하의feature의 type을:model
으로 설정하면 된다.Turnip.type = :system
RSpec.configure do |config|
config.define_derived_metadata(:file_path => %r{/spec/models/.*.feature}) do |metadata|
metadata[:type] = :model
end
end
총결산
Turnip.type
를 사용하면 Turnip의 example groupo typeTurnip.type
하나만 설정 가능사용
define_derived_metadata
경로에 따라 메타데이터를 다시 쓸 수 있음Reference
이 문제에 관하여(경로에 따라Turnip에 쓰인feature에 다른 유형을 추가하는 방법), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/hanachin_/items/e3ad66bbff4da97efafd텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)