Module: RSpec::Generator::Helpers

Defined in:
lib/rspec_for_generators/matchers/helpers/file.rb

Instance Method Summary collapse

Instance Method Details

#check_file(file, type = nil, &block) ⇒ Object Also known as: file



4
5
6
# File 'lib/rspec_for_generators/matchers/helpers/file.rb', line 4

def check_file file, type=nil, &block
  self.should generate_file(file, type, &block)
end

#check_model(name, clazz, options = {}) ⇒ Object Also known as: model



16
17
18
19
20
21
22
23
24
# File 'lib/rspec_for_generators/matchers/helpers/file.rb', line 16

def check_model(name, clazz, options = {})
  self.should generate_file("#{name.underscore}.rb", :model) do |file_content|
    file_content.should have_class clazz do |content|
      check_matchings options[:matchings]    
      check_methods(options[:methods])
      check_class_methods(options[:class_methods])
    end
  end            
end

#check_view(file_name, matchings) ⇒ Object Also known as: view



9
10
11
12
13
# File 'lib/rspec_for_generators/matchers/helpers/file.rb', line 9

def check_view(file_name, matchings)
  self.should generate_file(filename, :view) do |content|  
    check_matchings matchings
  end
end