Sha256: b0bb7a471be010be3e26f83c39cb2289547e086b504ac54b0084616bd532ba9a

Contents?: true

Size: 1.55 KB

Versions: 2

Compression:

Stored size: 1.55 KB

Contents

require 'spec_helper'

describe RailsBestPractices::Checks::Check do
  before :each do
    @check = RailsBestPractices::Checks::Check.new
  end

  it "should get empty interesting prepare nodes" do
    @check.interesting_prepare_nodes.should == []
  end

  it "should get empty interesting review nodes" do
    @check.interesting_review_nodes.should == []
  end

  it "should match all files of interesting prepare files" do
    @check.interesting_prepare_files.should == /.*/
  end

  it "should match all files of interesting review files" do
    @check.interesting_review_files.should == /.*/
  end

  context "review_node_start" do
    it "should call review_start_if" do
      node = stub(:node_type => :if)
      @check.should_receive(:send).with("review_start_if", node)
      @check.review_node_start(node)
    end

    it "should call review_start_call" do
      node = stub(:node_type => :call)
      @check.should_receive(:send).with("review_start_call", node)
      @check.review_node_start(node)
    end
  end

  context "review_node_end" do
    it "should call review_end_if" do
      node = stub(:node_type => :if)
      @check.should_receive(:send).with("review_end_if", node)
      @check.review_node_end(node)
    end

    it "should call review_end_call" do
      node = stub(:node_type => :call)
      @check.should_receive(:send).with("review_end_call", node)
      @check.review_node_end(node)
    end
  end

  context "equal?" do
    it "should be true when compare symbol string with symbol" do
      @check.equal?(":test", :test).should be_true
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rails_best_practices-0.6.6 spec/rails_best_practices/checks/check_spec.rb
rails_best_practices-0.6.5 spec/rails_best_practices/checks/check_spec.rb