Skip to content

Commit

Permalink
Convert specs to RSpec 2.99.2 syntax with Transpec
Browse files Browse the repository at this point in the history
This conversion is done by Transpec 2.3.8 with the following command:
    transpec

* 103 conversions
    from: obj.should_receive(:message)
      to: expect(obj).to receive(:message)

* 24 conversions
    from: obj.should
      to: expect(obj).to

* 23 conversions
    from: obj.stub(:message)
      to: allow(obj).to receive(:message)

* 7 conversions
    from: obj.should_not_receive(:message)
      to: expect(obj).not_to receive(:message)

* 6 conversions
    from: be_false
      to: be_falsey

* 6 conversions
    from: be_true
      to: be_truthy

* 5 conversions
    from: == expected
      to: eq(expected)

* 5 conversions
    from: obj.unstub(:message)
      to: allow(obj).to receive(:message).and_call_original

* 1 conversion
    from: obj.should have(n).watchers
      to: expect(obj.watchers.size).to eq(n)

For more details: https://github.com/yujinakayama/transpec#supported-conversions
  • Loading branch information
e2 committed Dec 6, 2014
1 parent 18ef5e8 commit 15990d9
Show file tree
Hide file tree
Showing 6 changed files with 166 additions and 166 deletions.
10 changes: 5 additions & 5 deletions spec/guard/coffeescript/formatter_spec.rb
Expand Up @@ -8,36 +8,36 @@

describe '.info' do
it 'shows an info message' do
ui.should_receive(:info).with('Info message', { :reset => true })
expect(ui).to receive(:info).with('Info message', { :reset => true })
formatter.info('Info message', { :reset => true })
end
end

describe '.debug' do
it 'shows a debug message' do
ui.should_receive(:debug).with('Debug message', { :reset => true })
expect(ui).to receive(:debug).with('Debug message', { :reset => true })
formatter.debug('Debug message', { :reset => true })
end
end

describe '.error' do
it 'shows a colorized error message' do
ui.should_receive(:error).with("\e[0;31mError message\e[0m", { :reset => true })
expect(ui).to receive(:error).with("\e[0;31mError message\e[0m", { :reset => true })
formatter.error('Error message', { :reset => true })
end
end

describe '.success' do
it 'shows a colorized success message with a timestamp' do
expected_success_message = %r{^\e\[0;32m\d{2}:\d{2}:\d{2} (AM|PM) Success message\e\[0m$}
ui.should_receive(:info).with(expected_success_message, { :reset => true })
expect(ui).to receive(:info).with(expected_success_message, { :reset => true })
formatter.success('Success message', { :reset => true })
end
end

describe '.notify' do
it 'shows an info message' do
notifier.should_receive(:notify).with('Notify message', { :image => :failed })
expect(notifier).to receive(:notify).with('Notify message', { :image => :failed })
formatter.notify('Notify message', { :image => :failed })
end
end
Expand Down
36 changes: 18 additions & 18 deletions spec/guard/coffeescript/inspector_spec.rb
Expand Up @@ -5,36 +5,36 @@

describe 'clean' do
it 'removes duplicate files' do
File.should_receive(:exists?).with("a.coffee").and_return true
File.should_receive(:exists?).with("b.coffee.md").and_return true
File.should_receive(:exists?).with("c.litcoffee").and_return true
inspector.clean(['a.coffee', 'a.coffee', 'b.coffee.md', 'b.coffee.md', 'c.litcoffee', 'c.litcoffee'])
.should == ['a.coffee', 'b.coffee.md', 'c.litcoffee']
expect(File).to receive(:exists?).with("a.coffee").and_return true
expect(File).to receive(:exists?).with("b.coffee.md").and_return true
expect(File).to receive(:exists?).with("c.litcoffee").and_return true
expect(inspector.clean(['a.coffee', 'a.coffee', 'b.coffee.md', 'b.coffee.md', 'c.litcoffee', 'c.litcoffee']))
.to eq(['a.coffee', 'b.coffee.md', 'c.litcoffee'])
end

it 'remove nil files' do
File.should_receive(:exists?).with("a.coffee").and_return true
File.should_receive(:exists?).with("b.coffee.md").and_return true
File.should_receive(:exists?).with("c.litcoffee").and_return true
inspector.clean(['a.coffee', 'b.coffee.md', 'c.litcoffee', nil])
.should == ['a.coffee', 'b.coffee.md', 'c.litcoffee']
expect(File).to receive(:exists?).with("a.coffee").and_return true
expect(File).to receive(:exists?).with("b.coffee.md").and_return true
expect(File).to receive(:exists?).with("c.litcoffee").and_return true
expect(inspector.clean(['a.coffee', 'b.coffee.md', 'c.litcoffee', nil]))
.to eq(['a.coffee', 'b.coffee.md', 'c.litcoffee'])
end

describe 'without the :missing_ok option' do
it 'removes non-coffee files that do not exist' do
File.should_receive(:exists?).with("a.coffee").and_return true
File.should_receive(:exists?).with("c.litcoffee").and_return true
File.should_receive(:exists?).with("d.coffee.md").and_return true
File.should_receive(:exists?).with("doesntexist.coffee").and_return false
inspector.clean(['a.coffee', 'b.txt', 'doesntexist.coffee', 'c.litcoffee', 'd.coffee.md'])
.should == ['a.coffee', 'c.litcoffee', 'd.coffee.md']
expect(File).to receive(:exists?).with("a.coffee").and_return true
expect(File).to receive(:exists?).with("c.litcoffee").and_return true
expect(File).to receive(:exists?).with("d.coffee.md").and_return true
expect(File).to receive(:exists?).with("doesntexist.coffee").and_return false
expect(inspector.clean(['a.coffee', 'b.txt', 'doesntexist.coffee', 'c.litcoffee', 'd.coffee.md']))
.to eq(['a.coffee', 'c.litcoffee', 'd.coffee.md'])
end
end

describe 'with the :missing_ok options' do
it 'removes non-coffee files' do
inspector.clean(['a.coffee', 'b.txt', 'doesntexist.coffee', 'c.litcoffee', 'd.coffee.md'], { :missing_ok => true })
.should == ['a.coffee', 'doesntexist.coffee', 'c.litcoffee', 'd.coffee.md']
expect(inspector.clean(['a.coffee', 'b.txt', 'doesntexist.coffee', 'c.litcoffee', 'd.coffee.md'], { :missing_ok => true }))
.to eq(['a.coffee', 'doesntexist.coffee', 'c.litcoffee', 'd.coffee.md'])
end
end

Expand Down

0 comments on commit 15990d9

Please sign in to comment.