1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00

Merge pull request #1288 from twalpole/issue_1285

Call describe on RSpec in feature definition - fix issue #1285
This commit is contained in:
Thomas Walpole 2014-04-03 12:04:19 -07:00
commit 44ab4b7e6b
14 changed files with 20 additions and 19 deletions

View file

@ -5,6 +5,7 @@ require 'capybara/rspec/matchers'
require 'capybara/rspec/features'
RSpec.configure do |config|
config.expose_dsl_globally = false if config.respond_to? :expose_dsl_globally
config.include Capybara::DSL, :type => :feature
config.include Capybara::RSpecMatchers, :type => :feature

View file

@ -21,7 +21,8 @@ def self.feature(*args, &block)
options[:caller] ||= caller
args.push(options)
describe(*args, &block)
#call describe on RSpec in case user has expose_dsl_globally set to false
RSpec.describe(*args, &block)
end
RSpec.configuration.include Capybara::Features, :capybara_feature => true

View file

@ -52,7 +52,7 @@ module Capybara
def run_specs(session, name, options={})
specs = @specs
describe Capybara::Session, name, options do
RSpec.describe Capybara::Session, name, options do
include Capybara::SpecHelper
before do
@session = session

View file

@ -1,6 +1,6 @@
require 'spec_helper'
describe Capybara do
RSpec.describe Capybara do
describe '.string' do
let :string do
Capybara.string <<-STRING

View file

@ -1,7 +1,6 @@
require 'spec_helper'
describe Capybara do
RSpec.describe Capybara do
describe 'default_wait_time' do
after do
Capybara.default_wait_time = @previous_default_time
@ -44,7 +43,7 @@ describe Capybara do
end
end
describe Capybara::Session do
RSpec.describe Capybara::Session do
context 'with non-existant driver' do
it "should raise an error" do
expect {

View file

@ -14,7 +14,7 @@ Capybara::SpecHelper.run_specs TestClass.new, "DSL", :capybara_skip => [
:hover
]
describe Capybara::DSL do
RSpec.describe Capybara::DSL do
after do
Capybara.session_name = nil
Capybara.default_driver = nil

View file

@ -1,6 +1,6 @@
require 'spec_helper'
describe Capybara::Selenium::Driver do
RSpec.describe Capybara::Selenium::Driver do
it "should exit with a non-zero exit status" do
browser = Capybara::Selenium::Driver.new(TestApp).browser
expect(true).to eq(false)

View file

@ -1,6 +1,6 @@
require 'spec_helper'
describe Capybara::Selenium::Driver do
RSpec.describe Capybara::Selenium::Driver do
it "should exit with a zero exit status" do
browser = Capybara::Selenium::Driver.new(TestApp).browser
expect(true).to eq(true)

View file

@ -13,7 +13,7 @@ Capybara::SpecHelper.run_specs TestSessions::RackTest, "RackTest", :capybara_ski
:hover
]
describe Capybara::Session do
RSpec.describe Capybara::Session do
context 'with rack test driver' do
before do
@session = TestSessions::RackTest
@ -70,7 +70,7 @@ describe Capybara::Session do
end
end
describe Capybara::RackTest::Driver do
RSpec.describe Capybara::RackTest::Driver do
before do
@driver = TestSessions::RackTest.driver
end
@ -165,7 +165,7 @@ module CSSHandlerIncludeTester
end
include CSSHandlerIncludeTester
describe Capybara::RackTest::CSSHandlers do
RSpec.describe Capybara::RackTest::CSSHandlers do
it "should not be extended by global includes" do
expect(Capybara::RackTest::CSSHandlers.new).not_to respond_to(:dont_extend_css_handler)
end

View file

@ -1,6 +1,6 @@
require 'spec_helper'
describe Capybara::Result do
RSpec.describe Capybara::Result do
let :string do
Capybara.string <<-STRING
<ul>

View file

@ -2,7 +2,7 @@ require 'spec_helper'
require 'capybara/dsl'
require 'capybara/rspec/matchers'
describe Capybara::RSpecMatchers do
RSpec.describe Capybara::RSpecMatchers do
include Capybara::DSL
include Capybara::RSpecMatchers

View file

@ -1,6 +1,6 @@
require 'spec_helper'
describe 'capybara/rspec', :type => :feature do
RSpec.describe 'capybara/rspec', :type => :feature do
it "should include Capybara in rspec" do
visit('/foo')
expect(page.body).to include('Another World')
@ -37,7 +37,7 @@ describe 'capybara/rspec', :type => :feature do
end
end
describe 'capybara/rspec', :type => :other do
RSpec.describe 'capybara/rspec', :type => :other do
it "should not include Capybara" do
expect { visit('/') }.to raise_error(NoMethodError)
end

View file

@ -17,7 +17,7 @@ Capybara::SpecHelper.run_specs TestSessions::Selenium, "selenium", :capybara_ski
:trigger
]
describe Capybara::Session do
RSpec.describe Capybara::Session do
context 'with selenium driver' do
before do
@session = TestSessions::Selenium
@ -66,7 +66,7 @@ describe Capybara::Session do
end
end
describe Capybara::Selenium::Driver do
RSpec.describe Capybara::Selenium::Driver do
before do
@driver = Capybara::Selenium::Driver.new(TestApp, browser: :firefox)
end

View file

@ -1,6 +1,6 @@
require 'spec_helper'
describe Capybara::Server do
RSpec.describe Capybara::Server do
it "should spool up a rack server" do
@app = proc { |env| [200, {}, ["Hello Server!"]]}