swinger 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- swinger (0.0.1)
4
+ swinger (0.0.2)
5
5
  capybara (~> 0.3.0)
6
6
  rspec (>= 1.0.0)
7
7
 
@@ -3,7 +3,7 @@ h1. Swinger
3
3
  Swinger is a really simple "Capybara":http://github.com/jnicklas/capybara extension that aims to make driver switching in "RSpec":http://github.com/rspec/rspec a bit less horrible to look at. Using the new metadata feature in RSpec 2, you can simply set your @:driver@ per scenario or context:
4
4
 
5
5
  <pre><code>
6
- # `scenario` is an alias for `it` and `context` is an alias for `describe`, provided by Steak
6
+ # `scenario` is an alias for `it`, provided by Steak
7
7
 
8
8
  scenario 'get a nice greeting', :driver => :selenium do
9
9
  visit homepage
@@ -16,6 +16,7 @@ module Capybara
16
16
  def self.using_driver(driver)
17
17
  Capybara.current_driver = driver
18
18
  yield
19
+ ensure
19
20
  Capybara.use_default_driver
20
21
  end
21
22
 
@@ -22,19 +22,28 @@ describe 'Swinger' do
22
22
 
23
23
  describe Capybara do
24
24
 
25
+ before do
26
+ Capybara.current_driver.should_not == :selenium
27
+ end
28
+
25
29
  it 'should set the driver using Capybara.current_driver=' do
26
- Capybara.should_receive(:current_driver=).with(:selenium)
27
- Capybara.using_driver(:selenium) {}
30
+ driver = nil
31
+ Capybara.using_driver(:selenium) { driver = Capybara.current_driver }
32
+ driver.should == :selenium
28
33
  end
29
34
 
30
- it 'should reset the driver using Capybara.use_default_driver' do
31
- Capybara.should_receive(:use_default_driver)
32
- Capybara.using_driver(:selenium) {}
35
+ it 'should reset the driver using Capybara.use_default_driver, even if an exception occurs' do
36
+ begin
37
+ Capybara.using_driver(:selenium) { raise "ohnoes!" }
38
+ rescue Exception
39
+ end
40
+ Capybara.current_driver.should == Capybara.default_driver
33
41
  end
34
42
 
35
43
  it 'should yield the passed block' do
36
- Capybara.should_receive(:yeah)
37
- Capybara.using_driver(:selenium) { Capybara.yeah }
44
+ called = false
45
+ Capybara.using_driver(:selenium) { called = true }
46
+ called.should == true
38
47
  end
39
48
 
40
49
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "swinger"
5
- s.version = '0.0.1'
5
+ s.version = '0.0.2'
6
6
  s.platform = Gem::Platform::RUBY
7
7
  s.authors = ['Jeff Kreeftmeijer']
8
8
  s.email = ['jeff@kreeftmeijer.nl']
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: swinger
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jeff Kreeftmeijer