Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save avegancafe/55f7b7e786f1cb460cb92af6454b497d to your computer and use it in GitHub Desktop.

Select an option

Save avegancafe/55f7b7e786f1cb460cb92af6454b497d to your computer and use it in GitHub Desktop.
Examples for RSpec Formatting Blog Post - space_authority_mutually_ordered_creation_spec.rb
describe SpaceAuthority do
let!(:user) { create(:user) }
let!(:first_space) { create(:space, unit: 'first space', sort_order: 0) }
let!(:middle_space) { create(:space, unit: 'middle space', sort_order: 0) }
let!(:last_space) { create(:space, unit: 'last space', sort_order: 0) }
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