spree_essentials 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/spree_essentials/test_helper.rb +31 -3
- data/lib/spree_essentials/version.rb +1 -1
- metadata +4 -4
@@ -17,6 +17,7 @@ require "selenium/webdriver"
|
|
17
17
|
Capybara.default_driver = :selenium
|
18
18
|
Capybara.default_selector = :css
|
19
19
|
|
20
|
+
|
20
21
|
# Define a bare test case to use with Capybara
|
21
22
|
class ActiveSupport::IntegrationCase < ActiveSupport::TestCase
|
22
23
|
|
@@ -24,7 +25,20 @@ class ActiveSupport::IntegrationCase < ActiveSupport::TestCase
|
|
24
25
|
include Rails.application.routes.url_helpers
|
25
26
|
|
26
27
|
self.use_transactional_fixtures = false
|
27
|
-
|
28
|
+
|
29
|
+
# Checks for missing translations after each test
|
30
|
+
teardown do
|
31
|
+
unless source.blank?
|
32
|
+
matches = source.match(/translation[\s-]+missing[^"]*/) || []
|
33
|
+
assert_equal 0, matches.length, "Translation Missing! - #{matches[0]}"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# An assertion for ensuring content has made it to the page.
|
38
|
+
#
|
39
|
+
# assert_seen "Site Title"
|
40
|
+
# assert_seen "Peanut Butter Jelly Time", :within => ".post-title h1"
|
41
|
+
#
|
28
42
|
def assert_seen(text, opts={})
|
29
43
|
if opts[:within]
|
30
44
|
within(opts[:within]) do
|
@@ -35,19 +49,33 @@ class ActiveSupport::IntegrationCase < ActiveSupport::TestCase
|
|
35
49
|
end
|
36
50
|
end
|
37
51
|
|
52
|
+
# Asserts the proper flash message
|
53
|
+
#
|
54
|
+
# assert_flash :notice, "Post was successfully saved!"
|
55
|
+
# assert_flash :error, "Oh No, bad things happened!"
|
56
|
+
#
|
38
57
|
def assert_flash(key, text)
|
39
58
|
within(".flash.#{key}") do
|
40
59
|
assert_seen(text)
|
41
60
|
end
|
42
61
|
end
|
43
62
|
|
63
|
+
# Asserts the proper browser title
|
64
|
+
#
|
65
|
+
# assert_title "My Site - Is super cool"
|
66
|
+
#
|
44
67
|
def assert_title(title)
|
45
68
|
assert_seen title, :within => "head title"
|
46
69
|
end
|
47
|
-
|
70
|
+
|
71
|
+
# Asserts meta tags have proper content
|
72
|
+
#
|
73
|
+
# assert_meta :description, "So let me tell you about this one time..."
|
74
|
+
# assert_meta :keywords, "seo, is, fun, jk."
|
75
|
+
#
|
48
76
|
def assert_meta(tag, text)
|
49
77
|
tag = find(:xpath, "//head/meta[@name='#{tag.to_s}']")
|
50
78
|
assert_equal text, tag.native.attribute("content")
|
51
79
|
end
|
52
|
-
|
80
|
+
|
53
81
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: spree_essentials
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.3
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Spencer Steffen
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-06-
|
13
|
+
date: 2011-06-08 00:00:00 -07:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -231,7 +231,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
231
231
|
requirements:
|
232
232
|
- - ">="
|
233
233
|
- !ruby/object:Gem::Version
|
234
|
-
hash:
|
234
|
+
hash: -2758525506888662486
|
235
235
|
segments:
|
236
236
|
- 0
|
237
237
|
version: "0"
|
@@ -240,7 +240,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
240
240
|
requirements:
|
241
241
|
- - ">="
|
242
242
|
- !ruby/object:Gem::Version
|
243
|
-
hash:
|
243
|
+
hash: -2758525506888662486
|
244
244
|
segments:
|
245
245
|
- 0
|
246
246
|
version: "0"
|