0
index
メソッドに2つの配列があるが、配列の長さの等価性をテストしたいが、機能しない(手作業でテストした後に配列の長さが等しい)rpecの配列(インスタンス変数)の長さを確認
def index
@countries = get_countries()
@capitals = get_capitals()
end
RSpecのファイル:
describe CountriesController do
describe 'index' do
it 'countries.length == capitals.length' do
expect(assigns(countries.length)).to eq (assigns(capitals.length))
end
end
end
2つの配列の長さを互いに比較する[\ 'rspec \ ']の可能な複製](http://stackoverflow.com/questions/38579733/rspec-comparing-two-arrays-lengths-against-each-other ) –