Module: RSpec::Generator::Helpers
- Defined in:
- lib/generator_spec/matchers/helpers/file.rb,
lib/generator_spec/matchers/helpers/migration.rb
Instance Method Summary collapse
- #check_file(file_name, type = nil, &block) ⇒ Object (also: #file)
- #check_migration(file_name, &block) ⇒ Object (also: #migration)
- #check_model(file_name, clazz, options = {}) ⇒ Object (also: #model)
- #check_view(file_name, matchings) ⇒ Object (also: #view)
Instance Method Details
#check_file(file_name, type = nil, &block) ⇒ Object Also known as: file
3 4 5 |
# File 'lib/generator_spec/matchers/helpers/file.rb', line 3 def check_file file_name, type=nil, &block self.should generate_file(file_name, type, &block) end |
#check_migration(file_name, &block) ⇒ Object Also known as: migration
3 4 5 6 7 |
# File 'lib/generator_spec/matchers/helpers/migration.rb', line 3 def check_migration(file_name, &block) self.should generate_migration file_name do |content| yield content if block end end |
#check_model(file_name, clazz, options = {}) ⇒ Object Also known as: model
15 16 17 18 19 20 21 22 23 |
# File 'lib/generator_spec/matchers/helpers/file.rb', line 15 def check_model(file_name, clazz, = {}) self.should generate_file("#{file_name.underscore}.rb", :model) do |file_content| file_content.should have_class clazz do |content| check_matchings [:matchings] check_methods([:methods]) check_class_methods([:class_methods]) end end end |
#check_view(file_name, matchings) ⇒ Object Also known as: view
8 9 10 11 12 |
# File 'lib/generator_spec/matchers/helpers/file.rb', line 8 def check_view(file_name, matchings) self.should generate_file(file_name, :view) do |content| check_matchings matchings end end |