Last active
January 9, 2019 04:50
-
-
Save hanachin/51c843929351d585f2e74d93ad4154fa to your computer and use it in GitHub Desktop.
凸凹のRSpec平らに均すshared_contextがマジ便利 ref: https://qiita.com/hanachin_/items/fa9133c9441b63039194
This file contains hidden or 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
RSpec.describe "動画が見れる", type: :system do | |
context "ログインしている場合" do | |
before do | |
ログイン | |
end | |
context "クレジットカードを登録している場合" do | |
before do | |
クレジットカードを登録する | |
end | |
context "動画がある場合" do | |
before do | |
動画をつくる | |
end | |
it "動画が見れる" | |
end | |
context "動画がない場合" do | |
it "動画がないと表示されている" | |
end | |
end | |
context "クレジットカードを登録していない場合" do | |
it "動画が見れない" | |
end | |
end | |
context "ログインしていない場合" do | |
it "動画が見れない" | |
end | |
end |
This file contains hidden or 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
RSpec.describe "動画が見れる", type: :system do | |
shared_context "ログインしている" do | |
before do | |
ログイン | |
end | |
end | |
shared_context "クレジットカードが登録されている" do | |
before do | |
クレジットカードを登録する | |
end | |
end | |
shared_context "動画がある" do | |
before do | |
動画をつくる | |
end | |
end | |
describe "動画が見れる" do | |
include_context "ログインしている" | |
include_context "クレジットカードが登録されている" | |
include_context "動画がある" | |
it "動画が見れる" | |
end | |
context "動画がない場合" do | |
include_context "ログインしている" | |
include_context "クレジットカードが登録されている" | |
it "動画がないと表示されている" | |
end | |
context "ログインしていない場合" do | |
it "動画が見れない" | |
end | |
context "クレジットカードが登録されていない場合" do | |
include_context "ログインしている" | |
it "動画が見れない" | |
end | |
end |
This file contains hidden or 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
# language: ja | |
機能: 動画が見れる | |
シナリオ: 動画が見れる | |
前提 ログインしている | |
もし クレジットカードが登録されている | |
かつ 動画がある | |
ならば 動画が見れる | |
シナリオ: 動画がない場合、動画がないと表示される | |
前提 ログインしている | |
もし クレジットカードが登録されている | |
ならば 動画がないと表示されている | |
シナリオ: ログインしていない場合動画が見れない | |
もし ログインしていない | |
ならば 動画が見れない | |
シナリオ: クレジットカードが登録されていない場合、動画が見れない | |
前提 ログインしている | |
しかし 動画が見れない |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment