mackarel 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mackarel/basic_factory.rb +16 -0
- data/lib/mackarel/capybara.rb +18 -0
- data/lib/mackarel/config.rb +15 -0
- data/lib/mackarel/core.rb +11 -13
- data/lib/mackarel/factory_girl.rb +13 -0
- data/lib/mackarel/version.rb +1 -1
- data/lib/mackarel.rb +10 -0
- data/mackarel.gemspec +2 -0
- metadata +32 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a906f7a43719d507256ad88a4cee31836147ca30
|
4
|
+
data.tar.gz: 6ca18826ff7b99b3c341f80ac6fb7458e627c64f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aee8fb422894258e8b3b27b5f0857c4afbf0718d165b29ebbd573b28eca7461fcbde063de73aa27e27d12d2f0d93c201a38697f4a1d3132c478730df3aa13071
|
7
|
+
data.tar.gz: 74407ef82a46be685a1af7573cd77abd84cb5984d3909a8795824475ab6702bb38faa3c17f79b14f4cfc1133acd716f5b263b94b7bd8d674dfc2ede59bee72ce
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Mackarel::BasicFactory
|
2
|
+
extend self
|
3
|
+
|
4
|
+
def create(what, fields=nil, _=nil)
|
5
|
+
object = what.new(*fields)
|
6
|
+
yield(object) if block_given?
|
7
|
+
object
|
8
|
+
end
|
9
|
+
|
10
|
+
def create_list(what, number=1, fields=nil, _nil)
|
11
|
+
object = []
|
12
|
+
number.times { object << what.new(*fields) }
|
13
|
+
yield(object) if block_given?
|
14
|
+
object
|
15
|
+
end
|
16
|
+
end
|
data/lib/mackarel/capybara.rb
CHANGED
@@ -58,6 +58,24 @@ module Mackarel
|
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
+
def i_find_no(selector, opts={})
|
62
|
+
text = opts.delete(:with_text)
|
63
|
+
case selector
|
64
|
+
when String
|
65
|
+
expect(page).to have_selector selector, text: text
|
66
|
+
when :link
|
67
|
+
pointing_to = opts.delete(:pointing_to)
|
68
|
+
if pointing_to.nil?
|
69
|
+
expect(page).to have_link text
|
70
|
+
else
|
71
|
+
expect(page).to have_link text, href: pointing_to
|
72
|
+
end
|
73
|
+
when :image
|
74
|
+
src = opts.delete(:with_src)
|
75
|
+
expect(page).to have_xpath(image_path(src, text))
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
61
79
|
def image_path(src, alt)
|
62
80
|
"//img#{image_filters(src, alt)}"
|
63
81
|
end
|
data/lib/mackarel/core.rb
CHANGED
@@ -4,23 +4,21 @@ module Mackarel
|
|
4
4
|
yield
|
5
5
|
end
|
6
6
|
|
7
|
-
def
|
8
|
-
|
9
|
-
|
7
|
+
def factory
|
8
|
+
Mackarel.config.factory
|
9
|
+
end
|
10
|
+
|
11
|
+
def when_there_exists_a(what, *args, **options)
|
12
|
+
called = options.delete(:called) || what.to_s.underscore.tr("/", "_")
|
13
|
+
asset = factory.create(what, *args, **options)
|
10
14
|
instance_variable_set("@#{called}", asset)
|
11
15
|
yield(asset) if block_given?
|
12
16
|
end
|
13
17
|
|
14
|
-
def when_there_exist(number,
|
15
|
-
called =
|
16
|
-
asset =
|
17
|
-
|
18
|
-
instance_variable_set("@#{called}", asset)
|
19
|
-
else
|
20
|
-
instance_variable_set("@#{factory}", asset)
|
21
|
-
instance_variable_set("@#{factory}_list", asset)
|
22
|
-
end
|
23
|
-
|
18
|
+
def when_there_exist(number, what, *args, **options)
|
19
|
+
called = options.delete(:called) || "#{what.to_s.underscore.tr("/", "_")}_list"
|
20
|
+
asset = factory.create_list(what, number, *args, **options)
|
21
|
+
instance_variable_set("@#{called}", asset)
|
24
22
|
yield(asset) if block_given?
|
25
23
|
end
|
26
24
|
|
data/lib/mackarel/version.rb
CHANGED
data/lib/mackarel.rb
CHANGED
@@ -1,8 +1,18 @@
|
|
1
1
|
require "mackarel/version"
|
2
|
+
require "mackarel/config"
|
2
3
|
require "mackarel/core"
|
3
4
|
require "mackarel/capybara"
|
5
|
+
require "mackarel/factory_girl"
|
4
6
|
|
5
7
|
module Mackarel
|
6
8
|
include Core
|
7
9
|
include Capybara
|
10
|
+
|
11
|
+
def self.config(&blk)
|
12
|
+
if blk
|
13
|
+
Config.config(&blk)
|
14
|
+
else
|
15
|
+
Config
|
16
|
+
end
|
17
|
+
end
|
8
18
|
end
|
data/mackarel.gemspec
CHANGED
@@ -28,10 +28,12 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.add_development_dependency "rack-test"
|
29
29
|
spec.add_development_dependency "guard"
|
30
30
|
spec.add_development_dependency "guard-rspec"
|
31
|
+
spec.add_development_dependency "byebug"
|
31
32
|
|
32
33
|
spec.add_dependency "rspec", "~> 3"
|
33
34
|
spec.add_dependency "capybara", "~> 2"
|
34
35
|
spec.add_dependency "poltergeist", "~> 1"
|
35
36
|
spec.add_dependency "factory_girl", "~> 4"
|
37
|
+
spec.add_dependency "activesupport"
|
36
38
|
|
37
39
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mackarel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paolo Gianrossi
|
@@ -164,6 +164,20 @@ dependencies:
|
|
164
164
|
- - ">="
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '0'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: byebug
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
167
181
|
- !ruby/object:Gem::Dependency
|
168
182
|
name: rspec
|
169
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -220,6 +234,20 @@ dependencies:
|
|
220
234
|
- - "~>"
|
221
235
|
- !ruby/object:Gem::Version
|
222
236
|
version: '4'
|
237
|
+
- !ruby/object:Gem::Dependency
|
238
|
+
name: activesupport
|
239
|
+
requirement: !ruby/object:Gem::Requirement
|
240
|
+
requirements:
|
241
|
+
- - ">="
|
242
|
+
- !ruby/object:Gem::Version
|
243
|
+
version: '0'
|
244
|
+
type: :runtime
|
245
|
+
prerelease: false
|
246
|
+
version_requirements: !ruby/object:Gem::Requirement
|
247
|
+
requirements:
|
248
|
+
- - ">="
|
249
|
+
- !ruby/object:Gem::Version
|
250
|
+
version: '0'
|
223
251
|
description: Mackarel allows you to write acceptance tests in Rails in a readable
|
224
252
|
way without having to deal with things like Cucumber. It uses feature tests with
|
225
253
|
RSpec, Factorygirl as the factory for models, and generally follows my setup.
|
@@ -242,8 +270,11 @@ files:
|
|
242
270
|
- bin/setup
|
243
271
|
- features.rb
|
244
272
|
- lib/mackarel.rb
|
273
|
+
- lib/mackarel/basic_factory.rb
|
245
274
|
- lib/mackarel/capybara.rb
|
275
|
+
- lib/mackarel/config.rb
|
246
276
|
- lib/mackarel/core.rb
|
277
|
+
- lib/mackarel/factory_girl.rb
|
247
278
|
- lib/mackarel/version.rb
|
248
279
|
- mackarel.gemspec
|
249
280
|
homepage: https://github.com/paologianrossi/mackarel
|