Skip to content

Instantly share code, notes, and snippets.

@YumaInaura
Last active November 27, 2015 09:59
Show Gist options
  • Select an option

  • Save YumaInaura/c9f6e47bf8a151424303 to your computer and use it in GitHub Desktop.

Select an option

Save YumaInaura/c9f6e47bf8a151424303 to your computer and use it in GitHub Desktop.
Rspec | メソッドチェーンの検証方法 ( expect_any_instance_of ) ref: http://qiita.com/Yinaura/items/678c5163c0aa6cba6272
{ name: 'John' }.to_a.class # => Array
require 'spec_helper'
describe do
it do
expect_any_instance_of(Hash).to receive(:to_a)
{ name: 'John' }.to_a
end
end
require 'spec_helper'
describe do
it do
expect_any_instance_of(Hash).to receive(:to_a)
expect_any_instance_of(Array).to receive(:to_s)
{ name: 'John' }.to_a.to_s
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment