Sha256: 141db32560f6f8ff337fb67865d4000047bb3cf50321e3323904e4dbd8a0130e

Contents?: true

Size: 1.36 KB

Versions: 39

Compression:

Stored size: 1.36 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

$:.unshift(File.dirname(__FILE__) + '/../stubs')
require "mini_rails"

require 'cucumber/rails/world'
require 'cucumber/rails/rspec'
Cucumber::Rails::World.class_eval do
  include Dataset
end

describe Cucumber::Rails::World do
  
  it 'should have a dataset method' do
    world = Class.new(Cucumber::Rails::World)
    world.should respond_to(:dataset)
  end
  
  it 'should load the dataset when the feature is run' do
    load_count = 0
    my_dataset = Class.new(Dataset::Base) do
      define_method(:load) do
        load_count += 1
      end
    end
    
    step_mother = Object.new
    step_mother.extend(Cucumber::StepMother)
    $__cucumber_toplevel = step_mother
    step_mother.World do |world|
      world = Cucumber::Rails::World.new
      world.class.dataset(my_dataset)
      world
    end
    step_mother.Given /true is true/ do |n|
      true.should == true
    end
    visitor = Cucumber::Ast::Visitor.new(step_mother)
    
    scenario = Cucumber::Ast::Scenario.new(
      background=nil,
      comment=Cucumber::Ast::Comment.new(""),
      tags=Cucumber::Ast::Tags.new(98, []), 
      line=99,
      keyword="",
      name="", 
      steps=[
        Cucumber::Ast::Step.new(8, "Given", "true is true")
      ])
    visitor.visit_feature_element(scenario)
    
    load_count.should be(1)
  end
end

Version data entries

39 entries across 39 versions & 6 rubygems

Version Path
radiant-1.1.4 vendor/plugins/dataset/spec/dataset/cucumber_spec.rb
radiant-1.1.3 vendor/plugins/dataset/spec/dataset/cucumber_spec.rb
radiant-1.1.2 vendor/plugins/dataset/spec/dataset/cucumber_spec.rb
radiant-1.1.1 vendor/plugins/dataset/spec/dataset/cucumber_spec.rb
radiant-1.1.0 vendor/plugins/dataset/spec/dataset/cucumber_spec.rb
radiant-1.1.0.rc1 vendor/plugins/dataset/spec/dataset/cucumber_spec.rb
radiant-1.1.0.beta vendor/plugins/dataset/spec/dataset/cucumber_spec.rb
radiant-1.0.1 vendor/plugins/dataset/spec/dataset/cucumber_spec.rb
radiant-1.1.0.alpha vendor/plugins/dataset/spec/dataset/cucumber_spec.rb
radiant-1.0.0 vendor/plugins/dataset/spec/dataset/cucumber_spec.rb
radiant-1.0.0.rc5 vendor/plugins/dataset/spec/dataset/cucumber_spec.rb
radiant-1.0.0.rc4 vendor/plugins/dataset/spec/dataset/cucumber_spec.rb
radiant-1.0.0.rc3 vendor/plugins/dataset/spec/dataset/cucumber_spec.rb
kajam-1.0.3.rc2 vendor/plugins/dataset/spec/dataset/cucumber_spec.rb
radiant-1.0.0.rc2 vendor/plugins/dataset/spec/dataset/cucumber_spec.rb
radiant-1.0.0.rc1 vendor/plugins/dataset/spec/dataset/cucumber_spec.rb
codders-dataset-1.3.2.1 spec/dataset/cucumber_spec.rb
radiantcms-couchrest_model-0.2.4 vendor/plugins/dataset/spec/dataset/cucumber_spec.rb
radiantcms-couchrest_model-0.2.2 vendor/plugins/dataset/spec/dataset/cucumber_spec.rb
radiantcms-couchrest_model-0.2.1 vendor/plugins/dataset/spec/dataset/cucumber_spec.rb