| Class | Rspec::Generators::ScaffoldGenerator |
| In: |
lib/generators/rspec/scaffold/scaffold_generator.rb
|
| Parent: | Base |
Returns the name of the mock. For example, if the file name is user, it returns mock_user.
If a hash is given, it uses the hash key as the ORM method and the value as response. So, for ActiveRecord and file name "User":
mock_file_name(:save => true) #=> mock_user(:save => true)
If another ORM is being used and another method instead of save is called, it will be the one used.
Receives the ORM chain and convert to expects. For ActiveRecord:
should! orm_class.find(User, "37") #=> User.should_receive(:find).with(37)
For Datamapper:
should! orm_class.find(User, "37") #=> User.should_receive(:get).with(37)
Receives the ORM chain and convert to stub. For ActiveRecord:
stub orm_class.find(User, "37") #=> User.stub(:find).with(37)
For Datamapper:
stub orm_class.find(User, "37") #=> User.stub(:get).with(37)