Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Field Slip system test adjustments #2141

Merged
merged 5 commits into from
Jun 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions app/views/controllers/field_slips/_field_slip.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
<%= :field_slip_no_project.t %>
<% end %>
<br/>
<% if field_slip.user %>
<% if (usr = field_slip.user) %>
<strong><%= :field_slip_creator.t %>:</strong>
<%= link_to(field_slip.user.legal_name, user_path(field_slip.user_id)) %><br/>
<%= user_link(usr, usr.legal_name) %><br/>
<% end %>
<strong><%= :OBSERVATION.t %>:</strong>
<% if field_slip.observation %>
<%= link_to(field_slip.observation.unique_format_name.t, observation_path(field_slip.observation)) %>
<% if (obs = field_slip.observation) %>
<%= link_to(obs.unique_format_name.t, observation_path(obs),
class: "observation_link_#{obs.id}") %>
<ul class="row list-unstyled">
<%= render(partial: "shared/matrix_box",
locals: { object: field_slip.observation,
Expand Down
8 changes: 5 additions & 3 deletions app/views/controllers/field_slips/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
<% @field_slips.each do |field_slip| %>
<strong><%= :field_slip_code.t %>:</strong>
<%= field_slip.code %>
<%= render field_slip %>
<%= link_to :field_slip_show.t, field_slip %>
<%= render(field_slip) %>
<%= link_to(:field_slip_show.t, field_slip,
class: "field_slip_link_#{field_slip.id}") %>
<hr/>
<% end %>
</div>

<%= link_to :field_slip_new.t, new_field_slip_path %>
<%= link_to(:field_slip_new.t, new_field_slip_path,
class: "new_field_slip_link") %>
40 changes: 39 additions & 1 deletion test/integration/capybara/field_slips_integration_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,46 @@

require("test_helper")

# Test relating to projects
# Tests relating to field_slip UI, and projects
class FieldSlipsIntegrationTest < CapybaraIntegrationTestCase
setup do
@field_slip = field_slips(:field_slip_one)
end

def test_visiting_the_index
login!(mary)
visit(field_slips_url)
assert_selector("h1", text: :FIELD_SLIPS.t)
end

def test_navigating_to_show_field_slip
login!(mary)
visit(field_slips_url)
first(class: /field_slip_link_/).click
assert_text(:field_slip_index.t)
end

def test_updating_a_field_slip
login!(mary)
visit(field_slip_url(@field_slip))

click_on(:field_slip_edit.t, match: :first)

fill_in(:field_slip_code.t, with: @field_slip.code)
select(@field_slip.project.title, from: :PROJECT.t)
click_on(:field_slip_keep_obs.t)

assert_text(:field_slip_updated.t)
end

def test_destroying_a_field_slip
login!(mary)
visit(field_slip_url(@field_slip))
click_on(:field_slip_destroy.t, match: :first)

assert_text(:field_slip_destroyed.t)
end

def test_new_observation_violates_project_constraints
project = projects(:falmouth_2023_09_project)
user = users(:roy)
Expand Down
42 changes: 0 additions & 42 deletions test/system/field_slips_test.rb

This file was deleted.

Loading