Files
nairobi/spec/lib/acts_as_paranoid_aliases_spec.rb
Javi Martín db97f9d08c Add and apply rubocop rules for empty lines
We were very inconsistent regarding these rules.

Personally I prefer no empty lines around blocks, clases, etc... as
recommended by the Ruby style guide [1], and they're the default values
in rubocop, so those are the settings I'm applying.

The exception is the `private` access modifier, since we were leaving
empty lines around it most of the time. That's the default rubocop rule
as well. Personally I don't have a strong preference about this one.


[1] https://rubystyle.guide/#empty-lines-around-bodies
2019-10-24 17:11:47 +02:00

46 lines
1.1 KiB
Ruby

require "rails_helper"
describe "Paranoid methods" do
describe ".hide_all" do
it "hides all instances in the id list" do
debate1 = create(:debate)
debate2 = create(:debate)
debate3 = create(:debate)
debate4 = create(:debate)
expect(Debate.all).to match_array [debate1, debate2, debate3, debate4]
Debate.hide_all [debate1, debate2, debate4].map(&:id)
expect(Debate.all).to eq([debate3])
end
end
describe ".restore_all" do
it "restores all instances in the id list" do
debate1 = create(:debate)
debate2 = create(:debate)
debate3 = create(:debate)
debate1.hide
debate3.hide
expect(Debate.all).to eq([debate2])
Debate.restore_all [debate1, debate3].map(&:id)
expect(Debate.all).to match_array [debate1, debate2, debate3]
end
end
describe "#restore" do
it "resets the confirmed_hide_at attribute" do
debate = create(:debate, :hidden, :with_confirmed_hide)
debate.restore
expect(debate.reload.confirmed_hide?).not_to be
end
end
end