Sha256: f7ed6cd5962564a5f351723ad093c51d7d9c6126cb01290084c1aa91a40f5185
Contents?: true
Size: 1.78 KB
Versions: 6
Compression:
Stored size: 1.78 KB
Contents
require_relative '../../spec_helper' require 'tailor/critic' require 'tailor/configuration/style' CAMEL_CASE_METHODS = {} CAMEL_CASE_METHODS[:one_caps_camel_case_method] = %Q{def thingOne end} CAMEL_CASE_METHODS[:one_caps_camel_case_method_trailing_comment] = %Q{def thingOne # comment end} describe "Detection of camel case methods" do before do Tailor::Logger.stub(:log) FakeFS.activate! File.open(file_name.to_s, 'w') { |f| f.write contents } critic.check_file(file_name.to_s, style.to_hash) end let(:critic) do Tailor::Critic.new end let(:contents) { CAMEL_CASE_METHODS[file_name] } let(:style) do style = Tailor::Configuration::Style.new style.trailing_newlines 0, level: :off style.allow_invalid_ruby true, level: :off style end context "standard camel case method" do let(:file_name) { :one_caps_camel_case_method } specify { critic.problems[file_name.to_s].size.should be 1 } specify { critic.problems[file_name.to_s].first[:type].should == "allow_camel_case_methods" } specify { critic.problems[file_name.to_s].first[:line].should be 1 } specify { critic.problems[file_name.to_s].first[:column].should be 4 } specify { critic.problems[file_name.to_s].first[:level].should be :error } end context "standard camel case method, trailing comment" do let(:file_name) { :one_caps_camel_case_method_trailing_comment } specify { critic.problems[file_name.to_s].size.should be 1 } specify { critic.problems[file_name.to_s].first[:type].should == "allow_camel_case_methods" } specify { critic.problems[file_name.to_s].first[:line].should be 1 } specify { critic.problems[file_name.to_s].first[:column].should be 4 } specify { critic.problems[file_name.to_s].first[:level].should be :error } end end
Version data entries
6 entries across 6 versions & 1 rubygems