-
Notifications
You must be signed in to change notification settings - Fork 0
/
stardate_steps.rb
65 lines (52 loc) · 2.07 KB
/
stardate_steps.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
When(/^the tng stardate "([^"]*)" is converted$/) do |value|
on(Stardate).convert_tng_stardate(value)
@actual = on(Stardate).calculate_tng_stardate(value)
end
When(/^the tng era (\d+\.\d+) is converted$/) do |value|
on(Stardate).convert_tng_stardate(value)
@actual = on(Stardate).calculate_tng_stardate(value)
end
When(/^the tng stardate "([^"]*)" is converted with leap year$/) do |value|
on(Stardate).convert_tng_stardate_with_leap_year(value)
end
When(/^converting a tos era stardate$/) do
on(Stardate).set_tos_era
end
Then(/^the displayed and calculated calendar year should be (\d+)$/) do |expected_year|
expect(@context.displayed_calendar_date).to include(expected_year.to_s)
expect(@actual.year).to eq(expected_year)
end
Then(/^the displayed calendar response should contain "([^"]*)"$/) do |date|
expect(@context.displayed_calendar_date).to include(date)
end
Then(/^the calculated calendar year should be "([^"]*)"$/) do |expected_year|
#on(Stardate).verify_calculated_calendar_year(@actual, year)
expect(@actual.year).to eq(expected_year)
end
Then(/^the calculated calendar month sould be "([^"]*)"$/) do |expected_month|
expect(@actual.month_name).to eq(expected_month)
end
Then(/^the calculated calendar day should be "([^"]*)"$/) do |expected_day|
expect(@actual.day).to eq(expected_day)
end
Then(/^there is no option to calculate stardates per year$/) do
on(Stardate).verify_no_per_year_option
end
Then(/^TOS conversions do not have a leap year option$/) do
on(Stardate) do |action|
action.set_tos_era
action.verify_no_per_year_option
end
end
Then(/^there are nine facts listed by default$/) do
puts on(Stardate).facts.text.as_list
end
Then(/^a blank stardate returns a warning message:$/) do |expected_message|
on(Stardate).convert_tng_stardate('')
expect(@context.error_message).to eq(expected_message)
end
Then(/^a stardate with (.*) returns a warning message:$/) do |condition, expected_message|
value = on(Stardate).calculate_invalid_stardate(condition)
expect(@context.error_message).to eq(expected_message)
condition_reporter(value)
end