activerecord-tablefree 3.0.1 → 3.1.0
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 +4 -4
- data/Appraisals +6 -6
- data/Gemfile +3 -3
- data/README.md +9 -25
- data/Rakefile +12 -12
- data/activerecord-tablefree.gemspec +17 -17
- data/features/step_definitions/rails_steps.rb +32 -35
- data/features/step_definitions/tablefree.rb +6 -6
- data/features/step_definitions/web_steps.rb +9 -10
- data/features/support/env.rb +3 -3
- data/features/support/paths.rb +4 -4
- data/features/support/rails.rb +5 -6
- data/features/support/selectors.rb +4 -4
- data/lib/activerecord-tablefree.rb +58 -141
- data/lib/activerecord-tablefree/cast_type.rb +28 -0
- data/lib/activerecord-tablefree/connection.rb +70 -0
- data/lib/activerecord-tablefree/schema_cache.rb +7 -0
- data/lib/activerecord-tablefree/transaction.rb +4 -0
- data/lib/activerecord-tablefree/version.rb +1 -3
- data/spec/lib/activerecord-tablefree_spec.rb +149 -122
- data/spec/spec_helper.rb +1 -1
- metadata +36 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bcf2aa444df8b82ef32f91818957b4f9deac9ceb
|
4
|
+
data.tar.gz: 5e28ee5eeff06cae3b1119eb1d1bbe5597cc57f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0faddb4c4c110e0b817d3268ea9540c62d3f70d57248562d88fd452dd8dfed3af1c3829a989943ae512ea5fba041a17422c1abbcf691a65469085acd6bd59cb3
|
7
|
+
data.tar.gz: 484fc796ae9253cf37a618df9ee9de352ad45d7fa5cf1751891cdcc6bc40aac411dbfd9800864656594c0a4864e6e17813298a9216b1ade2410b1e9ed4ae6713
|
data/Appraisals
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
#-*- ruby -*-
|
2
2
|
|
3
|
-
appraise
|
4
|
-
gem
|
5
|
-
gem
|
3
|
+
appraise 'rails50' do
|
4
|
+
gem 'rails', '~> 5.0.0'
|
5
|
+
gem 'jquery-rails'
|
6
6
|
end
|
7
7
|
|
8
|
-
appraise
|
9
|
-
gem
|
10
|
-
gem
|
8
|
+
appraise 'rails51' do
|
9
|
+
gem 'rails', '~> 5.1.0'
|
10
|
+
gem 'jquery-rails'
|
11
11
|
end
|
data/Gemfile
CHANGED
@@ -3,6 +3,6 @@ source 'https://rubygems.org'
|
|
3
3
|
# Specify your gem's dependencies in utf8_enforcer_workaround.gemspec
|
4
4
|
gemspec
|
5
5
|
|
6
|
-
gem
|
7
|
-
gem
|
8
|
-
gem
|
6
|
+
gem 'byebug'
|
7
|
+
gem 'mime-types', '< 2.0', platform: :ruby_18
|
8
|
+
gem 'rubyzip', '< 1.0', platform: :ruby_18
|
data/README.md
CHANGED
@@ -9,12 +9,11 @@ ActiveRecord Tablefree
|
|
9
9
|
| version | [](http://badge.fury.io/rb/activerecord-tablefree) |
|
10
10
|
| dependencies | [](https://gemnasium.com/github.com/boltthreads/activerecord-tablefree) |
|
11
11
|
| code quality | [](https://codeclimate.com/github/boltthreads/activerecord-tablefree) |
|
12
|
-
| continuous integration | [](https://travis-ci.org/boltthreads/activerecord-tablefree) |
|
13
13
|
| test coverage | [](https://coveralls.io/github/boltthreads/activerecord-tablefree?branch=master) |
|
14
|
-
| triage helpers | [](https://www.codetriage.com/boltthreads/activerecord-tablefree) |
|
15
15
|
| homepage | [https://github.com/boltthreads/activerecord-tablefree](https://github.com/boltthreads/activerecord-tablefree) |
|
16
16
|
| documentation | [http://rdoc.info/github/boltthreads/activerecord-tablefree/frames](http://rdoc.info/github/boltthreads/activerecord-tablefree/frames) |
|
17
|
-
| readme hit counter | [](https://ghit.me/repo/boltthreads/activerecord-tablefree) |
|
18
17
|
|
19
18
|
A simple implementation of the ActiveRecord Tableless pattern for any
|
20
19
|
Rails project or other Ruby project that uses ActiveRecord.
|
@@ -35,7 +34,7 @@ be used in your app.
|
|
35
34
|
|
36
35
|
Include the gem in your Gemfile:
|
37
36
|
|
38
|
-
gem "activerecord-tablefree", "~>
|
37
|
+
gem "activerecord-tablefree", "~> 3.0"
|
39
38
|
|
40
39
|
|
41
40
|
Supported Versions
|
@@ -43,33 +42,18 @@ Supported Versions
|
|
43
42
|
|
44
43
|
Supported ruby version are
|
45
44
|
|
46
|
-
* **2.2.x** series higher than 2.2.2
|
45
|
+
* **2.2.x** series higher than 2.2.2 (a Rails 5 requirement)
|
47
46
|
* **2.3.x** series
|
48
|
-
|
49
|
-
If you are using Ruby version < 2.2.2 you can use the gem version <
|
50
|
-
2.0 like this
|
51
|
-
|
52
|
-
gem "activerecord-tablefree", "~> 1.0.0"
|
47
|
+
* **2.4.x** series
|
53
48
|
|
54
49
|
Supported ActiveRecord versions are
|
55
50
|
|
56
|
-
* **
|
57
|
-
* **
|
58
|
-
* **4.1.x** series
|
59
|
-
* **4.2.x** series
|
60
|
-
|
61
|
-
If you are using ActiveRecord 2.3.x series you can use the gem version <
|
62
|
-
2.0 like this
|
63
|
-
|
64
|
-
gem "activerecord-tablefree", "~> 1.0.0"
|
65
|
-
|
66
|
-
You may be able to make it work with 3.1.x, but you should expect to
|
67
|
-
put some time in it.
|
51
|
+
* **5.0.x** series
|
52
|
+
* **5.1.x** series
|
68
53
|
|
69
|
-
|
70
|
-
----
|
54
|
+
If you are using an older ActiveRecord version you can use the gem [`activerecord-tableless`](https://github.com/softace/activerecord-tableless)
|
71
55
|
|
72
|
-
|
56
|
+
This gem tries to maintain the same API as the older `activerecord-tableless` gem.
|
73
57
|
|
74
58
|
Usage
|
75
59
|
-----
|
data/Rakefile
CHANGED
@@ -5,16 +5,16 @@ require 'rspec/core/rake_task'
|
|
5
5
|
require 'cucumber/rake/task'
|
6
6
|
|
7
7
|
desc 'Default: clean, all.'
|
8
|
-
task :
|
8
|
+
task default: %i[clean all]
|
9
9
|
|
10
10
|
desc 'Test the activerecord-tablefree on all supported Rails versions.'
|
11
|
-
task :all do |
|
11
|
+
task :all do |_t|
|
12
12
|
# TODO: cucumber feature specs appear to be written for Rails 2, and will need an overhaul for Rails 5.
|
13
13
|
if ENV['BUNDLE_GEMFILE']
|
14
14
|
exec('rake test spec')
|
15
15
|
# exec('rake test spec cucumber')
|
16
16
|
else
|
17
|
-
Rake::Task[
|
17
|
+
Rake::Task['appraisal:install'].execute
|
18
18
|
exec('rake appraisal test spec')
|
19
19
|
# exec('rake appraisal test spec cucumber')
|
20
20
|
end
|
@@ -27,22 +27,22 @@ Rake::TestTask.new(:test) do |t|
|
|
27
27
|
t.verbose = true
|
28
28
|
end
|
29
29
|
|
30
|
-
desc
|
30
|
+
desc 'Run specs'
|
31
31
|
RSpec::Core::RakeTask.new do |t|
|
32
|
-
t.pattern =
|
32
|
+
t.pattern = './spec/**/*_spec.rb' # don't need this, it's default.
|
33
33
|
# Put spec opts in a file named .rspec in root
|
34
34
|
end
|
35
35
|
|
36
36
|
desc 'Run integration test'
|
37
37
|
Cucumber::Rake::Task.new do |t|
|
38
|
-
t.cucumber_opts = %w
|
38
|
+
t.cucumber_opts = %w[--format progress]
|
39
39
|
end
|
40
40
|
|
41
41
|
desc 'Clean up files.'
|
42
|
-
task :clean do |
|
43
|
-
FileUtils.rm_rf
|
44
|
-
FileUtils.rm_rf
|
45
|
-
FileUtils.rm_rf
|
46
|
-
FileUtils.rm_rf
|
47
|
-
Dir.glob(
|
42
|
+
task :clean do |_t|
|
43
|
+
FileUtils.rm_rf 'doc'
|
44
|
+
FileUtils.rm_rf 'tmp'
|
45
|
+
FileUtils.rm_rf 'pkg'
|
46
|
+
FileUtils.rm_rf 'public'
|
47
|
+
Dir.glob('activerecord-tablefree-*.gem').each { |f| FileUtils.rm f }
|
48
48
|
end
|
@@ -1,47 +1,47 @@
|
|
1
1
|
# -*- ruby -*-
|
2
|
-
$LOAD_PATH.push File.expand_path(
|
2
|
+
$LOAD_PATH.push File.expand_path('../lib', __FILE__)
|
3
3
|
require 'activerecord-tablefree/version'
|
4
4
|
|
5
5
|
Gem::Specification.new do |gem|
|
6
6
|
gem.name = 'activerecord-tablefree'
|
7
7
|
gem.version = ActiveRecord::Tablefree::VERSION
|
8
8
|
gem.platform = Gem::Platform::RUBY
|
9
|
-
gem.authors = [
|
10
|
-
gem.email = [
|
11
|
-
gem.homepage =
|
12
|
-
gem.summary =
|
13
|
-
gem.description =
|
9
|
+
gem.authors = ['Jarl Friis', 'Kenneth Kalmer', 'Michal Zima', 'Peter Boling']
|
10
|
+
gem.email = ['jarl@softace.dk', 'peter.boling@gmail.com']
|
11
|
+
gem.homepage = 'https://github.com/boltthreads/activerecord-tablefree'
|
12
|
+
gem.summary = 'A library for implementing tablefree ActiveRecord models'
|
13
|
+
gem.description = 'ActiveRecord Tablefree Models provides a simple mixin for creating models that are not bound to the database. This approach is useful for taking advantage of the features of ActiveRecord such as validation, relationships, etc.'
|
14
14
|
gem.license = 'MIT'
|
15
15
|
|
16
|
-
gem.files = `git ls-files`.split(
|
17
|
-
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
16
|
+
gem.files = `git ls-files`.split($OUTPUT_RECORD_SEPARATOR)
|
17
|
+
gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
|
18
18
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
19
19
|
gem.has_rdoc = true
|
20
20
|
|
21
|
-
gem.require_paths = [
|
21
|
+
gem.require_paths = ['lib']
|
22
22
|
|
23
23
|
gem.add_runtime_dependency('activerecord', '>= 3.0.0')
|
24
24
|
|
25
25
|
gem.add_development_dependency('bundler', '~> 1.16.0')
|
26
|
-
gem.add_development_dependency('rake', '~>
|
26
|
+
gem.add_development_dependency('rake', '~> 12', '> 0')
|
27
27
|
|
28
28
|
# gem.add_development_dependency("rails") # This is in the appraisal gemfiles
|
29
29
|
gem.add_development_dependency('sqlite3', '~> 1.3')
|
30
30
|
|
31
31
|
gem.add_development_dependency('appraisal', '~> 1.0')
|
32
|
+
gem.add_development_dependency('aruba', '~> 0.5')
|
32
33
|
gem.add_development_dependency('cucumber', '~> 1.1')
|
33
34
|
gem.add_development_dependency('rspec', '~> 3.1')
|
34
35
|
gem.add_development_dependency('rspec-collection_matchers', '~> 1.0')
|
35
|
-
gem.add_development_dependency('aruba', '~> 0.5')
|
36
36
|
|
37
|
-
gem.add_development_dependency('nokogiri', '~> 1.0')
|
38
37
|
gem.add_development_dependency('capybara', '~> 0.0')
|
38
|
+
gem.add_development_dependency('coveralls')
|
39
39
|
gem.add_development_dependency('gem-release', '~> 0.7.4')
|
40
|
-
gem.add_development_dependency('wwtd')
|
41
|
-
gem.add_development_dependency('rails')
|
42
40
|
gem.add_development_dependency('listen')
|
43
|
-
gem.add_development_dependency('
|
41
|
+
gem.add_development_dependency('nokogiri', '~> 1.0')
|
42
|
+
gem.add_development_dependency('rails')
|
43
|
+
gem.add_development_dependency('wwtd')
|
44
44
|
|
45
|
-
# gem.add_development_dependency('launchy', '~> 2.1')
|
46
|
-
# gem.add_development_dependency('debugger')
|
45
|
+
# gem.add_development_dependency('launchy', '~> 2.1')
|
46
|
+
# gem.add_development_dependency('debugger')
|
47
47
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
Given /^I generate a new rails application$/ do
|
2
|
-
steps %
|
2
|
+
steps %(
|
3
3
|
When I successfully run `bundle exec #{new_application_command(APP_NAME)}`
|
4
4
|
And I cd to "#{APP_NAME}"
|
5
5
|
And I turn off class caching
|
@@ -15,26 +15,26 @@ Given /^I generate a new rails application$/ do
|
|
15
15
|
And I configure the application to use "activerecord-tablefree" from this project
|
16
16
|
And I reset Bundler environment variable
|
17
17
|
And I successfully run `bundle install --local`
|
18
|
-
|
18
|
+
)
|
19
19
|
end
|
20
20
|
|
21
|
-
Given
|
22
|
-
|
21
|
+
Given 'I fix the application.rb for 3.0.12' do
|
22
|
+
# #See https://github.com/rails/rails/issues/9619
|
23
23
|
in_current_dir do
|
24
|
-
File.open(
|
24
|
+
File.open('config/application.rb', 'a') do |f|
|
25
25
|
f << "ActionController::Base.config.relative_url_root = ''"
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
30
|
Given /^I run a "(.*?)" generator to generate a "(.*?)" scaffold with "(.*?)"$/ do |generator_name, model_name, attributes|
|
31
|
-
step %
|
31
|
+
step %(I successfully run `bundle exec #{generator_command} #{generator_name} #{model_name} #{attributes}`)
|
32
32
|
end
|
33
33
|
|
34
34
|
Given /^I start the rails application$/ do
|
35
35
|
in_current_dir do
|
36
|
-
require
|
37
|
-
require
|
36
|
+
require './config/environment'
|
37
|
+
require 'capybara/rails'
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
@@ -42,44 +42,44 @@ Given /^I reload my application$/ do
|
|
42
42
|
Rails::Application.reload!
|
43
43
|
end
|
44
44
|
|
45
|
-
When
|
45
|
+
When /I turn off class caching/ do
|
46
46
|
in_current_dir do
|
47
|
-
file =
|
47
|
+
file = 'config/environments/test.rb'
|
48
48
|
config = IO.read(file)
|
49
|
-
config.gsub!(
|
50
|
-
|
51
|
-
File.open(file,
|
49
|
+
config.gsub!(/^\s*config.cache_classes.*$/,
|
50
|
+
'config.cache_classes = false')
|
51
|
+
File.open(file, 'w') { |f| f.write(config) }
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
55
|
Given /^I update my application to use Bundler$/ do
|
56
|
-
if framework_version?(
|
56
|
+
if framework_version?('2')
|
57
57
|
boot_config_template = File.read('features/support/fixtures/boot_config.txt')
|
58
58
|
preinitializer_template = File.read('features/support/fixtures/preinitializer.txt')
|
59
59
|
gemfile_template = File.read('features/support/fixtures/gemfile.txt')
|
60
60
|
in_current_dir do
|
61
|
-
content = File.read(
|
62
|
-
File.open(
|
63
|
-
File.open(
|
64
|
-
File.open(
|
61
|
+
content = File.read('config/boot.rb').sub(/Rails\.boot!/, boot_config_template)
|
62
|
+
File.open('config/boot.rb', 'w') { |file| file.write(content) }
|
63
|
+
File.open('config/preinitializer.rb', 'w') { |file| file.write(preinitializer_template) }
|
64
|
+
File.open('Gemfile', 'w') { |file| file.write(gemfile_template.sub(/RAILS_VERSION/, framework_version)) }
|
65
65
|
end
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
69
|
Then /^the file at "([^"]*)" should be the same as "([^"]*)"$/ do |web_file, path|
|
70
70
|
expected = IO.binread(path)
|
71
|
-
actual = if web_file
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
71
|
+
actual = if web_file =~ %r{^https?://}
|
72
|
+
Net::HTTP.get(URI.parse(web_file))
|
73
|
+
else
|
74
|
+
visit(web_file)
|
75
|
+
page.source
|
76
76
|
end
|
77
77
|
actual.should == expected
|
78
78
|
end
|
79
79
|
|
80
80
|
When /^I configure the application to use "([^\"]+)" from this project$/ do |name|
|
81
81
|
append_to_gemfile "gem '#{name}', :path => '#{PROJECT_ROOT}'"
|
82
|
-
steps %
|
82
|
+
steps %(And I run `bundle install --local`)
|
83
83
|
end
|
84
84
|
|
85
85
|
When /^I configure the application to use "([^\"]+)"$/ do |gem_name|
|
@@ -88,9 +88,7 @@ end
|
|
88
88
|
|
89
89
|
When /^I append gems from Appraisal Gemfile$/ do
|
90
90
|
File.read(ENV['BUNDLE_GEMFILE']).split(/\n/).each do |line|
|
91
|
-
if line =~ /^gem "(?!rails|appraisal)/
|
92
|
-
append_to_gemfile line.strip
|
93
|
-
end
|
91
|
+
append_to_gemfile line.strip if line =~ /^gem "(?!rails|appraisal)/
|
94
92
|
end
|
95
93
|
end
|
96
94
|
|
@@ -100,15 +98,14 @@ end
|
|
100
98
|
|
101
99
|
Then /^the result of "(.*?)" should be the same as "(.*?)"$/ do |rails_expr, path|
|
102
100
|
expected = IO.binread(path)
|
103
|
-
actual = eval
|
101
|
+
actual = eval rails_expr.to_s
|
104
102
|
actual.should == expected
|
105
103
|
end
|
106
104
|
|
107
|
-
|
108
105
|
module FileHelpers
|
109
106
|
def append_to(path, contents)
|
110
107
|
in_current_dir do
|
111
|
-
File.open(path,
|
108
|
+
File.open(path, 'a') do |file|
|
112
109
|
file.puts
|
113
110
|
file.puts contents
|
114
111
|
end
|
@@ -121,16 +118,16 @@ module FileHelpers
|
|
121
118
|
|
122
119
|
def comment_out_gem_in_gemfile(gemname)
|
123
120
|
in_current_dir do
|
124
|
-
gemfile = File.read(
|
125
|
-
gemfile.sub!(/^(\s*)(gem\s*['"]#{gemname})/,
|
126
|
-
File.open(
|
121
|
+
gemfile = File.read('Gemfile')
|
122
|
+
gemfile.sub!(/^(\s*)(gem\s*['"]#{gemname})/, '\\1# \\2')
|
123
|
+
File.open('Gemfile', 'w') { |file| file.write(gemfile) }
|
127
124
|
end
|
128
125
|
end
|
129
126
|
|
130
127
|
def transform_file(filename)
|
131
|
-
if File.
|
128
|
+
if File.exist?(filename)
|
132
129
|
content = File.read(filename)
|
133
|
-
File.open(filename,
|
130
|
+
File.open(filename, 'w') do |f|
|
134
131
|
content = yield(content)
|
135
132
|
f.write(content)
|
136
133
|
end
|
@@ -1,14 +1,14 @@
|
|
1
1
|
Given /^I delete all migrations$/ do
|
2
|
-
steps %
|
2
|
+
steps %(
|
3
3
|
When I successfully run `bash -c 'rm db/migrate/*.rb'`
|
4
|
-
|
4
|
+
)
|
5
5
|
end
|
6
6
|
|
7
7
|
Given /^I update my new user model to be tablefree$/ do
|
8
8
|
in_current_dir do
|
9
9
|
file_name = 'app/models/user.rb'
|
10
10
|
content = File.read(file_name)
|
11
|
-
if framework_version <
|
11
|
+
if framework_version < '3.0'
|
12
12
|
content = "require 'activerecord-tablefree'\n" + content
|
13
13
|
end
|
14
14
|
|
@@ -25,11 +25,11 @@ end
|
|
25
25
|
Given /^I update my users controller to render instead of redirect$/ do
|
26
26
|
in_current_dir do
|
27
27
|
transform_file('app/controllers/users_controller.rb') do |content|
|
28
|
-
|
28
|
+
# #Changes in #create method
|
29
29
|
content.gsub!(/@user = User.new\((.*?)\)/,
|
30
30
|
'@user = User.new(\1); @user.id = 1')
|
31
|
-
content.gsub!(
|
32
|
-
|
31
|
+
content.gsub!('if @user.save',
|
32
|
+
'if @user.valid?')
|
33
33
|
content.gsub!(/redirect_to([\( ])@user, .*?([\)]| \}|$)/,
|
34
34
|
"render\\1:action => 'show'\\2")
|
35
35
|
end
|
@@ -18,11 +18,10 @@
|
|
18
18
|
# * http://elabs.se/blog/15-you-re-cuking-it-wrong
|
19
19
|
#
|
20
20
|
|
21
|
-
|
22
21
|
require 'uri'
|
23
22
|
require 'cgi'
|
24
|
-
require File.expand_path(File.join(File.dirname(__FILE__),
|
25
|
-
require File.expand_path(File.join(File.dirname(__FILE__),
|
23
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'support', 'paths'))
|
24
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'support', 'selectors'))
|
26
25
|
|
27
26
|
module WithinHelpers
|
28
27
|
def with_scope(locator)
|
@@ -58,11 +57,11 @@ When /^(?:|I )follow "([^"]*)"$/ do |link|
|
|
58
57
|
end
|
59
58
|
|
60
59
|
When /^(?:|I )fill in "([^"]*)" with "([^"]*)"$/ do |field, value|
|
61
|
-
fill_in(field, :
|
60
|
+
fill_in(field, with: value)
|
62
61
|
end
|
63
62
|
|
64
63
|
When /^(?:|I )fill in "([^"]*)" for "([^"]*)"$/ do |value, field|
|
65
|
-
fill_in(field, :
|
64
|
+
fill_in(field, with: value)
|
66
65
|
end
|
67
66
|
|
68
67
|
# Use this to fill in an entire form with data from a table. Example:
|
@@ -78,12 +77,12 @@ end
|
|
78
77
|
#
|
79
78
|
When /^(?:|I )fill in the following:$/ do |fields|
|
80
79
|
fields.rows_hash.each do |name, value|
|
81
|
-
When %
|
80
|
+
When %(I fill in "#{name}" with "#{value}")
|
82
81
|
end
|
83
82
|
end
|
84
83
|
|
85
84
|
When /^(?:|I )select "([^"]*)" from "([^"]*)"$/ do |value, field|
|
86
|
-
select(value, :
|
85
|
+
select(value, from: field)
|
87
86
|
end
|
88
87
|
|
89
88
|
When /^(?:|I )check "([^"]*)"$/ do |field|
|
@@ -115,9 +114,9 @@ Then /^(?:|I )should (not )?see \/([^\/]*)\/$/ do |negate, regexp|
|
|
115
114
|
regexp = Regexp.new(regexp)
|
116
115
|
should_name = negate ? :should_not : :should
|
117
116
|
if page.respond_to? should_name
|
118
|
-
page.send should_name, have_xpath('//*', :
|
117
|
+
page.send should_name, have_xpath('//*', text: regexp)
|
119
118
|
else
|
120
|
-
assert(negate ? page.has_no_xpath?('//*', :
|
119
|
+
assert(negate ? page.has_no_xpath?('//*', text: regexp) : page.has_xpath?('//*', text: regexp))
|
121
120
|
end
|
122
121
|
end
|
123
122
|
|
@@ -130,7 +129,7 @@ Then /^(?:|I )should have the following query string:$/ do |expected_pairs|
|
|
130
129
|
query = URI.parse(current_url).query
|
131
130
|
actual_params = query ? CGI.parse(query) : {}
|
132
131
|
expected_params = {}
|
133
|
-
expected_pairs.rows_hash.each_pair{|k,v| expected_params[k] = v.split(',')}
|
132
|
+
expected_pairs.rows_hash.each_pair { |k, v| expected_params[k] = v.split(',') }
|
134
133
|
|
135
134
|
expect(actual_params).to eq expected_params
|
136
135
|
end
|