Skip to content
This repository
tree: 0c044d0b1a
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 38 lines (30 sloc) 0.898 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
Given /^a (?:|derived )widget named "(.+)"$/ do |widget_name|
  @widget = Widget.create!(:name => widget_name)
end

Given /^I own a widget named "(.+)"$/ do |widget_name|
  @widget = Widget.create!(:name => widget_name, :user_id => 42)
end

Given /^the following widgets:$/ do |table|
  table.hashes.each do |widget_hash|
    Widget.create!(widget_hash)
  end
end

When /^I view the (derived )?widget$/ do |derived|
  if derived
    visit derived_widget_path(@widget)
  else
    visit widget_path(@widget)
  end
end

When /^I edit the widget$/ do
  visit edit_widget_path(@widget)
end

When /^I view all widgets$/ do
  visit widgets_path
end

When /^I view all widgets and there is an id in params$/ do
  visit widgets_path(:id => @widget.id)
end

When /^I view page (\d+) of all widgets(?: with (\d+) per page)?$/ do |page, per_page|
  visit widgets_path(:page => page, :per_page => per_page)
end
Something went wrong with that request. Please try again.