Ruby+Rspec method's arguments sequence check
<p>I try to test method, what will be happen if coming arguments sequence is incorrect. i have already checked for nil parameter.
my method accept id, new_name and i want to know what to do when parameters are new_name, id</p>

<p>Hope my question is clear.</p>

<p>Method which i want to test:</p>

<pre><code>def update_recipe(id, new_name)
  raise ArgumentError if id.nil? || new_name.nil?
  recipe = find_recipe_by_id(id).dup
  recipe.name = new_name
  @storage[id] = recipe
  recipe.freeze
end
</code></pre>

<p>Here is the rspec code:</p>

<pre><code>context 'when argument sequence is not correct' do
  let(:added_recipe) { subject.add_recipe recipe }

  it 'raises an ArgumentError' do
    expect { subject.update_recipe 'Pasta', added_recipe.id }.to raise_error ArgumentError
  end
end
</code></pre>