test-factory 0.4.6 → 0.4.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +2 -4
- data/lib/test-factory/core_ext.rb +2 -2
- data/lib/test-factory/data_factory.rb +0 -28
- data/lib/test-factory/string_factory.rb +4 -3
- data/test-factory.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZDMzMjlhNzBkMTYwYWE4MWM4ODQxZDNmZDJjZGMxMGViMDNhMjkzZg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MWNlOGFkNDkwZGQzNzVjZTc2MmJlNWE0Mzk4OGFkMzM2ZGUzNjVjNA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZTI4ZGJhYTAxMjA5ODAyYTRhMjMxNzliNWU5ZGViODcyYzFmMzZiYWM3NmIy
|
10
|
+
MTAwMTY0MzA3MjUxMDIwMjM1YzQzYzg4ZTQ1Mjk5MGUyYjhiNTIyZjQ4Njcw
|
11
|
+
MjJiZGM4ZjA2MjVhZTUyOTk1NzgxMDlmZTU0ZDdjYTY3MjMyYzM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NTUzNjljNTBmMzI1MDFmOTg1MTk1NDQ0ZjU4MmMyODZmZjgyMjU1ZDgzMWRh
|
14
|
+
MmJhZGUwY2MwMThiNmQ5MWFkMDI5MmJhMGE2YmIyN2JjYzdmOGM4NWVjYmE4
|
15
|
+
MTdlNDdjZWFmMThkMjA3NDVkZjI5ZGFhYTFmNDZhNmFiYWYxYWE=
|
data/README.md
CHANGED
@@ -98,12 +98,10 @@ class Home < BasePage
|
|
98
98
|
end
|
99
99
|
```
|
100
100
|
|
101
|
-
Once you've got a bunch of classes set up for your site's various pages, you're going to want to create "data objects" to represent what goes into those pages. For this, you'll use the
|
101
|
+
Once you've got a bunch of classes set up for your site's various pages, you're going to want to create "data objects" to represent what goes into those pages. For this, you'll use the superclass DataFactory. Your data classes should follow this basic structure:
|
102
102
|
|
103
103
|
```ruby
|
104
|
-
class YourDataObject
|
105
|
-
|
106
|
-
include DataFactory
|
104
|
+
class YourDataObject < DataFactory
|
107
105
|
|
108
106
|
# Define all the things you need to test about your data object.
|
109
107
|
# These are some example attributes...
|
@@ -123,11 +123,11 @@ end # Numeric
|
|
123
123
|
|
124
124
|
class String
|
125
125
|
|
126
|
-
# Used to remove commas from long number strings,
|
126
|
+
# Used to remove commas and dollar signs from long number strings,
|
127
127
|
# then converting the result to a Float so that it
|
128
128
|
# can be used in calculations.
|
129
129
|
def groom
|
130
|
-
self.gsub('
|
130
|
+
self.gsub(/[$,]/,'').to_f
|
131
131
|
end
|
132
132
|
|
133
133
|
end # String
|
@@ -342,32 +342,4 @@ class DataFactory
|
|
342
342
|
@collections.each {|coll| instance_variable_get("@#{coll}").notify_members *updates }
|
343
343
|
end
|
344
344
|
|
345
|
-
end
|
346
|
-
|
347
|
-
# Will soon be removed...
|
348
|
-
class DataObject < DataFactory
|
349
|
-
|
350
|
-
def set_options(hash)
|
351
|
-
|
352
|
-
warn %{
|
353
|
-
Welcome to version 0.4.6!
|
354
|
-
|
355
|
-
Please update all your Data Object classes to
|
356
|
-
inherit from DataFactory
|
357
|
-
instead of DataObject.
|
358
|
-
|
359
|
-
You still need to update this class: #{self.class}
|
360
|
-
|
361
|
-
Note that in the future this warning will be going
|
362
|
-
away. You'll just get an error, so
|
363
|
-
be sure you update your project soon!
|
364
|
-
}
|
365
|
-
|
366
|
-
@collections ||= []
|
367
|
-
hash.each do |key, value|
|
368
|
-
instance_variable_set("@#{key}", value)
|
369
|
-
@collections << key if value.kind_of?(CollectionsFactory)
|
370
|
-
end
|
371
|
-
end
|
372
|
-
|
373
345
|
end
|
@@ -59,8 +59,9 @@ module StringFactory
|
|
59
59
|
# A random string generator that uses all characters
|
60
60
|
# available on an American Qwerty keyboard.
|
61
61
|
# @param length [Integer] The count of characters in the string
|
62
|
-
# @param s [String] Typically this will be left blank, but if included, any string created will be prepended with s. Note that the string length will
|
63
|
-
#
|
62
|
+
# @param s [String] Typically this will be left blank, but if included, any string created will be prepended with s. Note that the string length will be longer by the length of the pre-pended string.
|
63
|
+
# @example
|
64
|
+
# random_alphanums_plus(20, 'pre-') => 'pre-PUm,Rv:(LUFt4t@u29f%'
|
64
65
|
def random_alphanums_plus(length=10, s="")
|
65
66
|
chars = %w{ a b c d e f g h j k m n p q r s t u v w x y z A B C D E F G H J K L M N P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9 ` ~ ! @ # $ % ^ & * ( ) _ + - = { } [ ] \\ : " ; ' < > ? , . / }
|
66
67
|
length.times { s << chars[rand(chars.size)] }
|
@@ -69,7 +70,7 @@ module StringFactory
|
|
69
70
|
|
70
71
|
# A random string generator that uses only letters and numbers in the string. Default length is 10 characters.
|
71
72
|
# @param length [Integer] The count of characters in the string
|
72
|
-
# @param s [String] Typically this will be left blank, but if included, any string created will be prepended with s. Note that the string length will
|
73
|
+
# @param s [String] Typically this will be left blank, but if included, any string created will be prepended with s. Note that the string length will be longer by the length of the pre-pended string.
|
73
74
|
#
|
74
75
|
def random_alphanums(length=10, s="")
|
75
76
|
chars = 'abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ0123456789'
|
data/test-factory.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
spec = Gem::Specification.new do |s|
|
2
2
|
s.name = 'test-factory'
|
3
|
-
s.version = '0.4.
|
3
|
+
s.version = '0.4.7'
|
4
4
|
s.summary = %q{rSmart's framework for creating automated testing scripts}
|
5
5
|
s.description = %q{This gem provides a set of modules and methods to help quickly and DRYly create a test automation framework using Ruby and Watir (or watir-webdriver).}
|
6
6
|
s.files = Dir.glob("**/**/**")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test-factory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Abraham Heward
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: watir-webdriver
|