diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 4d1ce5712..2730bce6d 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -107,6 +107,6 @@ def get_current_stories
end
def project_params
- params.require(:project).permit(:title, :description, :pitch, :created, :status, :user_id, :github_url, :pivotaltracker_url, :pivotaltracker_id, :image_url, source_repositories_attributes: [:id, :url, :_destroy])
+ params.require(:project).permit(:title, :description, :pitch, :created, :status, :user_id, :github_url, :pivotaltracker_url, :pivotaltracker_id, :slack_channel_name, :image_url, source_repositories_attributes: [:id, :url, :_destroy])
end
end
diff --git a/app/views/projects/_connections.html.erb b/app/views/projects/_connections.html.erb
index e00e43b17..05658ad68 100644
--- a/app/views/projects/_connections.html.erb
+++ b/app/views/projects/_connections.html.erb
@@ -15,4 +15,14 @@
<% else %>
not linked to IssueTracker
<% end %>
+
+ <% if @project.slack_channel_name.present? %>
+
+
+ <%= link_to "#{@project.title} ", "https://agileventures.slack.com/app_redirect?channel=#{@project.slack_channel_name}" %>on Slack
+
+
+ <% else %>
+ not linked to Slack
+ <% end %>
diff --git a/app/views/projects/_form.html.erb b/app/views/projects/_form.html.erb
index 75c06c300..191e73660 100644
--- a/app/views/projects/_form.html.erb
+++ b/app/views/projects/_form.html.erb
@@ -22,6 +22,8 @@
<%= awesome_text_field f, :pivotaltracker_url, label_text: 'Issue Tracker link', placeholder: 'https://www.pivotaltracker.com/s/projects/id' %>
+ <%= awesome_text_field f, :slack_channel_name, label_text: 'Slack channel name', placeholder: 'project_slack_channel_name' %>
+
<% if @project.new_record? %>
New project checklist
@@ -40,4 +42,4 @@
<% end %>
-
\ No newline at end of file
+
diff --git a/db/migrate/20180729040001_add_slack_channel_name_to_projects.rb b/db/migrate/20180729040001_add_slack_channel_name_to_projects.rb
new file mode 100644
index 000000000..e38ea0229
--- /dev/null
+++ b/db/migrate/20180729040001_add_slack_channel_name_to_projects.rb
@@ -0,0 +1,5 @@
+class AddSlackChannelNameToProjects < ActiveRecord::Migration[5.1]
+ def change
+ add_column :projects, :slack_channel_name, :string
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 88c99919d..2c41b51c2 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20180515093331) do
+ActiveRecord::Schema.define(version: 20180729040001) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -183,6 +183,7 @@
t.integer "commit_count", default: 0
t.string "image_url"
t.datetime "last_github_update"
+ t.string "slack_channel_name"
t.index ["slug"], name: "index_projects_on_slug", unique: true
t.index ["user_id"], name: "index_projects_on_user_id"
end
diff --git a/features/projects/connections.feature b/features/projects/connections.feature
new file mode 100644
index 000000000..ba2c69bf1
--- /dev/null
+++ b/features/projects/connections.feature
@@ -0,0 +1,44 @@
+Feature: Projects should show links to the connected APIs
+ As a User
+ So that I can easily navigate to Project apps
+ I want to see all connected app links on the show page
+
+ Background:
+ Given the following users exist
+ | first_name | last_name | email | receive_mailings |
+ | Bill | Bob | Bill@example.com | true |
+
+ Given the following projects exist:
+ | title | description | status | author | pivotaltracker_url | github_url | slack_channel_name |
+ | hello | earthlings | active | Bill | https://www.pivotaltracker.com/n/projects/742821 | https://github.com/hello | hello_earthlings |
+ | Bat Man | All bat | active | Bill | | | |
+
+ Scenario: I can see a link to the GitHub project page
+ When I go to the "hello" project "show" page
+ Then I should see "hello on GitHub"
+ And I should see a link to "hello" on github
+
+ Scenario: I can see when a project is not connected to GitHub
+ When I go to the "Bat Man" project "show" page
+ Then I should not see "Bat Man on GitHub"
+ And I should see "not linked to GitHub"
+
+ Scenario: I can see a link to the projects issue tracker
+ When I go to the "hello" project "show" page
+ Then I should see "hello on IssueTracker"
+ And I should see a link to "hello" on Pivotal Tracker
+
+ Scenario: I can see when a project is not connected to issue tracker
+ When I go to the "Bat Man" project "show" page
+ Then I should not see "Bat Man on IssueTracker"
+ And I should see "not linked to IssueTracker"
+
+ Scenario: I can see a link to the projects slack channel
+ When I go to the "hello" project "show" page
+ Then I should see "hello on Slack"
+ And I should see a link to the slack channel for "hello"
+
+ Scenario: I can see when a project is not connected to slack
+ When I go to the "Bat Man" project "show" page
+ Then I should not see "Bat Man on Slack"
+ And I should see "not linked to Slack"
diff --git a/features/projects/create_projects.feature b/features/projects/create_projects.feature
index 3b8d8f3ab..40c91a21f 100644
--- a/features/projects/create_projects.feature
+++ b/features/projects/create_projects.feature
@@ -26,6 +26,7 @@ Feature: Create projects
| Status |
| GitHub url (primary) |
| Issue Tracker link |
+ | Slack channel name |
Scenario Outline: Saving a new project: success
Given I have logged in
@@ -35,6 +36,7 @@ Feature: Create projects
And I fill in "Description" with ""
And I fill in "GitHub url (primary)" with ""
And I fill in "Issue Tracker link" with ""
+ And I fill in "Slack channel name" with "slackin"
And I select "Status" to "Active"
And I click the "Submit" button
Then I should be on the "Show" page for project ""
@@ -46,6 +48,7 @@ Feature: Create projects
| ACTIVE |
And I should see a link to "" on github
And I should see a link to "" on Pivotal Tracker
+ And I should see a link to the slack channel for ""
Examples:
| title | description | gh_link | pt_link |
@@ -83,4 +86,3 @@ Feature: Create projects
| ACTIVE |
And I should see a link to "multiple repo project" on github
And I should see a link to "multiple repo project" on Pivotal Tracker
-
diff --git a/features/projects/edit_project.feature b/features/projects/edit_project.feature
index d744b7e91..ab1f69e68 100644
--- a/features/projects/edit_project.feature
+++ b/features/projects/edit_project.feature
@@ -33,18 +33,22 @@ Feature: Edit Project
When I click "Back"
Then I should be on the "Show" page for project "hello mars"
+ @javascript
Scenario: Updating a project: success
Given I have logged in
And I am on the "Edit" page for project "hello mars"
And I fill in "Description" with "Hello, Uranus!"
+ And I click "Add more repos"
And I fill in "GitHub url (primary)" with "https://github.com/google/instant-hangouts"
And I fill in "Issue Tracker link" with "https://www.pivotaltracker.com/s/projects/853345"
+ And I fill in "Slack channel name" with "slackin"
And I click the "Submit" button
Then I should be on the "Show" page for project "hello mars"
And I should see a success flash "Project was successfully updated."
And I should see "Hello, Uranus!"
And I should see a link to "hello mars" on github
And I should see a link to "hello mars" on Pivotal Tracker
+ And I should see a link to the slack channel for "hello mars"
Scenario: Saving a project: failure
Given I have logged in
@@ -53,9 +57,11 @@ Feature: Edit Project
And I click the "Submit" button
Then I should see "Project was not updated."
+ @javascript
Scenario: Update GitHub url if valid
Given I have logged in
And I am on the "Edit" page for project "hello mars"
+ And I click "Add more repos"
And I fill in "GitHub url (primary)" with "https://github.com/google/instant-hangouts"
And I click the "Submit" button
Then I should be on the "Show" page for project "hello mars"
@@ -69,9 +75,11 @@ Feature: Edit Project
Then I should be on the "Show" page for project "hello mars"
And I should see a link to "hello mars" on Pivotal Tracker
+ @javascript
Scenario: Reject GitHub url update if invalid
Given I have logged in
And I am on the "Edit" page for project "hello mars"
+ And I click "Add more repos"
And I fill in "GitHub url (primary)" with "https:/github.com/google/instant-hangouts"
And I click the "Submit" button
Then I should see "Project was not updated."
diff --git a/features/step_definitions/projects_steps.rb b/features/step_definitions/projects_steps.rb
index dcf0aa78d..5525aba4e 100644
--- a/features/step_definitions/projects_steps.rb
+++ b/features/step_definitions/projects_steps.rb
@@ -13,8 +13,6 @@
end
if hash[:github_url].present?
project.source_repositories.build(url: hash[:github_url])
- else
- project.source_repositories.build
end
if hash[:tags]
project.tag_list.add(hash[:tags], parse: true)
@@ -116,6 +114,11 @@
step %Q{I #{option} see link "#{object.title}"}
end
+Then /^I should see a link to the slack channel for "([^"]*)"$/ do |project_title|
+ project = Project.find_by title: project_title
+ expect(page).to have_link project_title, href: "https://agileventures.slack.com/app_redirect?channel=#{project.slack_channel_name}"
+end
+
Given(/^The project "([^"]*)" has (\d+) (.*)$/) do |title, num, item|
project = Project.find_by_title(title)
case item.downcase.pluralize