Skip to content

Commit

Permalink
Added params checking stub.
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-ahua authored and b264 committed Dec 5, 2014
1 parent a2cd960 commit 1b74fb7
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions features/step_definitions/filter_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,17 @@
step %{I should see a #{type} filter for "#{label}"}
end
end

Then(/^I should( not)? see parameter "([^"]*)" with value "([^"]*)"$/) do |negative, key, value|
uri_with_params= page.current_url.split('?')
params_string= (uri_with_params.length == 2) ? uri_with_params[1]: nil
expect(params_string).to_not be_nil
params= Hash.new
params_string.split('&').each do |pair|
params[pair.split('=')[0]]= pair.split('=')[1]
end
if params != nil
negative ? (expect(params[key]).to be_falsey)
: (expect(params[key]).to be_truthy) && (expect(params[key]).to eq(value))
end
end

0 comments on commit 1b74fb7

Please sign in to comment.