Skip to content

Instantly share code, notes, and snippets.

@rylnd
Last active February 9, 2019 01:31
Show Gist options
  • Select an option

  • Save rylnd/f190b4cec13735adf6cef3bbc6c09f8a to your computer and use it in GitHub Desktop.

Select an option

Save rylnd/f190b4cec13735adf6cef3bbc6c09f8a to your computer and use it in GitHub Desktop.
Rails NameError
# a/b.rb
module A
module B
THING = 'thing'
end
end
# a/b/foo.rb
module A
module B
class Foo
def initialize
self.thing = A::B::THING
end
end
end
end
module A
module B
describe Foo do
it 'fails because the constant is not loaded' do
expect { subject.thing }.not_to raise_error
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment