Created
October 14, 2017 16:45
-
-
Save Epigene/81249c5b6cac5d9d3e1aa72691ab704c to your computer and use it in GitHub Desktop.
#new VS all other setup strategies
This file contains 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
describe "#new VS all others when testing Book#vampire_title?" do | |
subject { book.vampire_title? } | |
bout1_number_of = 200 | |
context "when setting up with #new" do | |
bout1_number_of.times do | |
let(:book) { Book.new(title: "Vampire Literature, a Historical Perspective") } | |
it { is_expected.to eq(true) } | |
end | |
end | |
context "when setting up with #instance_double" do | |
let(:book) { instance_double("Book", vampire_title?: true) } | |
bout1_number_of.times do | |
it { is_expected.to eq(true) } | |
end | |
end | |
context "when setting up with FactoryGirl.build_stubbed" do | |
let(:book) { build_stubbed(:book, title: "Vampire Literature, a Historical Perspective") } | |
bout1_number_of.times do | |
it { is_expected.to eq(true) } | |
end | |
end | |
context "when setting up with FactoryGirl.build" do | |
let(:book) { build(:book, title: "Vampire Literature, a Historical Perspective") } | |
bout1_number_of.times do | |
it { is_expected.to eq(true) } | |
end | |
end | |
context "when setting up with FactoryGirl.create" do | |
let(:book) { create(:book, title: "Vampire Literature, a Historical Perspective") } | |
bout1_number_of.times do | |
it { is_expected.to eq(true) } | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment