Skip to content

Instantly share code, notes, and snippets.

@ashmoran
Created December 8, 2011 12:20
Show Gist options
  • Save ashmoran/1446833 to your computer and use it in GitHub Desktop.
Save ashmoran/1446833 to your computer and use it in GitHub Desktop.
An example of a Cucumber-like RSpec syntax I'm using at the moment
require 'spec_helper'
require 'spec/environments/mongoid'
require 'spec/environments/capybara'
feature "Edit Report: Locking", js: true, full_backtrace: true, wip: true do
include Capybara::DSL
include AcceptanceDSL
before(:each) do
Capybara.run_server = false
Capybara.app_host = "http://localhost:3100"
end
background do
given_ a_minimal_database
and_ a_full_report in_state: "draft"
and_ an_admin_user
and_ i_am_logged_in_as_an_admin_user
end
scenario "Viewing the report list" do
given_ i_can_see_the_reports
then_ the_report_can_be_checked_out
and_ the_report_cant_be_edited
end
def i_can_see_the_reports
visit "/admin/reports"
end
def the_report_can_be_checked_out
within_table_row_with_cell("First report") do
page.should have_link("Check out")
end
end
def the_report_cant_be_edited
within_table_row_with_cell("First report") do
page.should_not have_link("Edit")
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment