elabs_matchers 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -1
- data/Gemfile.lock +37 -26
- data/README.md +57 -47
- data/development.txt +26 -0
- data/doc/ElabsMatchers/Helpers/Fixtures.html +33 -23
- data/doc/ElabsMatchers/Helpers/NormalizeKeys.html +222 -0
- data/doc/ElabsMatchers/Helpers/ReloadRecord.html +302 -0
- data/doc/ElabsMatchers/Helpers/SelectYearAndMonth.html +251 -0
- data/doc/ElabsMatchers/Helpers.html +29 -22
- data/doc/ElabsMatchers/Matchers/Allow/AllowMatcher.html +707 -0
- data/doc/ElabsMatchers/Matchers/Allow.html +229 -0
- data/doc/ElabsMatchers/Matchers/ContainHash/ContainHashMatcher.html +506 -0
- data/doc/ElabsMatchers/Matchers/ContainHash.html +222 -0
- data/doc/ElabsMatchers/Matchers/HaveAttribute/HaveAttributeMatcher.html +656 -0
- data/doc/ElabsMatchers/Matchers/HaveAttribute.html +239 -0
- data/doc/ElabsMatchers/Matchers/HaveFields/HaveFieldsMatcher.html +572 -0
- data/doc/ElabsMatchers/Matchers/HaveFields.html +220 -0
- data/doc/ElabsMatchers/Matchers/HaveFlash/HaveFlashMatcher.html +654 -0
- data/doc/ElabsMatchers/Matchers/HaveFlash.html +306 -0
- data/doc/ElabsMatchers/Matchers/HaveFormErrorsOn/HaveFormErrorsOnMatcher.html +678 -0
- data/doc/ElabsMatchers/Matchers/HaveFormErrorsOn.html +236 -0
- data/doc/ElabsMatchers/Matchers/HaveHeader/HaveHeaderMatcher.html +568 -0
- data/doc/ElabsMatchers/Matchers/HaveHeader.html +219 -0
- data/doc/ElabsMatchers/Matchers/HaveImage/HaveImageMatcher.html +592 -0
- data/doc/ElabsMatchers/Matchers/HaveImage.html +219 -0
- data/doc/ElabsMatchers/Matchers/HaveTableRow/HaveTableRowMatcher.html +654 -0
- data/doc/ElabsMatchers/Matchers/HaveTableRow.html +236 -0
- data/doc/ElabsMatchers/Matchers/OnlyInclude/OnlyIncludeMatcher.html +494 -0
- data/doc/ElabsMatchers/Matchers/OnlyInclude.html +221 -0
- data/doc/ElabsMatchers/Matchers/Persist/PersistMatcher.html +586 -0
- data/doc/ElabsMatchers/Matchers/Persist.html +235 -0
- data/doc/ElabsMatchers/Matchers.html +29 -22
- data/doc/ElabsMatchers.html +1144 -21
- data/doc/_index.html +161 -79
- data/doc/class_list.html +12 -6
- data/doc/css/full_list.css +4 -2
- data/doc/css/style.css +50 -44
- data/doc/file.README.html +71 -73
- data/doc/file_list.html +12 -6
- data/doc/frames.html +20 -5
- data/doc/index.html +71 -73
- data/doc/js/app.js +52 -43
- data/doc/js/full_list.js +9 -9
- data/doc/js/jquery.js +4 -16
- data/doc/method_list.html +603 -77
- data/doc/top-level-namespace.html +24 -103
- data/elabs_matchers.gemspec +4 -3
- data/history.txt +15 -0
- data/lib/elabs_matchers/extensions/module.rb +24 -0
- data/lib/elabs_matchers/helpers/fixtures.rb +2 -2
- data/lib/elabs_matchers/helpers/{common.rb → normalize_keys.rb} +3 -4
- data/lib/elabs_matchers/helpers/{orm.rb → reload_record.rb} +9 -6
- data/lib/elabs_matchers/helpers/{capybara.rb → select_year_and_month.rb} +5 -3
- data/lib/elabs_matchers/matchers/allow.rb +130 -0
- data/lib/elabs_matchers/matchers/contain_hash.rb +58 -0
- data/lib/elabs_matchers/matchers/have_attribute.rb +62 -0
- data/lib/elabs_matchers/matchers/have_fields.rb +45 -0
- data/lib/elabs_matchers/matchers/have_flash.rb +65 -0
- data/lib/elabs_matchers/matchers/have_form_errors_on.rb +79 -0
- data/lib/elabs_matchers/matchers/have_header.rb +53 -0
- data/lib/elabs_matchers/matchers/have_image.rb +69 -0
- data/lib/elabs_matchers/matchers/have_table_row.rb +113 -0
- data/lib/elabs_matchers/matchers/only_include.rb +41 -0
- data/lib/elabs_matchers/matchers/persist.rb +42 -0
- data/lib/elabs_matchers/version.rb +1 -1
- data/lib/elabs_matchers.rb +90 -10
- data/spec/elabs_matchers/helpers/fixtures_spec.rb +1 -1
- data/spec/elabs_matchers/helpers/{common_spec.rb → normalize_keys_spec.rb} +2 -2
- data/spec/elabs_matchers/helpers/{orm_spec.rb → reload_record_spec.rb} +3 -2
- data/spec/elabs_matchers/helpers/select_year_and_month_spec.rb +32 -0
- data/spec/elabs_matchers/matchers/{rspec/allow_spec.rb → allow_spec.rb} +5 -4
- data/spec/elabs_matchers/matchers/contain_hash_spec.rb +86 -0
- data/spec/elabs_matchers/matchers/have_attribute_spec.rb +65 -0
- data/spec/elabs_matchers/matchers/have_fields_spec.rb +46 -0
- data/spec/elabs_matchers/matchers/have_flash_spec.rb +97 -0
- data/spec/elabs_matchers/matchers/have_form_errors_on_spec.rb +93 -0
- data/spec/elabs_matchers/matchers/have_header_spec.rb +54 -0
- data/spec/elabs_matchers/matchers/have_image_spec.rb +49 -0
- data/spec/elabs_matchers/matchers/have_table_row_spec.rb +119 -0
- data/spec/elabs_matchers/matchers/only_include_spec.rb +32 -0
- data/spec/elabs_matchers/matchers/persist_spec.rb +21 -0
- data/{lib/elabs_matchers/orm → spec/fixtures}/post.rb +0 -0
- data/spec/spec_helper.rb +19 -8
- data/todo.txt +6 -0
- metadata +104 -48
- data/lib/elabs_matchers/cucumber/common.rb +0 -57
- data/lib/elabs_matchers/helpers/session.rb +0 -81
- data/lib/elabs_matchers/matchers/capybara/common.rb +0 -245
- data/lib/elabs_matchers/matchers/rspec/allow.rb +0 -112
- data/lib/elabs_matchers/matchers/rspec/common.rb +0 -59
- data/lib/elabs_matchers/matchers/rspec/orm.rb +0 -29
- data/spec/elabs_matchers/cucumber/common_spec.rb +0 -49
- data/spec/elabs_matchers/helpers/capybara_spec.rb +0 -32
- data/spec/elabs_matchers/helpers/session_spec.rb +0 -35
- data/spec/elabs_matchers/matchers/capybara/common_spec.rb +0 -202
- data/spec/elabs_matchers/matchers/rspec/common_spec.rb +0 -74
- data/spec/elabs_matchers/matchers/rspec/orm_spec.rb +0 -16
@@ -0,0 +1,21 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "fixtures/post"
|
3
|
+
|
4
|
+
describe ElabsMatchers::Matchers::Persist do
|
5
|
+
let(:post) { ElabsMatchers::Orm::Post.create(:title => "New", :body => "Lorem") }
|
6
|
+
subject { post }
|
7
|
+
|
8
|
+
describe "#persist" do
|
9
|
+
it "returns true if the value is the supplied" do
|
10
|
+
should persist(:title, "Updated")
|
11
|
+
expect { should_not persist(:title, "Updated") }.to fail_assertion
|
12
|
+
end
|
13
|
+
|
14
|
+
it "returns false if the value isn't the supplied" do
|
15
|
+
post.stub(:title).and_return("New")
|
16
|
+
|
17
|
+
should_not persist(:title, "Updated")
|
18
|
+
expect { should persist(:title, "Updated") }.to fail_assertion
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
File without changes
|
data/spec/spec_helper.rb
CHANGED
@@ -1,20 +1,31 @@
|
|
1
1
|
ENV["RAILS_ENV"] = "test"
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
3
|
+
require "rubygems"
|
4
|
+
require "bundler/setup"
|
5
|
+
require "capybara"
|
6
|
+
require "active_model"
|
7
|
+
require "elabs_matchers"
|
8
8
|
|
9
9
|
RSpec.configure do |config|
|
10
10
|
config.mock_with :rspec
|
11
11
|
config.include Capybara
|
12
|
+
|
13
|
+
%w[helpers matchers].each do |dir|
|
14
|
+
Dir[File.join(File.expand_path(File.dirname(__FILE__)), "../lib/elabs_matchers/#{dir}/*.rb")].each do |file|
|
15
|
+
file = file.split("/").last.split(".").first
|
16
|
+
config.include("ElabsMatchers::#{dir.camelize}::#{file.camelize}".constantize)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
config.after do
|
21
|
+
ElabsMatchers.use_default_configuration!
|
22
|
+
end
|
12
23
|
end
|
13
24
|
|
14
25
|
module RSpec
|
15
26
|
module Matchers
|
16
|
-
def fail_assertion(message=nil
|
17
|
-
|
27
|
+
def fail_assertion(message = nil)
|
28
|
+
raise_error(RSpec::Expectations::ExpectationNotMetError, message)
|
18
29
|
end
|
19
30
|
end
|
20
|
-
end
|
31
|
+
end
|
data/todo.txt
ADDED
metadata
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elabs_matchers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
|
-
-
|
8
|
+
- Everyone at Elabs
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-09-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
16
|
-
requirement: &
|
16
|
+
requirement: &2168690440 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2168690440
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec
|
27
|
-
requirement: &
|
27
|
+
requirement: &2168689920 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2168689920
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: capybara
|
38
|
-
requirement: &
|
38
|
+
requirement: &2168689060 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2168689060
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: yard
|
49
|
-
requirement: &
|
49
|
+
requirement: &2168688180 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *2168688180
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: activesupport
|
60
|
-
requirement: &
|
60
|
+
requirement: &2168687560 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *2168687560
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: activemodel
|
71
|
-
requirement: &
|
71
|
+
requirement: &2168686900 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *2168686900
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: redcarpet
|
82
|
-
requirement: &
|
82
|
+
requirement: &2168686200 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,11 +87,22 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *2168686200
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: pry
|
93
|
+
requirement: &2168685600 !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ! '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
type: :development
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: *2168685600
|
91
102
|
description: Provides a set of usefull rspec matchers to be used with RSpec and/or
|
92
103
|
Capybara
|
93
104
|
email:
|
94
|
-
- dev
|
105
|
+
- dev@elabs.se
|
95
106
|
executables: []
|
96
107
|
extensions: []
|
97
108
|
extra_rdoc_files: []
|
@@ -101,6 +112,7 @@ files:
|
|
101
112
|
- Gemfile.lock
|
102
113
|
- README.md
|
103
114
|
- Rakefile
|
115
|
+
- development.txt
|
104
116
|
- doc/Cucumber.html
|
105
117
|
- doc/ElabsMatchers.html
|
106
118
|
- doc/ElabsMatchers/Cucumber.html
|
@@ -109,11 +121,36 @@ files:
|
|
109
121
|
- doc/ElabsMatchers/Helpers/Capybara.html
|
110
122
|
- doc/ElabsMatchers/Helpers/Common.html
|
111
123
|
- doc/ElabsMatchers/Helpers/Fixtures.html
|
124
|
+
- doc/ElabsMatchers/Helpers/NormalizeKeys.html
|
112
125
|
- doc/ElabsMatchers/Helpers/Orm.html
|
126
|
+
- doc/ElabsMatchers/Helpers/ReloadRecord.html
|
127
|
+
- doc/ElabsMatchers/Helpers/SelectYearAndMonth.html
|
113
128
|
- doc/ElabsMatchers/Helpers/Session.html
|
114
129
|
- doc/ElabsMatchers/Matchers.html
|
130
|
+
- doc/ElabsMatchers/Matchers/Allow.html
|
131
|
+
- doc/ElabsMatchers/Matchers/Allow/AllowMatcher.html
|
115
132
|
- doc/ElabsMatchers/Matchers/Capybara.html
|
116
133
|
- doc/ElabsMatchers/Matchers/Capybara/Common.html
|
134
|
+
- doc/ElabsMatchers/Matchers/ContainHash.html
|
135
|
+
- doc/ElabsMatchers/Matchers/ContainHash/ContainHashMatcher.html
|
136
|
+
- doc/ElabsMatchers/Matchers/HaveAttribute.html
|
137
|
+
- doc/ElabsMatchers/Matchers/HaveAttribute/HaveAttributeMatcher.html
|
138
|
+
- doc/ElabsMatchers/Matchers/HaveFields.html
|
139
|
+
- doc/ElabsMatchers/Matchers/HaveFields/HaveFieldsMatcher.html
|
140
|
+
- doc/ElabsMatchers/Matchers/HaveFlash.html
|
141
|
+
- doc/ElabsMatchers/Matchers/HaveFlash/HaveFlashMatcher.html
|
142
|
+
- doc/ElabsMatchers/Matchers/HaveFormErrorsOn.html
|
143
|
+
- doc/ElabsMatchers/Matchers/HaveFormErrorsOn/HaveFormErrorsOnMatcher.html
|
144
|
+
- doc/ElabsMatchers/Matchers/HaveHeader.html
|
145
|
+
- doc/ElabsMatchers/Matchers/HaveHeader/HaveHeaderMatcher.html
|
146
|
+
- doc/ElabsMatchers/Matchers/HaveImage.html
|
147
|
+
- doc/ElabsMatchers/Matchers/HaveImage/HaveImageMatcher.html
|
148
|
+
- doc/ElabsMatchers/Matchers/HaveTableRow.html
|
149
|
+
- doc/ElabsMatchers/Matchers/HaveTableRow/HaveTableRowMatcher.html
|
150
|
+
- doc/ElabsMatchers/Matchers/OnlyInclude.html
|
151
|
+
- doc/ElabsMatchers/Matchers/OnlyInclude/OnlyIncludeMatcher.html
|
152
|
+
- doc/ElabsMatchers/Matchers/Persist.html
|
153
|
+
- doc/ElabsMatchers/Matchers/Persist/PersistMatcher.html
|
117
154
|
- doc/ElabsMatchers/Matchers/Rspec.html
|
118
155
|
- doc/ElabsMatchers/Matchers/Rspec/Allow.html
|
119
156
|
- doc/ElabsMatchers/Matchers/Rspec/Common.html
|
@@ -135,32 +172,45 @@ files:
|
|
135
172
|
- doc/method_list.html
|
136
173
|
- doc/top-level-namespace.html
|
137
174
|
- elabs_matchers.gemspec
|
175
|
+
- history.txt
|
138
176
|
- lib/elabs_matchers.rb
|
139
|
-
- lib/elabs_matchers/
|
140
|
-
- lib/elabs_matchers/helpers/capybara.rb
|
141
|
-
- lib/elabs_matchers/helpers/common.rb
|
177
|
+
- lib/elabs_matchers/extensions/module.rb
|
142
178
|
- lib/elabs_matchers/helpers/fixtures.rb
|
143
|
-
- lib/elabs_matchers/helpers/
|
144
|
-
- lib/elabs_matchers/helpers/
|
145
|
-
- lib/elabs_matchers/
|
146
|
-
- lib/elabs_matchers/matchers/
|
147
|
-
- lib/elabs_matchers/matchers/
|
148
|
-
- lib/elabs_matchers/matchers/
|
149
|
-
- lib/elabs_matchers/
|
179
|
+
- lib/elabs_matchers/helpers/normalize_keys.rb
|
180
|
+
- lib/elabs_matchers/helpers/reload_record.rb
|
181
|
+
- lib/elabs_matchers/helpers/select_year_and_month.rb
|
182
|
+
- lib/elabs_matchers/matchers/allow.rb
|
183
|
+
- lib/elabs_matchers/matchers/contain_hash.rb
|
184
|
+
- lib/elabs_matchers/matchers/have_attribute.rb
|
185
|
+
- lib/elabs_matchers/matchers/have_fields.rb
|
186
|
+
- lib/elabs_matchers/matchers/have_flash.rb
|
187
|
+
- lib/elabs_matchers/matchers/have_form_errors_on.rb
|
188
|
+
- lib/elabs_matchers/matchers/have_header.rb
|
189
|
+
- lib/elabs_matchers/matchers/have_image.rb
|
190
|
+
- lib/elabs_matchers/matchers/have_table_row.rb
|
191
|
+
- lib/elabs_matchers/matchers/only_include.rb
|
192
|
+
- lib/elabs_matchers/matchers/persist.rb
|
150
193
|
- lib/elabs_matchers/version.rb
|
151
|
-
- spec/elabs_matchers/cucumber/common_spec.rb
|
152
|
-
- spec/elabs_matchers/helpers/capybara_spec.rb
|
153
|
-
- spec/elabs_matchers/helpers/common_spec.rb
|
154
194
|
- spec/elabs_matchers/helpers/fixtures_spec.rb
|
155
|
-
- spec/elabs_matchers/helpers/
|
156
|
-
- spec/elabs_matchers/helpers/
|
157
|
-
- spec/elabs_matchers/
|
158
|
-
- spec/elabs_matchers/matchers/
|
159
|
-
- spec/elabs_matchers/matchers/
|
160
|
-
- spec/elabs_matchers/matchers/
|
195
|
+
- spec/elabs_matchers/helpers/normalize_keys_spec.rb
|
196
|
+
- spec/elabs_matchers/helpers/reload_record_spec.rb
|
197
|
+
- spec/elabs_matchers/helpers/select_year_and_month_spec.rb
|
198
|
+
- spec/elabs_matchers/matchers/allow_spec.rb
|
199
|
+
- spec/elabs_matchers/matchers/contain_hash_spec.rb
|
200
|
+
- spec/elabs_matchers/matchers/have_attribute_spec.rb
|
201
|
+
- spec/elabs_matchers/matchers/have_fields_spec.rb
|
202
|
+
- spec/elabs_matchers/matchers/have_flash_spec.rb
|
203
|
+
- spec/elabs_matchers/matchers/have_form_errors_on_spec.rb
|
204
|
+
- spec/elabs_matchers/matchers/have_header_spec.rb
|
205
|
+
- spec/elabs_matchers/matchers/have_image_spec.rb
|
206
|
+
- spec/elabs_matchers/matchers/have_table_row_spec.rb
|
207
|
+
- spec/elabs_matchers/matchers/only_include_spec.rb
|
208
|
+
- spec/elabs_matchers/matchers/persist_spec.rb
|
161
209
|
- spec/fixtures/file.txt
|
210
|
+
- spec/fixtures/post.rb
|
162
211
|
- spec/spec_helper.rb
|
163
|
-
|
212
|
+
- todo.txt
|
213
|
+
homepage: http://github.com/elabs/elabs_matchers
|
164
214
|
licenses: []
|
165
215
|
post_install_message:
|
166
216
|
rdoc_options: []
|
@@ -180,21 +230,27 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
180
230
|
version: '0'
|
181
231
|
requirements: []
|
182
232
|
rubyforge_project: elabs_matchers
|
183
|
-
rubygems_version: 1.8.
|
233
|
+
rubygems_version: 1.8.10
|
184
234
|
signing_key:
|
185
235
|
specification_version: 3
|
186
236
|
summary: Provides a set of usefull rspec matchers
|
187
237
|
test_files:
|
188
|
-
- spec/elabs_matchers/cucumber/common_spec.rb
|
189
|
-
- spec/elabs_matchers/helpers/capybara_spec.rb
|
190
|
-
- spec/elabs_matchers/helpers/common_spec.rb
|
191
238
|
- spec/elabs_matchers/helpers/fixtures_spec.rb
|
192
|
-
- spec/elabs_matchers/helpers/
|
193
|
-
- spec/elabs_matchers/helpers/
|
194
|
-
- spec/elabs_matchers/
|
195
|
-
- spec/elabs_matchers/matchers/
|
196
|
-
- spec/elabs_matchers/matchers/
|
197
|
-
- spec/elabs_matchers/matchers/
|
239
|
+
- spec/elabs_matchers/helpers/normalize_keys_spec.rb
|
240
|
+
- spec/elabs_matchers/helpers/reload_record_spec.rb
|
241
|
+
- spec/elabs_matchers/helpers/select_year_and_month_spec.rb
|
242
|
+
- spec/elabs_matchers/matchers/allow_spec.rb
|
243
|
+
- spec/elabs_matchers/matchers/contain_hash_spec.rb
|
244
|
+
- spec/elabs_matchers/matchers/have_attribute_spec.rb
|
245
|
+
- spec/elabs_matchers/matchers/have_fields_spec.rb
|
246
|
+
- spec/elabs_matchers/matchers/have_flash_spec.rb
|
247
|
+
- spec/elabs_matchers/matchers/have_form_errors_on_spec.rb
|
248
|
+
- spec/elabs_matchers/matchers/have_header_spec.rb
|
249
|
+
- spec/elabs_matchers/matchers/have_image_spec.rb
|
250
|
+
- spec/elabs_matchers/matchers/have_table_row_spec.rb
|
251
|
+
- spec/elabs_matchers/matchers/only_include_spec.rb
|
252
|
+
- spec/elabs_matchers/matchers/persist_spec.rb
|
198
253
|
- spec/fixtures/file.txt
|
254
|
+
- spec/fixtures/post.rb
|
199
255
|
- spec/spec_helper.rb
|
200
256
|
has_rdoc:
|
@@ -1,57 +0,0 @@
|
|
1
|
-
module ElabsMatchers
|
2
|
-
module Cucumber
|
3
|
-
module Common
|
4
|
-
##
|
5
|
-
#
|
6
|
-
# Matches a comma or the word 'and'.
|
7
|
-
#
|
8
|
-
# Example:
|
9
|
-
# ,
|
10
|
-
# and
|
11
|
-
|
12
|
-
LIST_SEPARATOR = %r{(?:,\s|\sand\s)}
|
13
|
-
|
14
|
-
##
|
15
|
-
#
|
16
|
-
# Matches a list seperated by LIST_SEPARATOR (, or the word 'and')
|
17
|
-
#
|
18
|
-
# Example:
|
19
|
-
# "foo", "bar" and "baz"
|
20
|
-
|
21
|
-
LIST_REGEXP = %r{(?:"(?:[^\"]*)"#{LIST_SEPARATOR}?)+}
|
22
|
-
|
23
|
-
private
|
24
|
-
|
25
|
-
def human_list_to_array(list)
|
26
|
-
list.gsub('"', '').split(LIST_SEPARATOR)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
module Cucumber
|
33
|
-
include ElabsMatchers::Cucumber::Common
|
34
|
-
end
|
35
|
-
|
36
|
-
RSpec.configure do |config|
|
37
|
-
config.include ElabsMatchers::Cucumber::Common
|
38
|
-
end
|
39
|
-
|
40
|
-
if defined? World
|
41
|
-
##
|
42
|
-
#
|
43
|
-
# Transforms a cucumber step so that the list it includes turns into an array
|
44
|
-
#
|
45
|
-
# Example:
|
46
|
-
# Step: Then I should see "Bart", "Lisa" and "Homer"
|
47
|
-
# Definition:
|
48
|
-
# Then /^I should see (#{LIST_REGEXP})$/ do |names|
|
49
|
-
# # names == ["Bart", "Lisa", "Homer"]
|
50
|
-
# end
|
51
|
-
|
52
|
-
Transform /^#{LIST_REGEXP}$/ do |list|
|
53
|
-
ElabsMatchers::Cucumber::Common::human_list_to_array(list)
|
54
|
-
end
|
55
|
-
|
56
|
-
World(ElabsMatchers::Cucumber::Common)
|
57
|
-
end
|
@@ -1,81 +0,0 @@
|
|
1
|
-
module ElabsMatchers
|
2
|
-
module Helpers
|
3
|
-
module Session
|
4
|
-
##
|
5
|
-
# Can be used to keep track of the current signed in user.
|
6
|
-
# If you use signed_in_as(user) this will be done automaticly.
|
7
|
-
|
8
|
-
attr_reader :current_user
|
9
|
-
|
10
|
-
##
|
11
|
-
# @deprecated Please use sign_in instead
|
12
|
-
# Logs the user into the system. Requires that you login with an email and password
|
13
|
-
# and that your fields are named a certain way
|
14
|
-
# as well as there being a new_user_session path available.
|
15
|
-
#
|
16
|
-
# @param [Object] record The user record
|
17
|
-
#
|
18
|
-
# Example:
|
19
|
-
# login_as(user)
|
20
|
-
|
21
|
-
def login_as(user)
|
22
|
-
warn "[DEPRECATION] `login_as(user)` is deprecated. Please use `sign_in` instead."
|
23
|
-
|
24
|
-
visit(new_user_session_path)
|
25
|
-
fill_in("Email", :with => user.email)
|
26
|
-
fill_in("Password", :with => user.password)
|
27
|
-
click_button("Sign in")
|
28
|
-
@current_user = user
|
29
|
-
end
|
30
|
-
|
31
|
-
##
|
32
|
-
# Set's a global variable that can be used to fake authentication
|
33
|
-
# when running acceptance tests. This is much faster then using
|
34
|
-
# the sign in form everytime but requires you to make a small change
|
35
|
-
# to your application code. Please see [View source] for details.
|
36
|
-
#
|
37
|
-
# @param [Object] record The user record
|
38
|
-
#
|
39
|
-
# Example:
|
40
|
-
# sign_in_as(user)
|
41
|
-
|
42
|
-
def sign_in_as(user = nil)
|
43
|
-
$signed_in = true
|
44
|
-
@current_user = user
|
45
|
-
|
46
|
-
# Your authentication filter should look something like:
|
47
|
-
#
|
48
|
-
# class ApplicationController < ActionController::Base
|
49
|
-
# before_filter :authenticate
|
50
|
-
#
|
51
|
-
# private
|
52
|
-
#
|
53
|
-
# def authenticate!
|
54
|
-
# redirect_to :new_sessions_url unless authenticated?
|
55
|
-
# end
|
56
|
-
#
|
57
|
-
# def authenticated?
|
58
|
-
# $signed_in or begin
|
59
|
-
# # Do your normal authentication logic here.
|
60
|
-
# # E.g:
|
61
|
-
# @current_user = User.find(session[:user_id]) if session[:user_id].present?
|
62
|
-
# end
|
63
|
-
# end
|
64
|
-
# end
|
65
|
-
end
|
66
|
-
alias :sign_in :sign_in_as
|
67
|
-
|
68
|
-
##
|
69
|
-
# See sign_in for details.
|
70
|
-
#
|
71
|
-
# Example:
|
72
|
-
# sign_out
|
73
|
-
#
|
74
|
-
|
75
|
-
def sign_out
|
76
|
-
$signed_in = false
|
77
|
-
@current_user = nil
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|