Skip to content

Instantly share code, notes, and snippets.

@Epigene Epigene/bout1.rb
Created Oct 14, 2017

Embed
What would you like to do?
#new VS all other setup strategies
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
You can’t perform that action at this time.