Upgrade to Pro — share decks privately, control downloads, hide ads and more …

RSpec: The Bad Parts

Caleb Hearth
November 29, 2022

RSpec: The Bad Parts

RSpec is good, but it’s even better with less of it. Looking at a realistic example spec, we’ll learn why parts of RSpec like let, subject, shared_examples, behaves like, and before can make your tests hard to read, difficult to navigate, and more complex. We'll discuss when DRY is not worth the price and how we can avoid repetition without using RSpec's built-in DSL methods. In the end, we'll look at what's left. RSpec: The Good Parts.

Caleb Hearth

November 29, 2022
Tweet

More Decks by Caleb Hearth

Other Decks in Programming

Transcript

  1. RSpec: The Bad Parts Caleb Hearth

  2. Caleb Hearth

  3. Caleb Hearth

  4. Caleb Hearth 🛤

  5. Caleb Hearth

  6. Caleb Hearth Test Double calebhearth.com

  7. Caleb Hearth calebhearth.com Test Double dice.camp/@caleb

  8. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double dice.camp/@caleb Caleb Hearth calebhearth.com

    Test Double RSpec: The Bad Parts
  9. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double let(:player) { Dwarf.new }

    player Dwarf.new }
  10. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double def player = @player

    ||= Dwarf.new
  11. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double def player @player ||=

    Dwarf.new end
  12. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double let(:player) { Dwarf.new }

  13. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double let(:player) { Dwarf.new }

    let(:party) { [player] }
  14. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double let(:player) { Dwarf.new }

    let(:party) { [player] } context "An elf" do let(:player) { Elf.new } end
  15. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double let(:player) { Dwarf.new }

    let(:party) { [player] } subject { player }
  16. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double subject { player }

  17. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double subject(:player) { player }

    subject { player }
  18. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double let(:subject) { player }

    subject
  19. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double before do player.quest_for_the_mcguffin end

  20. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double before do player.quest_for_the_mcguffin end

  21. None
  22. None
  23. None
  24. None
  25. None
  26. None
  27. None
  28. None
  29. General Fixture 🫡

  30. General Fixture 🫡

  31. General Fixture 🫡

  32. None
  33. None
  34. None
  35. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double avoid(:let)

  36. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double avoid(:let)

  37. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double :let) avoid( )

  38. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double avoid(:subject) avoid( )

  39. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double let(:book) { Book.new }

  40. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double @book = Book.new

  41. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double def book @book ||=

    Book.new end
  42. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double it "has 10 pages"

    expect(Book.new.page_count) .to eq 10 end Book.new
  43. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double it "has 10 pages"

    expect(Book.new.page_count) .to eq 10 end Book.new
  44. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double it "has 10 pages"

    expect(Book.new.page_count) .to eq 10 end Book.new
  45. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double 🏜

  46. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double

  47. - The Pragmatic Programmer Every piece of knowledge must have

    a single, unambiguous, authoritative representation within a system “
  48. - The Pragmatic Programmer Every piece of knowledge must have

    a single, unambiguous, authoritative representation within a system “
  49. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double 🏜

  50. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double subject { described_class.new }

  51. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double subject { Book.new }

    Book.new
  52. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double Book.new

  53. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double Book.new

  54. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double

  55. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double expect(order).not_to be_sent

  56. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double expect(order.sent?).to eq(false)

  57. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double

  58. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double 🏜

  59. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double 🌊

  60. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double 🌊 🌊

  61. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double 🌊🌊 🌊

  62. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double 🌊

  63. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double 👃

  64. Caleb Hearth dice.club/@caleb calebhearth.com Test Double describe '#mute!' do subject

    { account.mute!(target_account, notifications: arg_notifications) } end context 'Mute does not exist yet' do context 'arg :notifications is nil' do let(:arg_notifications) { nil } it 'creates Mute, and returns Mute' do expect do expect(subject).to be_kind_of Mute end.to change { account.mute_relationships.count }.by 1 end end context 'arg :notifications is false' do let(:arg_notifications) { false } it 'creates Mute, and returns Mute' do expect do expect(subject).to be_kind_of Mute end.to change { account.mute_relationships.count }.by 1 end end context 'arg :notifications is true' do let(:arg_notifications) { true } it 'creates Mute, and returns Mute' do expect do expect(subject).to be_kind_of Mute end.to change { account.mute_relationships.count }.by 1 end end end context 'Mute already exists' do before do account.mute_relationships << mute end let(:mute) do Fabricate(:mute, account: account, target_account: target_account, hide_notifications: hide_notifications) end context 'mute.hide_notifications is true' do let(:hide_notifications) { true } context 'arg :notifications is nil' do let(:arg_notifications) { nil } it 'returns Mute without updating mute.hide_notifications' do expect do expect(subject).to be_kind_of Mute end.not_to change { mute.reload.hide_notifications? }.from(true) end end context 'arg :notifications is false' do let(:arg_notifications) { false } it 'returns Mute, and updates mute.hide_notifications false' do expect do expect(subject).to be_kind_of Mute end.to change { mute.reload.hide_notifications? }.from(true).to(false) end end context 'arg :notifications is true' do let(:arg_notifications) { true } it 'returns Mute without updating mute.hide_notifications' do expect do expect(subject).to be_kind_of Mute end.not_to change { mute.reload.hide_notifications? }.from(true) end end end context 'mute.hide_notifications is false' do let(:hide_notifications) { false } context 'arg :notifications is nil' do let(:arg_notifications) { nil } it 'returns Mute, and updates mute.hide_notifications true' do expect do expect(subject).to be_kind_of Mute end.to change { mute.reload.hide_notifications? }.from(false).to(true) end end context 'arg :notifications is false' do let(:arg_notifications) { false } it 'returns Mute without updating mute.hide_notifications' do expect do expect(subject).to be_kind_of Mute end.not_to change { mute.reload.hide_notifications? }.from(false) end end context 'arg :notifications is true' do let(:arg_notifications) { true } it 'returns Mute, and updates mute.hide_notifications true' do expect do expect(subject).to be_kind_of Mute end.to change { mute.reload.hide_notifications? }.from(false).to(true) end end end end
  65. Caleb Hearth dice.club/@caleb calebhearth.com Test Double describe '#mute!' do subject

    { account.mute!(target_account, notifications: arg_notifications) } end context 'Mute does not exist yet' do context 'arg :notifications is nil' do let(:arg_notifications) { nil } it 'creates Mute, and returns Mute' do expect do expect(subject).to be_kind_of Mute end.to change { account.mute_relationships.count }.by 1 end end context 'arg :notifications is false' do let(:arg_notifications) { false } it 'creates Mute, and returns Mute' do expect do expect(subject).to be_kind_of Mute end.to change { account.mute_relationships.count }.by 1 end end context 'arg :notifications is true' do let(:arg_notifications) { true } it 'creates Mute, and returns Mute' do expect do expect(subject).to be_kind_of Mute end.to change { account.mute_relationships.count }.by 1 end end end context 'Mute already exists' do before do account.mute_relationships << mute end let(:mute) do Fabricate(:mute, account: account, target_account: target_account, hide_notifications: hide_notifications) end context 'mute.hide_notifications is true' do let(:hide_notifications) { true } context 'arg :notifications is nil' do let(:arg_notifications) { nil } it 'returns Mute without updating mute.hide_notifications' do expect do expect(subject).to be_kind_of Mute end.not_to change { mute.reload.hide_notifications? }.from(true) end end context 'arg :notifications is false' do let(:arg_notifications) { false } it 'returns Mute, and updates mute.hide_notifications false' do expect do expect(subject).to be_kind_of Mute end.to change { mute.reload.hide_notifications? }.from(true).to(false) end end context 'arg :notifications is true' do let(:arg_notifications) { true } it 'returns Mute without updating mute.hide_notifications' do expect do expect(subject).to be_kind_of Mute end.not_to change { mute.reload.hide_notifications? }.from(true) end end end context 'mute.hide_notifications is false' do let(:hide_notifications) { false } context 'arg :notifications is nil' do let(:arg_notifications) { nil } it 'returns Mute, and updates mute.hide_notifications true' do expect do expect(subject).to be_kind_of Mute end.to change { mute.reload.hide_notifications? }.from(false).to(true) end end context 'arg :notifications is false' do let(:arg_notifications) { false } it 'returns Mute without updating mute.hide_notifications' do expect do expect(subject).to be_kind_of Mute end.not_to change { mute.reload.hide_notifications? }.from(false) end end context 'arg :notifications is true' do let(:arg_notifications) { true } it 'returns Mute, and updates mute.hide_notifications true' do expect do expect(subject).to be_kind_of Mute end.to change { mute.reload.hide_notifications? }.from(false).to(true) end end end end spec/models/concerns/account_interactions_spec.rb
  66. Caleb Hearth dice.club/@caleb calebhearth.com Test Double describe '#mute!' do subject

    { account.mute!(target_account, notifications: arg_notifications) } end context 'Mute does not exist yet' do context 'arg :notifications is nil' do let(:arg_notifications) { nil } it 'creates Mute, and returns Mute' do expect do expect(subject).to be_kind_of Mute end.to change { account.mute_relationships.count }.by 1 end end context 'arg :notifications is false' do let(:arg_notifications) { false } it 'creates Mute, and returns Mute' do expect do expect(subject).to be_kind_of Mute end.to change { account.mute_relationships.count }.by 1 end end context 'arg :notifications is true' do let(:arg_notifications) { true } it 'creates Mute, and returns Mute' do expect do expect(subject).to be_kind_of Mute end.to change { account.mute_relationships.count }.by 1 end end end context 'Mute already exists' do before do account.mute_relationships << mute end let(:mute) do Fabricate(:mute, account: account, target_account: target_account, hide_notifications: hide_notifications) end context 'mute.hide_notifications is true' do let(:hide_notifications) { true } context 'arg :notifications is nil' do let(:arg_notifications) { nil } it 'returns Mute without updating mute.hide_notifications' do expect do expect(subject).to be_kind_of Mute end.not_to change { mute.reload.hide_notifications? }.from(true) end end context 'arg :notifications is false' do let(:arg_notifications) { false } it 'returns Mute, and updates mute.hide_notifications false' do expect do expect(subject).to be_kind_of Mute end.to change { mute.reload.hide_notifications? }.from(true).to(false) end end context 'arg :notifications is true' do let(:arg_notifications) { true } it 'returns Mute without updating mute.hide_notifications' do expect do expect(subject).to be_kind_of Mute end.not_to change { mute.reload.hide_notifications? }.from(true) end end end context 'mute.hide_notifications is false' do let(:hide_notifications) { false } context 'arg :notifications is nil' do let(:arg_notifications) { nil } it 'returns Mute, and updates mute.hide_notifications true' do expect do expect(subject).to be_kind_of Mute end.to change { mute.reload.hide_notifications? }.from(false).to(true) end end context 'arg :notifications is false' do let(:arg_notifications) { false } it 'returns Mute without updating mute.hide_notifications' do expect do expect(subject).to be_kind_of Mute end.not_to change { mute.reload.hide_notifications? }.from(false) end end context 'arg :notifications is true' do let(:arg_notifications) { true } it 'returns Mute, and updates mute.hide_notifications true' do expect do expect(subject).to be_kind_of Mute end.to change { mute.reload.hide_notifications? }.from(false).to(true) end end end end spec/models/concerns/account_interactions_spec.rb
  67. Caleb Hearth dice.club/@caleb calebhearth.com Test Double describe '#mute!' do subject

    { account.mute!(target_account, notifications: arg_notifications) } end context 'Mute does not exist yet' do context 'arg :notifications is nil' do let(:arg_notifications) { nil } it 'creates Mute, and returns Mute' do expect do expect(subject).to be_kind_of Mute end.to change { account.mute_relationships.count }.by 1 end end context 'arg :notifications is false' do let(:arg_notifications) { false } it 'creates Mute, and returns Mute' do expect do expect(subject).to be_kind_of Mute end.to change { account.mute_relationships.count }.by 1 end end context 'arg :notifications is true' do let(:arg_notifications) { true } it 'creates Mute, and returns Mute' do expect do expect(subject).to be_kind_of Mute end.to change { account.mute_relationships.count }.by 1 end end end context 'Mute already exists' do before do account.mute_relationships << mute end let(:mute) do Fabricate(:mute, account: account, target_account: target_account, hide_notifications: hide_notifications) end context 'mute.hide_notifications is true' do let(:hide_notifications) { true } context 'arg :notifications is nil' do let(:arg_notifications) { nil } it 'returns Mute without updating mute.hide_notifications' do expect do expect(subject).to be_kind_of Mute end.not_to change { mute.reload.hide_notifications? }.from(true) end end context 'arg :notifications is false' do let(:arg_notifications) { false } it 'returns Mute, and updates mute.hide_notifications false' do expect do expect(subject).to be_kind_of Mute end.to change { mute.reload.hide_notifications? }.from(true).to(false) end end context 'arg :notifications is true' do let(:arg_notifications) { true } it 'returns Mute without updating mute.hide_notifications' do expect do expect(subject).to be_kind_of Mute end.not_to change { mute.reload.hide_notifications? }.from(true) end end end context 'mute.hide_notifications is false' do let(:hide_notifications) { false } context 'arg :notifications is nil' do let(:arg_notifications) { nil } it 'returns Mute, and updates mute.hide_notifications true' do expect do expect(subject).to be_kind_of Mute end.to change { mute.reload.hide_notifications? }.from(false).to(true) end end context 'arg :notifications is false' do let(:arg_notifications) { false } it 'returns Mute without updating mute.hide_notifications' do expect do expect(subject).to be_kind_of Mute end.not_to change { mute.reload.hide_notifications? }.from(false) end end context 'arg :notifications is true' do let(:arg_notifications) { true } it 'returns Mute, and updates mute.hide_notifications true' do expect do expect(subject).to be_kind_of Mute end.to change { mute.reload.hide_notifications? }.from(false).to(true) end end end end
  68. Caleb Hearth dice.club/@caleb calebhearth.com Test Double describe '#mute!' do end

    context 'Mute does not exist yet' do context 'arg :notifications is nil' do let(:arg_notifications) { nil } it 'creates Mute, and returns Mute' do expect do mute = account.mute!(target_account, notifications: arg_notifications) expect(mute).to be_kind_of Mute end.to change { account.mute_relationships.count }.by 1 end end context 'arg :notifications is false' do let(:arg_notifications) { false } it 'creates Mute, and returns Mute' do expect do mute = account.mute!(target_account, notifications: arg_notifications) expect(mute).to be_kind_of Mute end.to change { account.mute_relationships.count }.by 1 end end context 'arg :notifications is true' do let(:arg_notifications) { true } it 'creates Mute, and returns Mute' do expect do mute = account.mute!(target_account, notifications: arg_notifications) expect(mute).to be_kind_of Mute end.to change { account.mute_relationships.count }.by 1 end end end context 'Mute already exists' do before do account.mute_relationships << mute end let(:mute) do Fabricate(:mute, account: account, target_account: target_account, hide_notifications: hide_notifications) end context 'mute.hide_notifications is true' do let(:hide_notifications) { true } context 'arg :notifications is nil' do let(:arg_notifications) { nil } it 'returns Mute without updating mute.hide_notifications' do expect do mute = account.mute!(target_account, notifications: arg_notifications) expect(mute).to be_kind_of Mute end.not_to change { mute.reload.hide_notifications? }.from(true) end end context 'arg :notifications is false' do let(:arg_notifications) { false } it 'returns Mute, and updates mute.hide_notifications false' do expect do mute = account.mute!(target_account, notifications: arg_notifications) expect(mute).to be_kind_of Mute end.to change { mute.reload.hide_notifications? }.from(true).to(false) end end context 'arg :notifications is true' do let(:arg_notifications) { true } it 'returns Mute without updating mute.hide_notifications' do expect do mute = account.mute!(target_account, notifications: arg_notifications) expect(mute).to be_kind_of Mute end.not_to change { mute.reload.hide_notifications? }.from(true) end end end context 'mute.hide_notifications is false' do let(:hide_notifications) { false } context 'arg :notifications is nil' do let(:arg_notifications) { nil } it 'returns Mute, and updates mute.hide_notifications true' do expect do mute = account.mute!(target_account, notifications: arg_notifications) expect(mute).to be_kind_of Mute end.to change { mute.reload.hide_notifications? }.from(false).to(true) end end context 'arg :notifications is false' do let(:arg_notifications) { false } it 'returns Mute without updating mute.hide_notifications' do expect do mute = account.mute!(target_account, notifications: arg_notifications) expect(mute).to be_kind_of Mute end.not_to change { mute.reload.hide_notifications? }.from(false) end end context 'arg :notifications is true' do let(:arg_notifications) { true } it 'returns Mute, and updates mute.hide_notifications true' do expect do mute = account.mute!(target_account, notifications: arg_notifications) expect(mute).to be_kind_of Mute end.to change { mute.reload.hide_notifications? }.from(false).to(true) end end end end
  69. Caleb Hearth dice.club/@caleb calebhearth.com Test Double describe '#mute!' do end

    context 'Mute already exists' do before do account.mute_relationships << mute end let(:mute) do Fabricate(:mute, account: account, target_account: target_account, hide_notifications: hide_notifications) end context 'mute.hide_notifications is true' do let(:hide_notifications) { true } context 'arg :notifications is nil' do let(:arg_notifications) { nil } it 'returns Mute without updating mute.hide_notifications' do expect do mute = account.mute!(target_account, notifications: arg_notifications) expect(mute).to be_kind_of Mute end.not_to change { mute.reload.hide_notifications? }.from(true) end end context 'arg :notifications is false' do let(:arg_notifications) { false } it 'returns Mute, and updates mute.hide_notifications false' do expect do mute = account.mute!(target_account, notifications: arg_notifications) expect(mute).to be_kind_of Mute end.to change { mute.reload.hide_notifications? }.from(true).to(false) end end context 'arg :notifications is true' do let(:arg_notifications) { true } it 'returns Mute without updating mute.hide_notifications' do expect do mute = account.mute!(target_account, notifications: arg_notifications) expect(mute).to be_kind_of Mute end.not_to change { mute.reload.hide_notifications? }.from(true) end end end
  70. Caleb Hearth dice.club/@caleb calebhearth.com Test Double describe '#mute!' do end

    context 'arg :notifications is false' do let(:arg_notifications) { false } it 'returns Mute, and updates mute.hide_notifications false' do expect do mute = account.mute!(target_account, notifications: arg_notifications) expect(mute).to be_kind_of Mute end.to change { mute.reload.hide_notifications? }.from(true).to(false) end end
  71. Caleb Hearth dice.club/@caleb calebhearth.com Test Double describe '#mute!' do end

    context 'arg :notifications is false' do let(:arg_notifications) { false } it 'returns Mute, and updates mute.hide_notifications false' do expect do mute = account.mute!(target_account, notifications: arg_notifications) expect(mute).to be_kind_of Mute end.to change { mute.reload.hide_notifications? }.from(true).to(false) end end
  72. Caleb Hearth dice.club/@caleb calebhearth.com Test Double describe '#mute!' do end

    context 'arg :notifications is false' do let(:arg_notifications) { false } it 'returns Mute, and updates mute.hide_notifications false' do expect do mute = account.mute!(target_account, notifications: arg_notifications) expect(mute).to be_kind_of Mute end.to change { mute.reload.hide_notifications? }.from(true).to(false) end end
  73. Caleb Hearth dice.club/@caleb calebhearth.com Test Double describe '#mute!' do end

    context 'arg :notifications is false' do let(:arg_notifications) { false } it 'returns Mute, and updates mute.hide_notifications false' do expect do account.mute!(target_account, notifications: arg_notifications) end.to change { mute.reload.hide_notifications? }.from(true).to(false) end end
  74. Caleb Hearth dice.club/@caleb calebhearth.com Test Double describe '#mute!' do end

    context 'Mute does not exist yet' do context 'arg :notifications is nil' do let(:arg_notifications) { nil } it 'returns a Mute' do expect(account.mute!(target_account, notifications: arg_notifications)) .to be_kind_of Mute end it 'creates a Mute' do expect do account.mute!(target_account, notifications: arg_notifications) end.to change { account.mute_relationships.count }.by 1 end end context 'arg :notifications is false' do let(:arg_notifications) { false } it 'creates a Mute' do expect do account.mute!(target_account, notifications: arg_notifications) end.to change { account.mute_relationships.count }.by 1 end end context 'arg :notifications is true' do let(:arg_notifications) { true } it 'creates a Mute' do expect do account.mute!(target_account, notifications: arg_notifications) end.to change { account.mute_relationships.count }.by 1 end end end context 'Mute already exists' do before do account.mute_relationships << mute end let(:mute) do Fabricate(:mute, account: account, target_account: target_account, hide_notifications: hide_notifications) end context 'mute.hide_notifications is true' do let(:hide_notifications) { true } context 'arg :notifications is nil' do let(:arg_notifications) { nil } it 'does not update mute.hide_notifications' do expect do account.mute!(target_account, notifications: arg_notifications) end.not_to change { mute.reload.hide_notifications? }.from(true) end end context 'arg :notifications is false' do let(:arg_notifications) { false } it 'updates mute.hide_notifications false' do expect do account.mute!(target_account, notifications: arg_notifications) end.to change { mute.reload.hide_notifications? }.from(true).to(false) end end context 'arg :notifications is true' do let(:arg_notifications) { true } it 'does not update mute.hide_notifications' do expect do account.mute!(target_account, notifications: arg_notifications) end.not_to change { mute.reload.hide_notifications? }.from(true) end end end context 'mute.hide_notifications is false' do let(:hide_notifications) { false } context 'arg :notifications is nil' do let(:arg_notifications) { nil } it 'updates mute.hide_notifications true' do expect do account.mute!(target_account, notifications: arg_notifications) end.to change { mute.reload.hide_notifications? }.from(false).to(true) end end context 'arg :notifications is false' do let(:arg_notifications) { false } it 'does not update mute.hide_notifications' do expect do account.mute!(target_account, notifications: arg_notifications) end.not_to change { mute.reload.hide_notifications? }.from(false) end end context 'arg :notifications is true' do let(:arg_notifications) { true } it 'updates mute.hide_notifications true' do expect do account.mute!(target_account, notifications: arg_notifications) end.to change { mute.reload.hide_notifications? }.from(false).to(true) end end end end
  75. Caleb Hearth dice.club/@caleb calebhearth.com Test Double describe '#mute!' do end

    context 'Mute does not exist yet' do context 'arg :notifications is nil' do let(:arg_notifications) { nil } it 'returns a Mute' do expect(account.mute!(target_account, notifications: arg_notifications)) .to be_kind_of Mute end it 'creates a Mute' do expect do account.mute!(target_account, notifications: arg_notifications) end.to change { account.mute_relationships.count }.by 1 end end context 'arg :notifications is false' do let(:arg_notifications) { false } it 'creates a Mute' do expect do account.mute!(target_account, notifications: arg_notifications) end.to change { account.mute_relationships.count }.by 1 end end context 'arg :notifications is true' do let(:arg_notifications) { true } it 'creates a Mute' do expect do account.mute!(target_account, notifications: arg_notifications) end.to change { account.mute_relationships.count }.by 1 end end end context 'Mute already exists' do before do account.mute_relationships << mute end let(:mute) do Fabricate(:mute, account: account, target_account: target_account, hide_notifications: true) end context 'mute.hide_notifications is true' do let(:hide_notifications) { true } context 'arg :notifications is nil' do let(:arg_notifications) { nil } it 'does not update mute.hide_notifications' do expect do account.mute!(target_account, notifications: arg_notifications) end.not_to change { mute.reload.hide_notifications? }.from(true) end end context 'arg :notifications is false' do let(:arg_notifications) { false } it 'updates mute.hide_notifications false' do expect do account.mute!(target_account, notifications: arg_notifications) end.to change { mute.reload.hide_notifications? }.from(true).to(false) end end context 'arg :notifications is true' do let(:arg_notifications) { true } it 'does not update mute.hide_notifications' do expect do account.mute!(target_account, notifications: arg_notifications) end.not_to change { mute.reload.hide_notifications? }.from(true) end end end context 'mute.hide_notifications is false' do let(:hide_notifications) { false } context 'arg :notifications is nil' do let(:arg_notifications) { nil } it 'updates mute.hide_notifications true' do expect do account.mute!(target_account, notifications: arg_notifications) end.to change { mute.reload.hide_notifications? }.from(false).to(true) end end context 'arg :notifications is false' do let(:arg_notifications) { false } it 'does not update mute.hide_notifications' do expect do account.mute!(target_account, notifications: arg_notifications) end.not_to change { mute.reload.hide_notifications? }.from(false) end end context 'arg :notifications is true' do let(:arg_notifications) { true } it 'updates mute.hide_notifications true' do expect do account.mute!(target_account, notifications: arg_notifications) end.to change { mute.reload.hide_notifications? }.from(false).to(true) end end end end
  76. Caleb Hearth dice.club/@caleb calebhearth.com Test Double describe '#mute!' do end

    context 'Mute does not exist yet' do context 'arg :notifications is nil' do it 'returns a Mute' do expect(account.mute!(target_account, notifications: nil)) .to be_kind_of Mute end it 'creates a Mute' do expect do account.mute!(target_account, notifications: nil) end.to change { account.mute_relationships.count }.by 1 end end context 'arg :notifications is false' do it 'creates a Mute' do expect do account.mute!(target_account, notifications: false) end.to change { account.mute_relationships.count }.by 1 end end context 'arg :notifications is true' do it 'creates a Mute' do expect do account.mute!(target_account, notifications: true) end.to change { account.mute_relationships.count }.by 1 end end end context 'Mute already exists' do before do account.mute_relationships << mute end let(:mute) do Fabricate(:mute, account: account, target_account: target_account, hide_notifications: true) end context 'mute.hide_notifications is true' do context 'arg :notifications is nil' do it 'does not update mute.hide_notifications' do expect do account.mute!(target_account, notifications: nil) end.not_to change { mute.reload.hide_notifications? }.from(true) end end context 'arg :notifications is false' do it 'updates mute.hide_notifications false' do expect do account.mute!(target_account, notifications: false) end.to change { mute.reload.hide_notifications? }.from(true).to(false) end end context 'arg :notifications is true' do it 'does not update mute.hide_notifications' do expect do account.mute!(target_account, notifications: true) end.not_to change { mute.reload.hide_notifications? }.from(true) end end end context 'mute.hide_notifications is false' do context 'arg :notifications is nil' do it 'updates mute.hide_notifications true' do expect do account.mute!(target_account, notifications: nil) end.to change { mute.reload.hide_notifications? }.from(false).to(true) end end context 'arg :notifications is false' do it 'does not update mute.hide_notifications' do expect do account.mute!(target_account, notifications: false) end.not_to change { mute.reload.hide_notifications? }.from(false) end end context 'arg :notifications is true' do it 'updates mute.hide_notifications true' do expect do account.mute!(target_account, notifications: true) end.to change { mute.reload.hide_notifications? }.from(false).to(true) end end end end
  77. Caleb Hearth dice.club/@caleb calebhearth.com Test Double describe '#mute!' do end

    context 'Mute does not exist yet' do context 'arg :notifications is nil' do it 'returns a Mute' do expect(account.mute!(target_account, notifications: nil)) .to be_kind_of Mute end it 'creates a Mute' do expect do account.mute!(target_account, notifications: nil) end.to change { account.mute_relationships.count }.by 1 end end context 'arg :notifications is false' do it 'creates a Mute' do expect do account.mute!(target_account, notifications: false) end.to change { account.mute_relationships.count }.by 1 end end context 'arg :notifications is true' do it 'creates a Mute' do expect do account.mute!(target_account, notifications: true) end.to change { account.mute_relationships.count }.by 1 end end end context 'Mute already exists' do before do account.mute_relationships << mute end let(:mute) do Fabricate(:mute, account: account, target_account: target_account, hide_notifications: true) end context 'mute.hide_notifications is true' do context 'arg :notifications is nil' do it 'does not update mute.hide_notifications' do expect do account.mute!(target_account, notifications: nil) end.not_to change { mute.reload.hide_notifications? }.from(true) end end context 'arg :notifications is false' do it 'updates mute.hide_notifications false' do expect do account.mute!(target_account, notifications: false) end.to change { mute.reload.hide_notifications? }.from(true).to(false) end end context 'arg :notifications is true' do it 'does not update mute.hide_notifications' do expect do account.mute!(target_account, notifications: true) end.not_to change { mute.reload.hide_notifications? }.from(true) end end end context 'mute.hide_notifications is false' do context 'arg :notifications is nil' do it 'updates mute.hide_notifications true' do expect do account.mute!(target_account, notifications: nil) end.to change { mute.reload.hide_notifications? }.from(false).to(true) end end context 'arg :notifications is false' do it 'does not update mute.hide_notifications' do expect do account.mute!(target_account, notifications: false) end.not_to change { mute.reload.hide_notifications? }.from(false) end end context 'arg :notifications is true' do it 'updates mute.hide_notifications true' do expect do account.mute!(target_account, notifications: true) end.to change { mute.reload.hide_notifications? }.from(false).to(true) end end end end
  78. Caleb Hearth dice.club/@caleb calebhearth.com Test Double describe '#mute!' do end

    context 'Mute does not exist yet' do it 'returns a Mute' do expect(account.mute!(target_account)) .to be_kind_of Mute end it 'creates a Mute when :notifications is nil' do expect do account.mute!(target_account, notifications: nil) end.to change { account.mute_relationships.count }.by 1 end it 'creates a Mute when :notifications is false' do expect do account.mute!(target_account, notifications: false) end.to change { account.mute_relationships.count }.by 1 end it 'creates a Mute when :notifications is true' do expect do account.mute!(target_account, notifications: true) end.to change { account.mute_relationships.count }.by 1 end end context 'Mute already exists' do before do account.mute_relationships << mute end let(:mute) do Fabricate(:mute, account: account, target_account: target_account, hide_notifications: true) end context 'mute.hide_notifications is true' do it 'does not update mute.hide_notifications when :notifications is nil' do expect do account.mute!(target_account, notifications: nil) end.not_to change { mute.reload.hide_notifications? }.from(true) end it 'updates mute.hide_notifications false when :notifications is false' do expect do account.mute!(target_account, notifications: false) end.to change { mute.reload.hide_notifications? }.from(true).to(false) end it 'doesnt update mute.hide_notifications false when :notifications=true' do expect do account.mute!(target_account, notifications: true) end.not_to change { mute.reload.hide_notifications? }.from(true) end end context 'mute.hide_notifications is false' do it 'updates mute.hide_notifications true when arg :notifications is nil' do expect do account.mute!(target_account, notifications: nil) end.to change { mute.reload.hide_notifications? }.from(false).to(true) end it 'doesnt update mute.hide_notifications when arg :notifications is false' do expect do account.mute!(target_account, notifications: false) end.not_to change { mute.reload.hide_notifications? }.from(false) end it 'updates mute.hide_notifications true when arg :notifications is true' do expect do account.mute!(target_account, notifications: true) end.to change { mute.reload.hide_notifications? }.from(false).to(true) end end end
  79. Caleb Hearth dice.club/@caleb calebhearth.com Test Double describe '#mute!' do end

    context 'Mute does not exist yet' do it 'returns a Mute' do expect(account.mute!(target_account)) .to be_kind_of Mute end it 'creates a Mute when :notifications is nil' do expect do account.mute!(target_account, notifications: nil) end.to change { account.mute_relationships.count }.by 1 end it 'creates a Mute when :notifications is false' do expect do account.mute!(target_account, notifications: false) end.to change { account.mute_relationships.count }.by 1 end it 'creates a Mute when :notifications is true' do expect do account.mute!(target_account, notifications: true) end.to change { account.mute_relationships.count }.by 1 end end context 'Mute already exists' do before do account.mute_relationships << mute end let(:mute) do Fabricate(:mute, account: account, target_account: target_account, hide_notifications: true) end context 'mute.hide_notifications is true' do it 'does not update mute.hide_notifications when :notifications is nil' do expect do account.mute!(target_account, notifications: nil) end.not_to change { mute.reload.hide_notifications? }.from(true) end it 'updates mute.hide_notifications false when :notifications is false' do expect do account.mute!(target_account, notifications: false) end.to change { mute.reload.hide_notifications? }.from(true).to(false) end it 'doesnt update mute.hide_notifications false when :notifications=true' do expect do account.mute!(target_account, notifications: true) end.not_to change { mute.reload.hide_notifications? }.from(true) end end context 'mute.hide_notifications is false' do it 'updates mute.hide_notifications true when arg :notifications is nil' do expect do account.mute!(target_account, notifications: nil) end.to change { mute.reload.hide_notifications? }.from(false).to(true) end it 'doesnt update mute.hide_notifications when arg :notifications is false' do expect do account.mute!(target_account, notifications: false) end.not_to change { mute.reload.hide_notifications? }.from(false) end it 'updates mute.hide_notifications true when arg :notifications is true' do expect do account.mute!(target_account, notifications: true) end.to change { mute.reload.hide_notifications? }.from(false).to(true) end end end
  80. Caleb Hearth dice.club/@caleb calebhearth.com Test Double describe '#mute!' do end

    context 'Mute does not exist yet' do it 'returns a Mute' do expect(account.mute!(target_account)) .to be_kind_of Mute end it 'creates a Mute when :notifications is nil' do expect do account.mute!(target_account, notifications: nil) end.to change { account.mute_relationships.count }.by 1 end it 'creates a Mute when :notifications is false' do expect do account.mute!(target_account, notifications: false) end.to change { account.mute_relationships.count }.by 1 end it 'creates a Mute when :notifications is true' do expect do account.mute!(target_account, notifications: true) end.to change { account.mute_relationships.count }.by 1 end end context 'Mute already exists' do before do account.mute_relationships << mute end let(:mute) do Fabricate(:mute, account: account, target_account: target_account, hide_notifications: true) end context 'mute.hide_notifications is true' do it 'does not update mute.hide_notifications when :notifications is nil' do expect do account.mute!(target_account, notifications: nil) end.not_to change { mute.reload.hide_notifications? }.from(true) end it 'updates mute.hide_notifications false when :notifications is false' do expect do account.mute!(target_account, notifications: false) end.to change { mute.reload.hide_notifications? }.from(true).to(false) end it 'doesnt update mute.hide_notifications false when :notifications=true' do expect do account.mute!(target_account, notifications: true) end.not_to change { mute.reload.hide_notifications? }.from(true) end end context 'mute.hide_notifications is false' do it 'updates mute.hide_notifications true when arg :notifications is nil' do expect do account.mute!(target_account, notifications: nil) end.to change { mute.reload.hide_notifications? }.from(false).to(true) end it 'doesnt update mute.hide_notifications when arg :notifications is false' do expect do account.mute!(target_account, notifications: false) end.not_to change { mute.reload.hide_notifications? }.from(false) end it 'updates mute.hide_notifications true when arg :notifications is true' do expect do account.mute!(target_account, notifications: true) end.to change { mute.reload.hide_notifications? }.from(false).to(true) end end end
  81. Caleb Hearth dice.club/@caleb calebhearth.com Test Double describe '#mute!' do end

    context 'Mute does not exist yet' do it 'returns a Mute' do expect(account.mute!(target_account)) .to be_kind_of Mute end it 'creates a Mute when :notifications is nil' do expect do account.mute!(target_account, notifications: nil) end.to change { account.mute_relationships.count }.by 1 end it 'creates a Mute when :notifications is false' do expect do account.mute!(target_account, notifications: false) end.to change { account.mute_relationships.count }.by 1 end it 'creates a Mute when :notifications is true' do expect do account.mute!(target_account, notifications: true) end.to change { account.mute_relationships.count }.by 1 end end context 'Mute already exists' do context 'mute.hide_notifications is true' do it 'does not update mute.hide_notifications when :notifications is nil' do mute = Fabricate :mute, account: account, target_account: target_account, hide_notifications: true account.mute_relationships << mute expect do account.mute!(target_account, notifications: nil) end.not_to change { mute.reload.hide_notifications? }.from(true) end it 'updates mute.hide_notifications false when :notifications is false' do mute = Fabricate :mute, account: account, target_account: target_account, hide_notifications: true account.mute_relationships << mute expect do account.mute!(target_account, notifications: false) end.to change { mute.reload.hide_notifications? }.from(true).to(false) end it 'doesnt update mute.hide_notifications false when :notifications=true' do mute = Fabricate :mute, account: account, target_account: target_account, hide_notifications: true account.mute_relationships << mute expect do account.mute!(target_account, notifications: true) end.not_to change { mute.reload.hide_notifications? }.from(true) end end context 'mute.hide_notifications is false' do it 'updates mute.hide_notifications true when arg :notifications is nil' do mute = Fabricate :mute, account: account, target_account: target_account, hide_notifications: false account.mute_relationships << mute expect do account.mute!(target_account, notifications: nil) end.to change { mute.reload.hide_notifications? }.from(false).to(true) end it 'doesnt update mute.hide_notifications when arg :notifications is false' do mute = Fabricate :mute, account: account, target_account: target_account, hide_notifications: false account.mute_relationships << mute expect do account.mute!(target_account, notifications: false) end.not_to change { mute.reload.hide_notifications? }.from(false) end it 'updates mute.hide_notifications true when arg :notifications is true' do mute = Fabricate :mute, account: account, target_account: target_account, hide_notifications: false account.mute_relationships << mute expect do account.mute!(target_account, notifications: true) end.to change { mute.reload.hide_notifications? }.from(false).to(true) end end end
  82. Caleb Hearth dice.club/@caleb calebhearth.com Test Double describe '#mute!' do end

    context 'Mute does not exist yet' do it 'returns a Mute' do expect(account.mute!(target_account)) .to be_kind_of Mute end it 'creates a Mute when :notifications is nil' do expect do account.mute!(target_account, notifications: nil) end.to change { account.mute_relationships.count }.by 1 end it 'creates a Mute when :notifications is false' do expect do account.mute!(target_account, notifications: false) end.to change { account.mute_relationships.count }.by 1 end it 'creates a Mute when :notifications is true' do expect do account.mute!(target_account, notifications: true) end.to change { account.mute_relationships.count }.by 1 end end context 'Mute already exists' do context 'mute.hide_notifications is true' do it 'does not update mute.hide_notifications when :notifications is nil' do mute = Fabricate :mute, account: account, target_account: target_account, hide_notifications: true account.mute_relationships << mute expect do account.mute!(target_account, notifications: nil) end.not_to change { mute.reload.hide_notifications? }.from(true) end it 'updates mute.hide_notifications false when :notifications is false' do mute = Fabricate :mute, account: account, target_account: target_account, hide_notifications: true account.mute_relationships << mute expect do account.mute!(target_account, notifications: false) end.to change { mute.reload.hide_notifications? }.from(true).to(false) end it 'doesnt update mute.hide_notifications false when :notifications=true' do mute = Fabricate :mute, account: account, target_account: target_account, hide_notifications: true account.mute_relationships << mute expect do account.mute!(target_account, notifications: true) end.not_to change { mute.reload.hide_notifications? }.from(true) end end context 'mute.hide_notifications is false' do it 'updates mute.hide_notifications true when arg :notifications is nil' do mute = Fabricate :mute, account: account, target_account: target_account, hide_notifications: false account.mute_relationships << mute expect do account.mute!(target_account, notifications: nil) end.to change { mute.reload.hide_notifications? }.from(false).to(true) end it 'doesnt update mute.hide_notifications when arg :notifications is false' do mute = Fabricate :mute, account: account, target_account: target_account, hide_notifications: false account.mute_relationships << mute expect do account.mute!(target_account, notifications: false) end.not_to change { mute.reload.hide_notifications? }.from(false) end it 'updates mute.hide_notifications true when arg :notifications is true' do mute = Fabricate :mute, account: account, target_account: target_account, hide_notifications: false account.mute_relationships << mute expect do account.mute!(target_account, notifications: true) end.to change { mute.reload.hide_notifications? }.from(false).to(true) end end end
  83. Caleb Hearth dice.club/@caleb calebhearth.com Test Double describe '#mute!' do end

    context 'Mute does not exist yet' do it 'returns a Mute' do expect(account.mute!(target_account)) .to be_kind_of Mute end it 'creates a Mute when :notifications is nil' do expect do account.mute!(target_account, notifications: nil) end.to change { account.mute_relationships.count }.by 1 end it 'creates a Mute when :notifications is false' do expect do account.mute!(target_account, notifications: false) end.to change { account.mute_relationships.count }.by 1 end it 'creates a Mute when :notifications is true' do expect do account.mute!(target_account, notifications: true) end.to change { account.mute_relationships.count }.by 1 end end context 'Mute already exists' do context 'mute.hide_notifications is true' do it 'does not update mute.hide_notifications when :notifications is nil' do mute = Fabricate :mute, account: account, target_account: target_account, hide_notifications: true account.mute_relationships << mute expect do account.mute!(target_account, notifications: nil) end.not_to change { mute.reload.hide_notifications? }.from(true) end it 'updates mute.hide_notifications false when :notifications is false' do mute = Fabricate :mute, account: account, target_account: target_account, hide_notifications: true account.mute_relationships << mute expect do account.mute!(target_account, notifications: false) end.to change { mute.reload.hide_notifications? }.from(true).to(false) end it 'doesnt update mute.hide_notifications false when :notifications=true' do mute = Fabricate :mute, account: account, target_account: target_account, hide_notifications: true account.mute_relationships << mute expect do account.mute!(target_account, notifications: true) end.not_to change { mute.reload.hide_notifications? }.from(true) end end context 'mute.hide_notifications is false' do it 'updates mute.hide_notifications true when arg :notifications is nil' do mute = Fabricate :mute, account: account, target_account: target_account, hide_notifications: false account.mute_relationships << mute expect do account.mute!(target_account, notifications: nil) end.to change { mute.reload.hide_notifications? }.from(false).to(true) end it 'doesnt update mute.hide_notifications when arg :notifications is false' do mute = Fabricate :mute, account: account, target_account: target_account, hide_notifications: false account.mute_relationships << mute expect do account.mute!(target_account, notifications: false) end.not_to change { mute.reload.hide_notifications? }.from(false) end it 'updates mute.hide_notifications true when arg :notifications is true' do mute = Fabricate :mute, account: account, target_account: target_account, hide_notifications: false account.mute_relationships << mute expect do account.mute!(target_account, notifications: true) end.to change { mute.reload.hide_notifications? }.from(false).to(true) end end end
  84. Caleb Hearth dice.club/@caleb calebhearth.com Test Double describe '#mute!' do end

    context 'Mute does not exist yet' do it 'returns a Mute' do expect(Fabricate(:account).mute!(Fabricate(:account))) .to be_kind_of Mute end it 'creates a Mute when :notifications is nil' do account = Fabricate(:account) expect do account.mute!(Fabricate(:account), notifications: nil) end.to change { account.mute_relationships.count }.by 1 end it 'creates a Mute when :notifications is false' do account = Fabricate(:account) expect do account.mute!(Fabricate(:account), notifications: false) end.to change { account.mute_relationships.count }.by 1 end it 'creates a Mute when :notifications is true' do account = Fabricate(:account) expect do account.mute!(Fabricate(:account), notifications: true) end.to change { account.mute_relationships.count }.by 1 end end context 'Mute already exists' do context 'mute.hide_notifications is true' do it 'does not update mute.hide_notifications when :notifications is nil' do account = Fabricate(:account) target_account = Fabricate(:account) mute = Fabricate :mute, account: account, target_account: target_account, hide_notifications: true account.mute_relationships << mute expect do account.mute!(target_account, notifications: nil) end.not_to change { mute.reload.hide_notifications? }.from(true) end it 'updates mute.hide_notifications false when :notifications is false' do account = Fabricate(:account) target_account = Fabricate(:account) mute = Fabricate :mute, account: account, target_account: target_account, hide_notifications: true account.mute_relationships << mute expect do account.mute!(target_account, notifications: false) end.to change { mute.reload.hide_notifications? }.from(true).to(false) end it 'doesnt update mute.hide_notifications false when :notifications=true' do account = Fabricate(:account) target_account = Fabricate(:account) mute = Fabricate :mute, account: account, target_account: target_account, hide_notifications: true account.mute_relationships << mute expect do account.mute!(target_account, notifications: true) end.not_to change { mute.reload.hide_notifications? }.from(true) end end context 'mute.hide_notifications is false' do it 'updates mute.hide_notifications true when arg :notifications is nil' do account = Fabricate(:account) target_account = Fabricate(:account) mute = Fabricate :mute, account: account, target_account: target_account, hide_notifications: false account.mute_relationships << mute expect do account.mute!(target_account, notifications: nil) end.to change { mute.reload.hide_notifications? }.from(false).to(true) end it 'doesnt update mute.hide_notifications when arg :notifications is false' do account = Fabricate(:account) target_account = Fabricate(:account) mute = Fabricate :mute, account: account, target_account: target_account, hide_notifications: false account.mute_relationships << mute expect do account.mute!(target_account, notifications: false) end.not_to change { mute.reload.hide_notifications? }.from(false) end it 'updates mute.hide_notifications true when arg :notifications is true' do account = Fabricate(:account) target_account = Fabricate(:account) mute = Fabricate :mute, account: account, target_account: target_account, hide_notifications: false account.mute_relationships << mute expect do account.mute!(target_account, notifications: true) end.to change { mute.reload.hide_notifications? }.from(false).to(true) end end end
  85. Caleb Hearth dice.club/@caleb calebhearth.com Test Double describe '#mute!' do end

    context 'Mute already exists' do context 'mute.hide_notifications is true' do it 'does not update mute.hide_notifications when :notifications is nil' do account = Fabricate(:account) target_account = Fabricate(:account) mute = Fabricate :mute, account: account, target_account: target_account, hide_notifications: true account.mute_relationships << mute expect do account.mute!(target_account, notifications: nil) end.not_to change { mute.reload.hide_notifications? }.from(true) end it 'updates mute.hide_notifications false when :notifications is false' do account = Fabricate(:account) target_account = Fabricate(:account) mute = Fabricate :mute, account: account, target_account: target_account, hide_notifications: true account.mute_relationships << mute expect do account.mute!(target_account, notifications: false) end.to change { mute.reload.hide_notifications? }.from(true).to(false) end it 'doesnt update mute.hide_notifications false when :notifications=true' do account = Fabricate(:account) target_account = Fabricate(:account) mute = Fabricate :mute, account: account, target_account: target_account, hide_notifications: true account.mute_relationships << mute expect do account.mute!(target_account, notifications: true) end.not_to change { mute.reload.hide_notifications? }.from(true) end end
  86. Caleb Hearth dice.club/@caleb calebhearth.com Test Double it 'returns Mute without

    updating mute.hide_notifications' do expect do expect(subject).to be_kind_of Mute end.not_to change { mute.reload.hide_notifications? }.from(true) end
  87. Caleb Hearth dice.club/@caleb calebhearth.com Test Double it 'returns Mute without

    updating mute.hide_notifications' do expect do expect(subject).to be_kind_of Mute end.not_to change { mute.reload.hide_notifications? }.from(true) end
  88. Caleb Hearth dice.club/@caleb calebhearth.com Test Double it 'returns Mute without

    updating mute.hide_notifications' do expect do expect(subject).to be_kind_of Mute end.not_to change { mute.reload.hide_notifications? }.from(true) end
  89. Caleb Hearth dice.club/@caleb calebhearth.com Test Double it 'returns Mute without

    updating mute.hide_notifications' do expect do expect(subject).to be_kind_of Mute end.not_to change { mute.reload.hide_notifications? }.from(true) end
  90. Caleb Hearth dice.club/@caleb calebhearth.com Test Double it 'returns Mute without

    updating mute.hide_notifications' do expect do expect(subject).to be_kind_of Mute end.not_to change { mute.reload.hide_notifications? }.from(true) end
  91. Caleb Hearth dice.club/@caleb calebhearth.com Test Double it 'returns Mute without

    updating mute.hide_notifications' do expect do expect(subject).to be_kind_of Mute end.not_to change { mute.reload.hide_notifications? }.from(true) end
  92. Caleb Hearth dice.club/@caleb calebhearth.com Test Double it 'returns Mute without

    updating mute.hide_notifications' do expect do expect(subject).to be_kind_of Mute end.not_to change { mute.reload.hide_notifications? }.from(true) end
  93. Caleb Hearth dice.club/@caleb calebhearth.com Test Double it 'returns Mute without

    updating mute.hide_notifications' do expect do expect(subject).to be_kind_of Mute end.not_to change { mute.reload.hide_notifications? }.from(true) end
  94. Caleb Hearth dice.club/@caleb calebhearth.com Test Double it 'does not update

    mute.hide_notifications when :notifications is nil' do account = Fabricate(:account) target_account = Fabricate(:account) mute = Fabricate :mute, account: account, target_account: target_account, hide_notifications: true account.mute_relationships << mute expect do account.mute!(target_account, notifications: nil) end.not_to change { mute.reload.hide_notifications? }.from(true) end
  95. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double before(:everything)

  96. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double before(:everything)

  97. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double ✅ Database Cleaner before(:everything)

  98. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double ✅ Database Cleaner ✅

    Webmock before(:everything)
  99. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double ✅ Database Cleaner ✅

    Webmock ✅ Global things before(:everything)
  100. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double ✅ Database Cleaner ✅

    Webmock ✅ Global things ❌ Most things in spec fi les before(:everything)
  101. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double before vs let

  102. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double before vs let +before

    let
  103. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double shared_examples shared_context behaves_like

  104. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double module DoThingsable end

  105. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double module DoThingsable extend ActiveModel::Concern

    end Caleb Hearth dice.camp/@caleb calebhearth.com Test Double
  106. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double Caleb Hearth dice.camp/@caleb calebhearth.com

    Test Double
  107. Caleb Hearth dice.camp/@caleb calebhearth.com Test Double

  108. Caleb Hearth dice.camp/@caleb calebhearth.com What topics would be helpful to

    you? link.testdouble.com/rubysurvey
  109. Got a puzzler? Request a 1:1 
 virtual pairing 


    session with us! link.testdouble.com/rubypair Caleb Hearth dice.camp/@caleb calebhearth.com