1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
Feature: search_modules
Most projects do not have a separate namespace for their classes, which the default that Bogus assumes. However, if all (or some) of your classes exist within some module you can add it to the list of modules that Bogus will look in when trying to resolve class names.
Scenario: search_modules
Given a file named "foo.rb" with:
"""ruby
class Foo
def foo
end
end
"""
Given a file named "baz.rb" with:
"""ruby
module Bar
class Baz
def baz
end
end
end
"""
Then spec file with following content should pass:
"""ruby
require_relative 'foo'
require_relative 'baz'
Bogus.configure do |c|
c.search_modules << Bar
end
describe "logger class fake" do
fake(:foo)
fake(:baz)
it "finds classes in global namespace" do
foo.foo
end
it "finds classes in specified modules" do
baz.baz
end
end
"""
|