Sha256: 811d09ba8b4ba605da84e4d7dc3608b2e16c7c4d99d0cde377d4a052a6d9061b
Contents?: true
Size: 1.98 KB
Versions: 1
Compression:
Stored size: 1.98 KB
Contents
# encoding: utf-8 require 'spec_helper' class TestPrepare1 def interesting_nodes [:call] end def interesting_files RailsBestPractices::Core::Check::MODEL_FILES end end class TestPrepare2 def interesting_nodes [:class] end def interesting_files RailsBestPractices::Core::Check::MAILER_FILES end end class TestReview1 def interesting_nodes [:defn] end def interesting_files RailsBestPractices::Core::Check::CONTROLLER_FILES end end class TestReview2 def interesting_nodes [:call] end def interesting_files RailsBestPractices::Core::Check::VIEW_FILES end end describe RailsBestPractices::Core::CheckingVisitor do let(:prepare1) { TestPrepare1.new } let(:prepare2) { TestPrepare2.new } let(:review1) { TestReview1.new } let(:review2) { TestReview2.new } let(:visitor) { RailsBestPractices::Core::CheckingVisitor.new([prepare1, prepare2], [review1, review2]) } it "should prepare model associations" do node = stub(:node_type => :call, :children => [], :file => "app/models/user.rb") prepare1.should_receive(:node_start).with(node) prepare1.should_receive(:node_end).with(node) visitor.prepare(node) end it "should prepare mailer names" do node = stub(:node_type => :class, :children => [], :file => "app/mailers/user_mailer.rb") prepare2.should_receive(:node_start).with(node) prepare2.should_receive(:node_end).with(node) visitor.prepare(node) end it "should review controller method definitions" do node = stub(:node_type => :defn, :children => [], :file => "app/controllers/users_controller.rb") review1.should_receive(:node_start).with(node) review1.should_receive(:node_end).with(node) visitor.review(node) end it "should review view calls" do node = stub(:node_type => :call, :children => [], :file => "app/views/users/new.html.erb") review2.should_receive(:node_start).with(node) review2.should_receive(:node_end).with(node) visitor.review(node) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rails_best_practices-0.6.7 | spec/rails_best_practices/core/checking_visitor_spec.rb |