capybara-restore_state 1.0.0 → 1.0.1
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.
- checksums.yaml +5 -5
- data/CHANGELOG +4 -0
- data/Rakefile +16 -27
- data/lib/capybara/restore_state.rb +2 -1
- metadata +22 -6
- data/spec/capybara-restore_state_spec.rb +0 -43
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 794692cb3a7278028069ff9a30e7313736b3a7394440924e021265122b6b4029
|
4
|
+
data.tar.gz: 66eaa679887ed1d7822b93882fc43d6fdbffd2f79b739c60d64fe2da098bd728
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee80045fca52c72aa433bd11c97ece4664bac495941b4e69b9c2681fbe3865c85986b32ac7f2a1e27575baad1baad93701fccb22a7f719c900c840498824dc7f
|
7
|
+
data.tar.gz: ba9ead11dbb66abd8f1828dbae5da5e46f080b9667a8da95e9c61d31dad4cad19476d42a3e8269d10bade9302966b0c15d5994f4ca9120d85cc416db61ca8357
|
data/CHANGELOG
CHANGED
data/Rakefile
CHANGED
@@ -1,14 +1,8 @@
|
|
1
|
-
require "rake"
|
2
1
|
require "rake/clean"
|
3
|
-
require
|
2
|
+
require "rdoc/task"
|
4
3
|
|
5
4
|
CLEAN.include ["capybara-restore_state-*.gem", "rdoc", "coverage"]
|
6
5
|
|
7
|
-
desc "Build enum_csv gem"
|
8
|
-
task :package=>[:clean] do |p|
|
9
|
-
sh %{#{FileUtils::RUBY} -S gem build capybara-restore_state.gemspec}
|
10
|
-
end
|
11
|
-
|
12
6
|
### Specs
|
13
7
|
|
14
8
|
desc "Run specs"
|
@@ -16,31 +10,26 @@ task :default=>:spec
|
|
16
10
|
|
17
11
|
desc "Run specs"
|
18
12
|
task :spec do
|
19
|
-
sh "#{FileUtils::RUBY} spec/capybara-restore_state_spec.rb"
|
20
|
-
end
|
21
|
-
### RDoc
|
22
|
-
|
23
|
-
RDOC_DEFAULT_OPTS = ["--quiet", "--line-numbers", "--inline-source", '--title', 'capybara-restore_state: Restore capybara state after block execution']
|
24
|
-
|
25
|
-
begin
|
26
|
-
gem 'hanna-nouveau'
|
27
|
-
RDOC_DEFAULT_OPTS.concat(['-f', 'hanna'])
|
28
|
-
rescue Gem::LoadError
|
13
|
+
sh "#{FileUtils::RUBY} #{'-w' if RUBY_VERSION >= '3'} spec/capybara-restore_state_spec.rb"
|
29
14
|
end
|
30
15
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
require "rake/rdoctask"
|
36
|
-
Rake::RDocTask
|
16
|
+
desc "Run tests with coverage"
|
17
|
+
task :spec_cov do
|
18
|
+
ENV['COVERAGE'] = '1'
|
19
|
+
sh "#{FileUtils::RUBY} spec/capybara-restore_state_spec.rb"
|
37
20
|
end
|
38
21
|
|
39
|
-
|
22
|
+
### RDoc
|
40
23
|
|
41
|
-
|
24
|
+
RDoc::Task.new do |rdoc|
|
42
25
|
rdoc.rdoc_dir = "rdoc"
|
43
|
-
rdoc.options +=
|
26
|
+
rdoc.options += ["--quiet", "--line-numbers", "--inline-source", '--title', 'capybara-restore_state: Restore capybara state after block execution', '--main', 'README.rdoc']
|
27
|
+
|
28
|
+
begin
|
29
|
+
gem 'hanna-nouveau'
|
30
|
+
rdoc.options += ['-f', 'hanna']
|
31
|
+
rescue Gem::LoadError
|
32
|
+
end
|
33
|
+
|
44
34
|
rdoc.rdoc_files.add %w"README.rdoc CHANGELOG MIT-LICENSE lib/**/*.rb"
|
45
35
|
end
|
46
|
-
|
@@ -3,7 +3,8 @@ require 'capybara'
|
|
3
3
|
module Capybara::RestoreState
|
4
4
|
# Yield to the block, restoring the capybara session state after block execution.
|
5
5
|
def restore_state
|
6
|
-
|
6
|
+
browser = page.driver.browser
|
7
|
+
mock_session = browser.instance_variable_get(:@_rack_test_current_session) || browser.instance_variable_get(:@_rack_mock_sessions)[:default]
|
7
8
|
last_response = mock_session.last_response
|
8
9
|
last_request = mock_session.last_request
|
9
10
|
yield
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capybara-restore_state
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Evans
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-06-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack-test
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 2.1.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest-global_expectations
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
description: |
|
42
56
|
capybara-restore_state offers the ability to execute a block where the
|
43
57
|
initial capybara state on entering the block is returned after the block
|
@@ -56,11 +70,14 @@ files:
|
|
56
70
|
- README.rdoc
|
57
71
|
- Rakefile
|
58
72
|
- lib/capybara/restore_state.rb
|
59
|
-
- spec/capybara-restore_state_spec.rb
|
60
73
|
homepage: http://github.com/jeremyevans/capybara-restore_state
|
61
74
|
licenses:
|
62
75
|
- MIT
|
63
|
-
metadata:
|
76
|
+
metadata:
|
77
|
+
source_code_uri: https://github.com/jeremyevans/capybara-restore_state
|
78
|
+
bug_tracker_uri: https://github.com/jeremyevans/capybara-restore_state/issues
|
79
|
+
mailing_list_uri: https://github.com/jeremyevans/capybara-restore_state/discussions
|
80
|
+
changelog_uri: https://github.com/jeremyevans/capybara-restore_state/blob/master/CHANGELOG
|
64
81
|
post_install_message:
|
65
82
|
rdoc_options:
|
66
83
|
- "--quiet"
|
@@ -83,8 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
100
|
- !ruby/object:Gem::Version
|
84
101
|
version: '0'
|
85
102
|
requirements: []
|
86
|
-
|
87
|
-
rubygems_version: 2.5.1
|
103
|
+
rubygems_version: 3.3.7
|
88
104
|
signing_key:
|
89
105
|
specification_version: 4
|
90
106
|
summary: Restore capybara state after block execution
|
@@ -1,43 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
gem 'minitest'
|
3
|
-
require 'minitest/spec'
|
4
|
-
require 'minitest/autorun'
|
5
|
-
require 'capybara'
|
6
|
-
require 'capybara/dsl'
|
7
|
-
require './lib/capybara/restore_state'
|
8
|
-
|
9
|
-
MyRackApp = lambda do |env|
|
10
|
-
s = "<html><body><form action='/a'>#{env['PATH_INFO']}<input type='submit' value='Submit' /></form></body></html>"
|
11
|
-
[200, {'Content-Length'=>s.length}, s]
|
12
|
-
end
|
13
|
-
Capybara.app = MyRackApp
|
14
|
-
|
15
|
-
describe Capybara::RestoreState do
|
16
|
-
include Rack::Test::Methods
|
17
|
-
include Capybara::DSL
|
18
|
-
include Capybara::RestoreState
|
19
|
-
|
20
|
-
def app
|
21
|
-
MyRackApp
|
22
|
-
end
|
23
|
-
|
24
|
-
it "should allow restoring of state" do
|
25
|
-
visit '/'
|
26
|
-
page.current_path.must_equal '/'
|
27
|
-
page.text.must_equal '/'
|
28
|
-
|
29
|
-
restore_state do
|
30
|
-
page.text.must_equal '/'
|
31
|
-
page.current_path.must_equal '/'
|
32
|
-
click_button 'Submit'
|
33
|
-
page.current_path.must_equal '/a'
|
34
|
-
page.text.must_equal '/a'
|
35
|
-
end
|
36
|
-
|
37
|
-
page.current_path.must_equal '/'
|
38
|
-
page.text.must_equal '/'
|
39
|
-
click_button 'Submit'
|
40
|
-
page.current_path.must_equal '/a'
|
41
|
-
page.text.must_equal '/a'
|
42
|
-
end
|
43
|
-
end
|