12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/api_fixtures/dsl.rb', line 12
def self.extended(base)
base.class_attribute :api_fixture_paths
base.send(:include, InstanceDSL)
before_hook = [:before, :setup].find {|hook| base.respond_to?(hook) }
after_hook = [:after, :teardown].find {|hook| base.respond_to?(hook) }
base.send(before_hook) do
ApiFixtures::Fixtures.clear
(api_fixture_paths || []).each do |path|
ApiFixtures::Fixtures.fixture('GET', path)
end
end
base.send(after_hook) do
ApiFixtures::Fixtures.assert_expected_calls(self)
end
end
|