Sha256: c2935f44a1d7f75468b7b9d2d04d5289ea8e78971786bb4ac7a59a8794f727de

Contents?: true

Size: 1.52 KB

Versions: 9

Compression:

Stored size: 1.52 KB

Contents

require 'spec_helper'
require 'capybara/rspec'

RSpec.configuration.before(:each, :example_group => {:file_path => "./spec/rspec/features_spec.rb"}) do
  @in_filtered_hook = true
end

feature "Capybara's feature DSL" do
  background do
    @in_background = true
  end

  scenario "includes Capybara" do
    visit('/')
    page.should have_content('Hello world!')
  end

  scenario "preserves description" do
    example.metadata[:full_description].should == "Capybara's feature DSL preserves description"
  end

  scenario "allows driver switching", :driver => :selenium do
    Capybara.current_driver.should == :selenium
  end

  scenario "runs background" do
    @in_background.should be_true
  end

  scenario "runs hooks filtered by file path" do
    @in_filtered_hook.should be_true
  end

  scenario "doesn't pollute the Object namespace" do
    Object.new.respond_to?(:feature, true).should be_false
  end
end

feature "given and given! aliases to let and let!" do
  given(:value) { :available }
  given!(:value_in_background) { :available }

  background do
    value_in_background.should be(:available)
  end

  scenario "given and given! work as intended" do
    value.should be(:available)
    value_in_background.should be(:available)
  end
end

feature "if xscenario aliases to pending then" do
  xscenario "this test should be 'temporarily disabled with xscenario'" do
  end
end

feature "Capybara's feature DSL with driver", :driver => :culerity do
  scenario "switches driver" do
    Capybara.current_driver.should == :culerity
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
swipe-rails-0.0.5 vendor/bundle/gems/capybara-2.1.0/spec/rspec/features_spec.rb
capybara-2.1.0 spec/rspec/features_spec.rb
capybara-2.1.0.rc1 spec/rspec/features_spec.rb
capybara-2.0.3 spec/rspec/features_spec.rb
capybara-2.1.0.beta1 spec/rspec/features_spec.rb
capybara-2.0.2 spec/rspec/features_spec.rb
capybara-2.0.1 spec/rspec/features_spec.rb
capybara-2.0.0 spec/rspec/features_spec.rb
capybara-2.0.0.beta4 spec/rspec/features_spec.rb