github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

hashrocket / unencumbered

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 60
    • 1
  • Source
  • Commits
  • Network (1)
  • Issues (0)
  • Downloads (4)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • Tags (4)
    • v0.1.1
    • v0.1.0
    • v0.0.6
    • v0.0.5
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

Just enough Cucumber in RSpec. — Read more

  cancel

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Version bump to 0.1.1 
Pairing Workstation Fry (author)
Mon Jan 25 12:44:43 -0800 2010
commit  42a9e983629fa52a90e6c9af3605d7e021f3ae41
tree    504d1ce1055da09970196a2b238db5e4e3a2d180
parent  4f2f27efcfeb32d7a1d7c8dc9d0d4484e0e898ac
unencumbered /
name age
history
message
file .document Mon Oct 05 14:18:09 -0700 2009 Initial commit to gherkinspec. [l4rk]
file .gitignore Mon Oct 05 14:18:09 -0700 2009 Initial commit to gherkinspec. [l4rk]
file LICENSE Mon Oct 05 14:59:42 -0700 2009 First real commit [l4rk]
file README.textile Tue Nov 03 18:43:12 -0800 2009 Tweak formatting [l4rk]
file Rakefile Thu Oct 29 10:13:04 -0700 2009 Rename to unencumbered, version bump to 0.0.5 [Jon Larkowski and Veezus Kreist]
file VERSION Mon Jan 25 12:46:43 -0800 2010 Version bump to 0.1.1 [Pairing Workstation Fry]
directory lib/ Mon Nov 23 12:52:45 -0800 2009 Factor out duplication [Jon Larkowski and Stephen Caudill]
directory spec/ Mon Nov 23 12:52:34 -0800 2009 Rename example_group_methods to example_group [Jon Larkowski and Stephen Caudill]
file unencumbered.gemspec Mon Jan 25 12:46:43 -0800 2010 Version bump to 0.1.1 [Pairing Workstation Fry]
README.textile

Unencumbered

You got Cucumber in my RSpec!

Write Cucumber-flavored integration tests as easily as you write your RSpec.

To Get Output Like This

Output from a rake spec:integration run:


User creates a vurl
  Scenario:  creating
    Given I am on the home page
      When I submit a valid vurl
        Then I should be on vurl stats page
        And I should see a success message
        And my vurl was successfully created

Make a Feature Like This

Put it in a spec file in the spec/integration folder. Here’s user_creates_vurl_spec.rb for example:


require File.expand_path('../../spec_helper', __FILE__)

Feature "User creates a vurl" do
  Scenario "creating" do
    Given "I am on the home page" do
      executes { visit root_path }

      When "I submit a valid vurl" do
        executes do
          fill_in "vurl_url", :with => 'http://example.com'
          click_button 'Vurlify!'
        end

        Then "I should be on the vurl stats page" do
          current_url.should == stats_url(Vurl.last.slug)
        end

        And "I should see a success message" do
          response.body.should include('Vurl was successfully created')
        end

        And "my vurl was created" do
          Vurl.last.url.should == 'http://example.com'
        end
      end
    end
  end
end

Set Up

Environment

Add this line to your config/environments/test.rb file. Make sure to use the :lib => false item. We need to require the library manually in the spec_helper.rb, since it patches RSpec.


config.gem "unencumbered", :lib => false, :version => 'x.x.x'

spec_helper.rb

Meld these lines into your existing spec/spec_helper.rb. Note the unencumbered require needs to be after your RSpec requires, since it patches RSpec.


require 'unencumbered'
require 'webrat'

Webrat.configure do |config|
  config.mode = :rails
end

Spec::Runner.configure do |config|

  [...your other config code...]

  config.include(Webrat::Matchers, :type => [:integration])
end

class ActionController::Integration::Session; include Spec::Matchers; end

spec.opts

RSpec’s nested format reads nicely. Put this line in your spec/spec.opts file.


--format nested

Copyright © 2009 Hashrocket. See LICENSE for details.

Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server