Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save avegancafe/49dba5be4bbd3e99d586198b26cbed40 to your computer and use it in GitHub Desktop.

Select an option

Save avegancafe/49dba5be4bbd3e99d586198b26cbed40 to your computer and use it in GitHub Desktop.
Examples for RSpec Formatting Blog Post - space_authority_avoid_order_flakes_spec.rb
describe SpaceAuthority do
let!(:user) { create(:user) }
let!(:middle_space) { create(:space, unit: 'first space', sort_order: 2) }
let!(:last_space) { create(:space, unit: 'middle space', sort_order: 3) }
let!(:first_space) { create(:space, unit: 'last space', sort_order: 1) }
subject { described_class.new(user).spaces(order: :sort_order) }
it 'sorts spaces' do
expect(subject.map(&:unit)).to eq([
first_space,
middle_space,
last_space,
]l.map(&:unit))
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment