This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def undefine_task(*names) | |
| app = Rake.application | |
| tasks = app.instance_variable_get('@tasks') | |
| names.flatten.each { |name| tasks.delete(name) } | |
| end | |
| undefine_task('spec') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| gem 'term-ansicolor' | |
| require 'term/ansicolor' | |
| if Cucumber::WINDOWS_MRI | |
| begin | |
| gem 'win32console', '>= 1.2.0' | |
| require 'Win32/Console/ANSI' | |
| rescue LoadError | |
| STDERR.puts %{*** WARNING: You must "gem install win32console" (1.2.0 or higher) to get coloured output on MRI/Windows} | |
| Term::ANSIColor.coloring = false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module TestMe | |
| attr_accessor :poo | |
| end | |
| ... | |
| step_mother.World do |w| | |
| w.extend(TestMe) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #cucumber --require pdf_formatter.rb --quiet --dry-run --format Cucumber::Formatter::Pdf features/ | |
| require 'cucumber/formatter/console' | |
| require 'prawn' | |
| class PdfIO | |
| def initialize | |
| @pdf = Prawn::Document.new :page_size => "A4", :top_margin => 60 | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| desc "Run cucumber features with real browser" | |
| task :browser => ['features:start', 'cuke_browser'] | |
| Cucumber::Rake::Task.new(:cuke_browser) do |t| | |
| t.cucumber_opts = "--profile browser" | |
| t.feature_list = [] | |
| t.step_list = [] | |
| end | |
| namespace :features do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| require 'rubygems' | |
| require 'trollop' | |
| config = {:step_type => 'Given,When,Then'} | |
| opts = Trollop.options do | |
| opt :step_type, "Given, When or Then", :type => :string, :default => config[:step_type] | |
| end | |
| term = ARGV.last | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # the feature we are trying features/manage_cukes.feature | |
| Feature: Manage cukes | |
| In order to use scenario outlines | |
| everything should work | |
| Scenario Outline: Testing scenario outlines # examples/tickets/test.feature:6 | |
| Given there are <cuke_versions> | |
| Examples: | |
| | cuke_versions | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # trying out the scenario outlines cucumber feature | |
| $ gem list cucumber; gem list webrat | |
| *** LOCAL GEMS *** | |
| cucumber (0.1.16) | |
| webrat (0.4.1) | |
| # the feature we are trying features/manage_cukes.feature | |
| Feature: Manage cukes | |
| In order to use scenario outlines |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Feature: backgrounds | |
| In order to provide a context to my scenarios within a feature | |
| As a feature editor | |
| I want to write a background section in my features. | |
| Scenario: run a feature with a background that passes | |
| When I run cucumber -q features/passing_background.feature | |
| Then it should pass with | |
| """ | |
| Feature: sample |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Scenario Outline: passing background | |
| Then I should have '<count>' cukes | |
| Examples: | |
| | count | | |
| | Background: | |
| Given '10' cukes | |
| 10 | |