Skip to content

Commit

Permalink
Merge pull request #3 from msun908/minjoo
Browse files Browse the repository at this point in the history
cucumber test done for select_teams ver.1
  • Loading branch information
imnotanoob authored Oct 26, 2017
2 parents 50a8d72 + af683e4 commit 5292eae
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/views/group/create.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
</td>

<td>Approved</td>
<% d = Discussion.find_by_id(t.discussion_id) %>
<% d = Discussion.find_by_number(t.discussion_id) %>
<td>
<%= d.info %>
</td>
Expand Down
41 changes: 41 additions & 0 deletions features/admins/add_group.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
Feature: admin can create a Group by selecting two teams

As an administrator
So I can make a group
I want to select two teams and create a group

Background:
Given the following admins exist
| name | email |
| Bob | supreme_ruler@aol.com |
And I am on the login page
And I log in as an admin with email "supreme_ruler@aol.com"
And the following teams exist
| submission_id | approved | passcode | submitted | discussion_id |
| 1 | true | "asdf" | true | 79997 |
| 2 | true | "fdsa" | true | 79997 |
| 3 | true | "dididi" | true | 89998 |
| 4 | true | "tiredmj" | true | 89998 |
And the following discussions exist
#number, time, day, capacity, seats_open
| number | time | day | capacity | seats_open |
| 79997 | 3:00 PM | Tuesday | 24 | 24 |
| 89998 | 4:00 PM | Tuesday | 24 | 24 |

Scenario: An admin merges two valid teams in the same discussion
Given I press "Create Groups"
When I check "team_1"
And I check "team_2"
And I press "Create Group"
Then I should not see "team_1"
And I should not see "team_2"
And I should see "3"
And I should see "4"

Scenario: An admin merges two valid teams in different discussions
Given I press "Create Groups"
When I check "team_1"
And I check "team_3"
And I press "Create Group"
Then I should see "1"
And I should see "3"
7 changes: 7 additions & 0 deletions features/step_definitions/enrollme_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@
end
end

Given /^the following teams exist$/ do |table|
table.rows.each do |submission_id, approved, passcode, submitted, discussion_id|
next if submission_id == :submission_id # skipping table header
Team.create!(:submission_id => submission_id.to_i, :approved => approved=="true", :passcode => passcode, :submitted => submitted=="true", :discussion_id => discussion_id.to_i)
end
end

Given /^the following groups exist$/ do |table|
table.rows.each do |team1_id, team2_id, discussion|
next if team1_id == :team1_id # skipping table header
Expand Down

0 comments on commit 5292eae

Please sign in to comment.