Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save avegancafe/7a53bf276ac86e2cf207be5666c2c0c8 to your computer and use it in GitHub Desktop.

Select an option

Save avegancafe/7a53bf276ac86e2cf207be5666c2c0c8 to your computer and use it in GitHub Desktop.
Examples for RSpec Formatting Blog Post - space_authority_lazy_load_evaluations_spec.rb
describe SpaceAuthority do
describe '#authorized_spaces' do
let(:user) { create(:user) }
let(:authorized_space_through_property) { create(:space, unit: 'authorized space through property', ...) }
let(:authorized_space_directly) { create(:space, unit: 'authorized space directly', ...) }
let(:unauthorized_space) { create(:space, unit: 'unauthorized space', ...) }
subject { described_class.new(user).authorized_spaces }
it 'only lists authorized spaces' do
expect(subject.map(&:unit)).to match_array([
authorized_space_through_property,
authorized_space_directly,
].map(&:unit))
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment