Class: FixtureKit::RSpecAdapter
- Inherits:
-
Adapter
- Object
- Adapter
- FixtureKit::RSpecAdapter
- Defined in:
- lib/fixture_kit/adapters/rspec_adapter.rb
Instance Method Summary collapse
Instance Method Details
#execute(&block) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/fixture_kit/adapters/rspec_adapter.rb', line 7 def execute(&block) previous_example = ::RSpec.current_example previous_scope = ::RSpec.current_scope group = example_group example = group.example { block.call(self) } succeeded = begin example.run(group.new, ::RSpec::Core::NullReporter) ensure # The group is reused, and the example it holds retains this block. group.examples.clear ::RSpec.current_example = previous_example ::RSpec.current_scope = previous_scope end raise example.exception unless succeeded end |
#identifier_for(identifier) ⇒ Object
25 26 27 28 |
# File 'lib/fixture_kit/adapters/rspec_adapter.rb', line 25 def identifier_for(identifier) normalized_scope = identifier.to_s.sub(/\ARSpec::ExampleGroups::/, "") ActiveSupport::Inflector.underscore(normalized_scope) end |