Skip to content

Instantly share code, notes, and snippets.

@apotonick
Last active October 26, 2016 23:14
Show Gist options
  • Save apotonick/fed8d7136370877b057762877f060cd3 to your computer and use it in GitHub Desktop.
Save apotonick/fed8d7136370877b057762877f060cd3 to your computer and use it in GitHub Desktop.
RSpec RSpec::Core::ExampleGroup::WrongScopeError
module Rspec
module Helpers
def factory(name, method_name, &block)
let(name) { block.call }
end
end
end
RSpec.configure do |c|
c.extend Trailblazer::Rspec::Helpers
end
let (:a) { Object }
factory(:bla) { a }
it { bla } # RSpec::Core::ExampleGroup::WrongScopeError
@apotonick
Copy link
Author

Usage example:

let(:a) { Object }
factory(:model) { Create.(a) }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment