spreewald 0.6.5 → 0.6.6
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.
- data/.ruby-version +1 -0
- data/lib/spreewald/timecop_steps.rb +43 -12
- data/lib/spreewald_support/version.rb +1 -1
- data/tests/rails-2.3/config/database.yml +2 -1
- data/tests/rails-3.2/config/database.yml +2 -1
- metadata +5 -6
- data/Gemfile +0 -4
- data/Gemfile.lock +0 -130
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.8.7
|
@@ -8,19 +8,50 @@
|
|
8
8
|
|
9
9
|
if defined?(Timecop)
|
10
10
|
|
11
|
+
module TimecopHarness
|
12
|
+
|
13
|
+
# When you have to make your rails app time zone aware you have to go 100%
|
14
|
+
# otherwise you are better off ignoring time zones at all.
|
15
|
+
# https://makandracards.com/makandra/8723-guide-to-localizing-a-rails-application
|
16
|
+
|
17
|
+
def use_timezones?
|
18
|
+
active_record_loaded = defined?(ActiveRecord::Base)
|
19
|
+
(!active_record_loaded || ActiveRecord::Base.default_timezone != :local) && Time.zone
|
20
|
+
end
|
21
|
+
|
22
|
+
def parse_time(str)
|
23
|
+
if use_timezones?
|
24
|
+
Time.zone.parse(str)
|
25
|
+
else
|
26
|
+
Time.parse(str)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def current_time
|
31
|
+
if use_timezones?
|
32
|
+
Time.current
|
33
|
+
else
|
34
|
+
Time.now
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
World(TimecopHarness)
|
41
|
+
|
11
42
|
# Example:
|
12
43
|
#
|
13
44
|
# Given the date is 2012-02-10
|
14
45
|
# Given the time is 2012-02-10 13:40
|
15
46
|
When /^the (?:date|time) is "?(\d{4}-\d{2}-\d{2}(?: \d{1,2}:\d{2})?)"?$/ do |time|
|
16
|
-
Timecop.travel(
|
47
|
+
Timecop.travel(parse_time(time))
|
17
48
|
end
|
18
49
|
|
19
50
|
# Example:
|
20
51
|
#
|
21
52
|
# Given the time is 13:40
|
22
|
-
When /^the time is "?(\d{1,2}:\d{2})"?$/ do |
|
23
|
-
Timecop.travel(
|
53
|
+
When /^the time is "?(\d{1,2}:\d{2})"?$/ do |time_without_date|
|
54
|
+
Timecop.travel(parse_time(time_without_date)) # date will be today
|
24
55
|
end
|
25
56
|
|
26
57
|
# Example:
|
@@ -29,19 +60,19 @@ if defined?(Timecop)
|
|
29
60
|
# When it is a few hours earlier
|
30
61
|
When /^it is (\d+|a|some|a few) (seconds?|minutes?|hours?|days?|weeks?|months?|years?) (later|earlier)$/ do |amount, unit, direction|
|
31
62
|
amount = case amount
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
63
|
+
when 'a'
|
64
|
+
1
|
65
|
+
when 'some', 'a few'
|
66
|
+
10
|
67
|
+
else
|
68
|
+
amount.to_i
|
69
|
+
end
|
39
70
|
amount = -amount if direction == 'earlier'
|
40
|
-
Timecop.travel(
|
71
|
+
Timecop.travel(current_time + amount.send(unit))
|
41
72
|
end
|
42
73
|
|
43
74
|
After do
|
44
75
|
Timecop.return
|
45
76
|
end
|
46
77
|
|
47
|
-
end
|
78
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spreewald
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 0.6.
|
9
|
+
- 6
|
10
|
+
version: 0.6.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Tobias Kraze
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2013-10-
|
18
|
+
date: 2013-10-16 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -71,8 +71,7 @@ extra_rdoc_files: []
|
|
71
71
|
|
72
72
|
files:
|
73
73
|
- .gitignore
|
74
|
-
-
|
75
|
-
- Gemfile.lock
|
74
|
+
- .ruby-version
|
76
75
|
- LICENSE
|
77
76
|
- README.md
|
78
77
|
- Rakefile
|
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
@@ -1,130 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
spreewald (0.6.4)
|
5
|
-
capybara
|
6
|
-
cucumber
|
7
|
-
cucumber-rails
|
8
|
-
|
9
|
-
GEM
|
10
|
-
remote: https://rubygems.org/
|
11
|
-
specs:
|
12
|
-
actionmailer (3.2.13)
|
13
|
-
actionpack (= 3.2.13)
|
14
|
-
mail (~> 2.5.3)
|
15
|
-
actionpack (3.2.13)
|
16
|
-
activemodel (= 3.2.13)
|
17
|
-
activesupport (= 3.2.13)
|
18
|
-
builder (~> 3.0.0)
|
19
|
-
erubis (~> 2.7.0)
|
20
|
-
journey (~> 1.0.4)
|
21
|
-
rack (~> 1.4.5)
|
22
|
-
rack-cache (~> 1.2)
|
23
|
-
rack-test (~> 0.6.1)
|
24
|
-
sprockets (~> 2.2.1)
|
25
|
-
activemodel (3.2.13)
|
26
|
-
activesupport (= 3.2.13)
|
27
|
-
builder (~> 3.0.0)
|
28
|
-
activerecord (3.2.13)
|
29
|
-
activemodel (= 3.2.13)
|
30
|
-
activesupport (= 3.2.13)
|
31
|
-
arel (~> 3.0.2)
|
32
|
-
tzinfo (~> 0.3.29)
|
33
|
-
activeresource (3.2.13)
|
34
|
-
activemodel (= 3.2.13)
|
35
|
-
activesupport (= 3.2.13)
|
36
|
-
activesupport (3.2.13)
|
37
|
-
i18n (= 0.6.1)
|
38
|
-
multi_json (~> 1.0)
|
39
|
-
arel (3.0.2)
|
40
|
-
builder (3.0.4)
|
41
|
-
capybara (1.1.4)
|
42
|
-
mime-types (>= 1.16)
|
43
|
-
nokogiri (>= 1.3.3)
|
44
|
-
rack (>= 1.0.0)
|
45
|
-
rack-test (>= 0.5.4)
|
46
|
-
selenium-webdriver (~> 2.0)
|
47
|
-
xpath (~> 0.1.4)
|
48
|
-
childprocess (0.3.9)
|
49
|
-
ffi (~> 1.0, >= 1.0.11)
|
50
|
-
cucumber (1.3.8)
|
51
|
-
builder (>= 2.1.2)
|
52
|
-
diff-lcs (>= 1.1.3)
|
53
|
-
gherkin (~> 2.12.1)
|
54
|
-
multi_json (>= 1.7.5, < 2.0)
|
55
|
-
multi_test (>= 0.0.2)
|
56
|
-
cucumber-rails (1.4.0)
|
57
|
-
capybara (>= 1.1.2)
|
58
|
-
cucumber (>= 1.2.0)
|
59
|
-
nokogiri (>= 1.5.0)
|
60
|
-
rails (>= 3.0.0)
|
61
|
-
diff-lcs (1.2.4)
|
62
|
-
erubis (2.7.0)
|
63
|
-
ffi (1.9.0)
|
64
|
-
gherkin (2.12.1)
|
65
|
-
multi_json (~> 1.3)
|
66
|
-
hike (1.2.3)
|
67
|
-
i18n (0.6.1)
|
68
|
-
journey (1.0.4)
|
69
|
-
json (1.8.0)
|
70
|
-
mail (2.5.4)
|
71
|
-
mime-types (~> 1.16)
|
72
|
-
treetop (~> 1.4.8)
|
73
|
-
mime-types (1.25)
|
74
|
-
mini_portile (0.5.1)
|
75
|
-
multi_json (1.8.0)
|
76
|
-
multi_test (0.0.2)
|
77
|
-
nokogiri (1.6.0)
|
78
|
-
mini_portile (~> 0.5.0)
|
79
|
-
polyglot (0.3.3)
|
80
|
-
rack (1.4.5)
|
81
|
-
rack-cache (1.2)
|
82
|
-
rack (>= 0.4)
|
83
|
-
rack-ssl (1.3.3)
|
84
|
-
rack
|
85
|
-
rack-test (0.6.2)
|
86
|
-
rack (>= 1.0)
|
87
|
-
rails (3.2.13)
|
88
|
-
actionmailer (= 3.2.13)
|
89
|
-
actionpack (= 3.2.13)
|
90
|
-
activerecord (= 3.2.13)
|
91
|
-
activeresource (= 3.2.13)
|
92
|
-
activesupport (= 3.2.13)
|
93
|
-
bundler (~> 1.0)
|
94
|
-
railties (= 3.2.13)
|
95
|
-
railties (3.2.13)
|
96
|
-
actionpack (= 3.2.13)
|
97
|
-
activesupport (= 3.2.13)
|
98
|
-
rack-ssl (~> 1.3.2)
|
99
|
-
rake (>= 0.8.7)
|
100
|
-
rdoc (~> 3.4)
|
101
|
-
thor (>= 0.14.6, < 2.0)
|
102
|
-
rake (10.1.0)
|
103
|
-
rdoc (3.12.2)
|
104
|
-
json (~> 1.4)
|
105
|
-
rubyzip (0.9.9)
|
106
|
-
selenium-webdriver (2.35.1)
|
107
|
-
childprocess (>= 0.2.5)
|
108
|
-
multi_json (~> 1.0)
|
109
|
-
rubyzip (< 1.0.0)
|
110
|
-
websocket (~> 1.0.4)
|
111
|
-
sprockets (2.2.2)
|
112
|
-
hike (~> 1.2)
|
113
|
-
multi_json (~> 1.0)
|
114
|
-
rack (~> 1.0)
|
115
|
-
tilt (~> 1.1, != 1.3.0)
|
116
|
-
thor (0.18.1)
|
117
|
-
tilt (1.4.1)
|
118
|
-
treetop (1.4.15)
|
119
|
-
polyglot
|
120
|
-
polyglot (>= 0.3.1)
|
121
|
-
tzinfo (0.3.37)
|
122
|
-
websocket (1.0.7)
|
123
|
-
xpath (0.1.4)
|
124
|
-
nokogiri (~> 1.3)
|
125
|
-
|
126
|
-
PLATFORMS
|
127
|
-
ruby
|
128
|
-
|
129
|
-
DEPENDENCIES
|
130
|
-
spreewald!
|