Skip to content

Commit

Permalink
Replace usages of OpenStruct in specs to double()
Browse files Browse the repository at this point in the history
  • Loading branch information
mmozuras committed Sep 10, 2014
1 parent befc3e7 commit 62c3ea9
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion spec/pronto/formatter/checkstyle_formatter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module Formatter

describe '#format' do
subject { checkstyle_formatter.format(messages, nil) }
let(:line) { OpenStruct.new(new_lineno: 1) }
let(:line) { double(new_lineno: 1, commit_sha: '123') }
let(:error) { Message.new('path/to', line, :error, 'Line Error') }
let(:warning) { Message.new('path/to', line, :warning, 'Line Warning') }
let(:messages) { [error, warning] }
Expand Down
1 change: 0 additions & 1 deletion spec/pronto/formatter/formatter_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
require 'spec_helper'
require 'ostruct'

module Pronto
module Formatter
Expand Down
2 changes: 1 addition & 1 deletion spec/pronto/formatter/github_formattter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module Formatter
let(:messages) { [message, message] }
let(:repository) { Pronto::Git::Repository.new('.') }
let(:message) { Message.new('path/to', line, :warning, 'crucial') }
let(:line) { OpenStruct.new(new_lineno: 1) }
let(:line) { double(new_lineno: 1, commit_sha: '123', position: nil) }
before { line.stub(:commit_line).and_return(line) }

specify do
Expand Down
2 changes: 1 addition & 1 deletion spec/pronto/formatter/json_formatter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module Formatter
subject { json_formatter.format(messages, nil) }
let(:messages) { [message, message] }
let(:message) { Message.new('path/to', line, :warning, 'crucial') }
let(:line) { OpenStruct.new(new_lineno: 1) }
let(:line) { double(new_lineno: 1, commit_sha: nil) }

it { should == '[{"level":"W","message":"crucial","path":"path/to","line":1},{"level":"W","message":"crucial","path":"path/to","line":1}]' }

Expand Down
2 changes: 1 addition & 1 deletion spec/pronto/formatter/text_formatter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module Formatter
subject { text_formatter.format(messages, nil) }
let(:messages) { [message, message] }
let(:message) { Message.new('path/to', line, :warning, 'crucial') }
let(:line) { OpenStruct.new(new_lineno: 1) }
let(:line) { double(new_lineno: 1, commit_sha: '123') }

its(:count) { should == 2 }
its(:first) { should == 'path/to:1 W: crucial' }
Expand Down
1 change: 0 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require 'rspec'
require 'rspec/its'
require 'pry'
require 'ostruct'

require 'pronto'

Expand Down

0 comments on commit 62c3ea9

Please sign in to comment.