Skip to content

Commit

Permalink
Use Ruby 1.8-compatible hash syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
sferik committed Dec 8, 2013
1 parent 1dcde12 commit 469d530
Show file tree
Hide file tree
Showing 34 changed files with 62 additions and 58 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ source 'https://rubygems.org'
gemspec

group :development, :test do
gem 'devtools', git: 'https://github.com/rom-rb/devtools.git'
gem 'devtools', :git => 'https://github.com/rom-rb/devtools.git'
end

eval_gemfile 'Gemfile.devtools'
14 changes: 7 additions & 7 deletions Gemfile.devtools
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ group :guard do

# file system change event handling
gem 'listen', '~> 1.3.0'
gem 'rb-fchange', '~> 0.0.6', require: false
gem 'rb-fsevent', '~> 0.9.3', require: false
gem 'rb-inotify', '~> 0.9.0', require: false
gem 'rb-fchange', '~> 0.0.6', :require => false
gem 'rb-fsevent', '~> 0.9.3', :require => false
gem 'rb-inotify', '~> 0.9.0', :require => false

# notification handling
gem 'libnotify', '~> 0.8.0', require: false
gem 'rb-notifu', '~> 0.0.4', require: false
gem 'terminal-notifier-guard', '~> 1.5.3', require: false
gem 'libnotify', '~> 0.8.0', :require => false
gem 'rb-notifu', '~> 0.0.4', :require => false
gem 'terminal-notifier-guard', '~> 1.5.3', :require => false
end

group :metrics do
Expand All @@ -38,7 +38,7 @@ group :metrics do
gem 'simplecov', '~> 0.7.1'

platforms :ruby_19, :ruby_20 do
gem 'mutant', git: 'https://github.com/mbj/mutant.git'
gem 'mutant', :git => 'https://github.com/mbj/mutant.git'
gem 'yard-spellcheck', '~> 0.1.5'
end
end
Expand Down
4 changes: 4 additions & 0 deletions config/rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,7 @@ IfUnlessModifier:
# Do not use sprintf instead of String#%.
FavorSprintf:
Enabled: false

# Enforce Ruby 1.8-compatible hash syntax
HashSyntax:
EnforcedStyle: hash_rockets
2 changes: 1 addition & 1 deletion lib/yardstick/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def self.parse_config(args)
args << '--help' if args.empty?
options = {}
option_parser(options).parse!(args)
Config.new(options.merge(path: args))
Config.new(options.merge(:path => args))
rescue OptionParser::InvalidOption => error
display_exit(error.message)
end
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/yardstick/class_methods/measure_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

describe 'with a config' do
before :all do
config = Yardstick::Config.new(path: Yardstick::ROOT.join('lib', 'yardstick.rb'))
config = Yardstick::Config.new(:path => Yardstick::ROOT.join('lib', 'yardstick.rb'))
@measurements = Yardstick.measure(config)
end

Expand Down
8 changes: 4 additions & 4 deletions spec/integration/yardstick/processor/process_string_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ def measurement(description)

describe 'without a method summary when validations are turned off' do
let(:config) do
Yardstick::Config.new(rules: {
'Summary::Presence'.to_sym => { enabled: false }
Yardstick::Config.new(:rules => {
'Summary::Presence'.to_sym => { :enabled => false }
})
end
let(:method) { 'def test(value); end' }
Expand All @@ -70,8 +70,8 @@ def measurement(description)

describe 'without a method summary when validations are turned off for given class' do
let(:config) do
Yardstick::Config.new(rules: {
'Summary::Presence'.to_sym => { enabled: true, exclude: %w[World] }
Yardstick::Config.new(:rules => {
'Summary::Presence'.to_sym => { :enabled => true, :exclude => %w[World] }
})
end
let(:method) { 'class World; def test(value); end; end' }
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/yardstick/config/class_methods/coerce_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

it 'coerces hash' do
rules = subject.instance_variable_get(:@rules)
expect(rules).to eql(foo: 'bar')
expect(rules).to eql(:foo => 'bar')
end
end

Expand Down
4 changes: 2 additions & 2 deletions spec/unit/yardstick/config/for_rule_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
subject { described_class.new(options).for_rule(rule_class) }

let(:options) do
{ rules: { 'Summary::Presence'.to_sym => { enabled: false } } }
{ :rules => { 'Summary::Presence'.to_sym => { :enabled => false } } }
end

let(:rule_config) { double('RuleConfig') }
Expand All @@ -16,7 +16,7 @@
let(:rule_class) { Yardstick::Rules::Summary::Presence }

before do
allow(Yardstick::RuleConfig).to receive(:new).with(enabled: false)
allow(Yardstick::RuleConfig).to receive(:new).with(:enabled => false)
.and_return(rule_config)
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
subject { described_class.new(config).require_exact_threshold? }

context 'when set to true' do
let(:config) { { require_exact_threshold: true } }
let(:config) { { :require_exact_threshold => true } }

it { should be(true) }
end

context 'when set to false' do
let(:config) { { require_exact_threshold: false } }
let(:config) { { :require_exact_threshold => false } }

it { should be(false) }
end
Expand Down
8 changes: 4 additions & 4 deletions spec/unit/yardstick/config/set_defaults_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
context 'when with options' do
let(:options) do
{
threshold: 15,
verbose: false,
path: 'tmp/*.rb',
require_exact_threshold: false
:threshold => 15,
:verbose => false,
:path => 'tmp/*.rb',
:require_exact_threshold => false
}
end

Expand Down
4 changes: 2 additions & 2 deletions spec/unit/yardstick/config/verbose_predicate_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
subject { described_class.new(config).verbose? }

context 'when set to true' do
let(:config) { { verbose: true } }
let(:config) { { :verbose => true } }

it { should be(true) }
end

context 'when set to false' do
let(:config) { { verbose: false } }
let(:config) { { :verbose => false } }

it { should be(false) }
end
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/yardstick/document/api_predicate_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
let(:docstring) { double('docstring') }

before do
docstring.stub(:tag).with('api') { double(text: 'private') }
docstring.stub(:tag).with('api') { double(:text => 'private') }
end

context 'when tag is equal' do
Expand Down
4 changes: 2 additions & 2 deletions spec/unit/yardstick/document/file_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
describe Yardstick::Document, '#file' do
subject { described_class.new(docstring).file }

let(:docstring) { double('docstring', object: object) }
let(:object) { double('object', file: '/foo/bar.rb') }
let(:docstring) { double('docstring', :object => object) }
let(:object) { double('object', :file => '/foo/bar.rb') }

it { should be_kind_of(Pathname) }

Expand Down
4 changes: 2 additions & 2 deletions spec/unit/yardstick/document/line_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
describe Yardstick::Document, '#line' do
subject { described_class.new(docstring).line }

let(:docstring) { double('docstring', object: object) }
let(:object) { double('object', line: 3) }
let(:docstring) { double('docstring', :object => object) }
let(:object) { double('object', :line => 3) }

it { should be(3) }
end
4 changes: 2 additions & 2 deletions spec/unit/yardstick/document/path_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
describe Yardstick::Document, '#path' do
subject { described_class.new(docstring).path }

let(:docstring) { double('docstring', object: object) }
let(:object) { double('object', path: 'Foo#bar') }
let(:docstring) { double('docstring', :object => object) }
let(:object) { double('object', :path => 'Foo#bar') }

it { should eq('Foo#bar') }
end
2 changes: 1 addition & 1 deletion spec/unit/yardstick/document/tag_text_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

let(:name) { 'api' }
let(:docstring) { double('docstring') }
let(:yard_tag) { double(text: 'private') }
let(:yard_tag) { double(:text => 'private') }

before do
docstring.stub(:tag).with(name) { yard_tag }
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/yardstick/document/tag_types_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

let(:name) { 'tag name' }
let(:docstring) { double('docstring') }
let(:yard_tag) { double(types: types) }
let(:yard_tag) { double(:types => types) }
let(:types) { %w[type1 type2] }

before do
Expand Down
4 changes: 2 additions & 2 deletions spec/unit/yardstick/document/visibility_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
describe Yardstick::Document, '#visibility' do
subject { described_class.new(docstring).visibility }

let(:docstring) { double('docstring', object: object) }
let(:object) { double('object', visibility: visibility) }
let(:docstring) { double('docstring', :object => object) }
let(:object) { double('object', :visibility => visibility) }

context 'when true' do
let(:visibility) { true }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
subject(:document_set) { described_class.parse_paths(paths) }

let(:paths) { double('paths') }
let(:method_object) { double(file: 'foo.rb', line: 4, docstring: docstring) }
let(:method_object) { double(:file => 'foo.rb', :line => 4, :docstring => docstring) }
let(:docstring) { double('docstring') }

before do
Expand Down
4 changes: 2 additions & 2 deletions spec/unit/yardstick/parser/class_methods/parse_string_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
describe Yardstick::Parser, '.parse_string' do
subject(:document_set) { described_class.parse_string(string) }

let(:string) { double('string', to_str: 'body') }
let(:method_object) { double(file: 'foo.rb', line: 4, docstring: docstring) }
let(:string) { double('string', :to_str => 'body') }
let(:method_object) { double(:file => 'foo.rb', :line => 4, :docstring => docstring) }
let(:docstring) { double('docstring') }

before do
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/yardstick/processor/process_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
describe Yardstick::Processor, '#process' do
subject { described_class.new(config).process }

let(:config) { double('config', path: path) }
let(:config) { double('config', :path => path) }
let(:path) { Pathname('foo/bar.rb') }
let(:documents) { double('document set') }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
describe Yardstick::Rake::Measurement, '#yardstick_measure' do
subject { described_class.new(:yardstick_measure, options).yardstick_measure }

let(:config) { double('config', path: 'tmp', output: report_writer) }
let(:config) { double('config', :path => 'tmp', :output => report_writer) }
let(:report_writer) { double('report writer') }
let(:options) { double('options') }
let(:measurements) { double('measurements') }
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/yardstick/rake/verify/initialize_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
context 'with custom arguments' do
subject(:task) { described_class.new(:verify, options) }

let(:config) { Yardstick::Config.new(threshold: 90) }
let(:config) { Yardstick::Config.new(:threshold => 90) }
let(:options) { double('options') }

before do
Expand Down
12 changes: 6 additions & 6 deletions spec/unit/yardstick/rake/verify/verify_measurements_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
capture_stdout { described_class.new(:verify, options).verify_measurements }
end

let(:config) { Yardstick::Config.new(threshold: 90) }
let(:config) { Yardstick::Config.new(:threshold => 90) }
let(:options) { double('options') }

before do
Expand All @@ -17,7 +17,7 @@
end

context 'when verbose' do
let(:measurements) { double('measurements', coverage: 0.9) }
let(:measurements) { double('measurements', :coverage => 0.9) }

it 'outputs coverage' do
measure
Expand All @@ -26,7 +26,7 @@
end

context 'when not verbose' do
let(:measurements) { double('measurements', coverage: 0.9) }
let(:measurements) { double('measurements', :coverage => 0.9) }

before do
config.verbose = false
Expand All @@ -39,7 +39,7 @@
end

context 'when lower coverage' do
let(:measurements) { double('measurements', coverage: 0.434) }
let(:measurements) { double('measurements', :coverage => 0.434) }

it 'outputs coverage' do
expect { measure }.to raise_error
Expand All @@ -53,7 +53,7 @@
end

context 'when higher coverage' do
let(:measurements) { double('measurements', coverage: 0.9989) }
let(:measurements) { double('measurements', :coverage => 0.9989) }

it 'outputs coverage' do
expect { measure }.to raise_error
Expand All @@ -67,7 +67,7 @@
end

context 'when higher coverage without exact threshold requirement' do
let(:measurements) { double('measurements', coverage: 1) }
let(:measurements) { double('measurements', :coverage => 1) }

before do
config.require_exact_threshold = false
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/yardstick/report_output/write_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
end
end

let(:target) { double('Pathname', dirname: dirname) }
let(:target) { double('Pathname', :dirname => dirname) }
let(:dirname) { double }

before do
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/yardstick/rule/class_methods/coerce_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

let(:document) { DocumentMock.new }
let(:config) { double('config') }
let(:rule_config) { Yardstick::RuleConfig.new(enabled: false) }
let(:rule_config) { Yardstick::RuleConfig.new(:enabled => false) }

before do
config.stub(:for_rule).with(described_class) { rule_config }
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/yardstick/rule/enabled_predicate_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
describe Yardstick::Rule, '#enabled?' do
subject { described_class.new(document, config).enabled? }

let(:document) { double('document', path: 'Foo#bar') }
let(:document) { double('document', :path => 'Foo#bar') }
let(:config) { double('RuleConfig') }
let(:return_value) { double('Boolean') }

Expand Down
2 changes: 1 addition & 1 deletion spec/unit/yardstick/rule/initialize_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
context 'when rule config is given' do
subject { described_class.new(document, config) }

let(:config) { Yardstick::RuleConfig.new(enabled: false) }
let(:config) { Yardstick::RuleConfig.new(:enabled => false) }

it { should be_a(described_class) }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
describe Yardstick::Rules::ApiTag::PrivateMethod, '#validatable?' do
subject { described_class.new(document).validatable? }

let(:document) { double('document', visibility: visibility) }
let(:document) { double('document', :visibility => visibility) }

context 'when protected visibility' do
let(:visibility) { :private }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
describe Yardstick::Rules::ApiTag::ProtectedMethod, '#validatable?' do
subject { described_class.new(document).validatable? }

let(:document) { double('document', visibility: visibility) }
let(:document) { double('document', :visibility => visibility) }

context 'when protected visibility' do
let(:visibility) { :protected }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
describe Yardstick::Rules::Summary::Delimiter, '#valid?' do
subject { described_class.new(document).valid? }

let(:document) { double('document', summary_text: text) }
let(:document) { double('document', :summary_text => text) }

context 'without a dot' do
let(:text) { 'A summary' }
Expand Down
Loading

0 comments on commit 469d530

Please sign in to comment.