Module: Mockumentary::ActiveRecord
- Defined in:
- lib/mockumentary/active_record.rb
Instance Method Summary collapse
- #discover_mock_class! ⇒ Object
- #mew(opts = {}) ⇒ Object
- #mock(opts = {}) ⇒ Object
- #mock!(opts = {}) ⇒ Object
- #mock_class ⇒ Object
Instance Method Details
#discover_mock_class! ⇒ Object
7 8 9 |
# File 'lib/mockumentary/active_record.rb', line 7 def discover_mock_class! Mockery.classes.detect {|c| c.ar_class == self } || Mockery.generate(self) end |
#mew(opts = {}) ⇒ Object
19 20 21 |
# File 'lib/mockumentary/active_record.rb', line 19 def mew(opts={}) mock_class.new(opts) end |
#mock(opts = {}) ⇒ Object
11 12 13 |
# File 'lib/mockumentary/active_record.rb', line 11 def mock(opts={}) mock_class.mock(opts) end |
#mock!(opts = {}) ⇒ Object
15 16 17 |
# File 'lib/mockumentary/active_record.rb', line 15 def mock!(opts={}) mock_class.mock!(opts) end |
#mock_class ⇒ Object
3 4 5 |
# File 'lib/mockumentary/active_record.rb', line 3 def mock_class @mock_class ||= discover_mock_class! end |