This repository was archived by the owner on Oct 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexpressive_example.html
More file actions
64 lines (56 loc) · 2.52 KB
/
expressive_example.html
File metadata and controls
64 lines (56 loc) · 2.52 KB
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Expressive example</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.2.0/styles/monokai-sublime.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.2.0/highlight.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.2.0/languages/ruby.min.js"></script>
<script>hljs.highlightAll();</script>
</head>
<body>
<pre>
<code class="language-ruby" style="font-size: 1.5em;">
scenario "can create an adjustment for an activity" do
given_an_active_report_exists
and_i_am_looking_at_the_activity_financials_tab
when_i_submit_the_new_adjustment_form_correctly
then_i_expect_to_see_the_new_adjustment
end
def given_an_active_report_exists
create(:report, :active, fund: activity.associated_fund, organisation: activity.organisation, financial_quarter: 1, financial_year: 2021)
end
def and_i_am_looking_at_the_activity_financials_tab
visit organisation_activity_financials_path(organisation_id: activity.organisation.id, activity_id: activity.id)
end
def when_i_submit_the_new_adjustment_form_correctly
click_on t("page_content.adjustment.button.create")
fill_in "adjustment_form[value]", with: "100.01"
select "Actual", from: "adjustment_form[adjustment_type]"
choose "2", name: "adjustment_form[financial_quarter]"
select "2021-2022", from: "adjustment_form[financial_year]"
fill_in "adjustment_form[comment]", with: "There was a typo in the original 'actual'"
click_on(t("default.button.submit"))
end
def when_i_submit_the_new_adjustment_form_incorrectly
click_on t("page_content.adjustment.button.create")
click_on(t("default.button.submit"))
end
def then_i_expect_to_see_the_new_adjustment
expect(page).to have_content(t("action.adjustment.create.success"))
adjustment = activity.adjustments.first
within ".adjustments" do
within "#adjustment_#{adjustment.id}" do
expect(page).to have_css(".financial-period", text: "FQ2 2021-2022")
expect(page).to have_css(".value", text: "£100.01")
expect(page).to have_css(".type", text: "Actual")
expect(page).to have_css(
".report a[href='#{report_path(adjustment.report)}']",
text: "Report"
)
end
end
</code>
</pre>
</body>
</html>