Skip to content

Commit b560cf0

Browse files
committed
Merge branch 'develop' of https://github.com/AgileVentures/WebsiteOne into alternative_configure_docker
2 parents a662246 + 068ecdd commit b560cf0

11 files changed

+90
-15
lines changed

Gemfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ ruby '2.5.1'
44

55
gem 'rails', '~> 5.1'
66
gem 'acts-as-taggable-on'
7-
gem 'acts_as_follower', git: 'https://github.com/tcocca/acts_as_follower.git'
7+
gem 'acts_as_follower', git: 'https://github.com/AgileVentures/acts_as_follower.git'
88
gem 'acts_as_tree'
99
gem 'acts_as_votable', '~> 0.11.1'
1010
gem 'airbrake'

Gemfile.lock

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
GIT
2+
remote: https://github.com/AgileVentures/acts_as_follower.git
3+
revision: 894b44451c609a9facfdb8a15bca4fc17ea1eb76
4+
specs:
5+
acts_as_follower (0.2.1)
6+
activerecord (>= 4.0)
7+
18
GIT
29
remote: https://github.com/AgileVentures/codeclimate_badges
310
revision: 88f15dfae8679a7895e8fa3cf6a9cb39f665745e
@@ -13,13 +20,6 @@ GIT
1320
coffee-rails (>= 3.2.2)
1421
railties (>= 3.0)
1522

16-
GIT
17-
remote: https://github.com/tcocca/acts_as_follower.git
18-
revision: c5ac7b9601c4af01eb4d9112330b27be4d694ecc
19-
specs:
20-
acts_as_follower (0.2.1)
21-
activerecord (>= 4.0)
22-
2323
GEM
2424
remote: https://rubygems.org/
2525
specs:
@@ -71,7 +71,7 @@ GEM
7171
airbrake-ruby (~> 2.10)
7272
airbrake-ruby (2.10.0)
7373
andand (1.3.3)
74-
apipie-rails (0.5.9)
74+
apipie-rails (0.5.10)
7575
rails (>= 4.1)
7676
arel (8.0.0)
7777
autoprefixer-rails (8.1.0)

app/controllers/projects_controller.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,6 @@ def get_current_stories
107107
end
108108

109109
def project_params
110-
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])
110+
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])
111111
end
112112
end

app/views/projects/_connections.html.erb

+10
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,14 @@
1515
<% else %>
1616
<p><i class="fa fa-gear fa-lg"></i> <span class="small">not linked to IssueTracker</span></p>
1717
<% end %>
18+
19+
<% if @project.slack_channel_name.present? %>
20+
<p><i class="fa fa-slack" aria-hidden="true"></i>
21+
<span class="small">
22+
<%= link_to "#{@project.title} ", "https://agileventures.slack.com/app_redirect?channel=#{@project.slack_channel_name}" %>on Slack
23+
</span>
24+
</p>
25+
<% else %>
26+
<p><i class="fa fa-gear fa-lg"></i> <span class="small">not linked to Slack</span></p>
27+
<% end %>
1828
</aside>

app/views/projects/_form.html.erb

+3-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222

2323
<%= awesome_text_field f, :pivotaltracker_url, label_text: 'Issue Tracker link', placeholder: 'https://www.pivotaltracker.com/s/projects/id' %>
2424

25+
<%= awesome_text_field f, :slack_channel_name, label_text: 'Slack channel name', placeholder: 'project_slack_channel_name' %>
26+
2527
<% if @project.new_record? %>
2628
<div class="form-group">
2729
<h3>New project checklist</h3>
@@ -40,4 +42,4 @@
4042
</div>
4143
<% end %>
4244
</div>
43-
</div>
45+
</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class AddSlackChannelNameToProjects < ActiveRecord::Migration[5.1]
2+
def change
3+
add_column :projects, :slack_channel_name, :string
4+
end
5+
end

db/schema.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#
1111
# It's strongly recommended that you check this file into your version control system.
1212

13-
ActiveRecord::Schema.define(version: 20180721104321) do
13+
ActiveRecord::Schema.define(version: 20180729040001) do
1414

1515
# These are extensions that must be enabled in order to support this database
1616
enable_extension "plpgsql"
@@ -184,6 +184,7 @@
184184
t.integer "commit_count", default: 0
185185
t.string "image_url"
186186
t.datetime "last_github_update"
187+
t.string "slack_channel_name"
187188
t.index ["slug"], name: "index_projects_on_slug", unique: true
188189
t.index ["user_id"], name: "index_projects_on_user_id"
189190
end

features/projects/connections.feature

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
Feature: Projects should show links to the connected APIs
2+
As a User
3+
So that I can easily navigate to Project apps
4+
I want to see all connected app links on the show page
5+
6+
Background:
7+
Given the following users exist
8+
| first_name | last_name | email | receive_mailings |
9+
| Bill | Bob | Bill@example.com | true |
10+
11+
Given the following projects exist:
12+
| title | description | status | author | pivotaltracker_url | github_url | slack_channel_name |
13+
| hello | earthlings | active | Bill | https://www.pivotaltracker.com/n/projects/742821 | https://github.com/hello | hello_earthlings |
14+
| Bat Man | All bat | active | Bill | | | |
15+
16+
Scenario: I can see a link to the GitHub project page
17+
When I go to the "hello" project "show" page
18+
Then I should see "hello on GitHub"
19+
And I should see a link to "hello" on github
20+
21+
Scenario: I can see when a project is not connected to GitHub
22+
When I go to the "Bat Man" project "show" page
23+
Then I should not see "Bat Man on GitHub"
24+
And I should see "not linked to GitHub"
25+
26+
Scenario: I can see a link to the projects issue tracker
27+
When I go to the "hello" project "show" page
28+
Then I should see "hello on IssueTracker"
29+
And I should see a link to "hello" on Pivotal Tracker
30+
31+
Scenario: I can see when a project is not connected to issue tracker
32+
When I go to the "Bat Man" project "show" page
33+
Then I should not see "Bat Man on IssueTracker"
34+
And I should see "not linked to IssueTracker"
35+
36+
Scenario: I can see a link to the projects slack channel
37+
When I go to the "hello" project "show" page
38+
Then I should see "hello on Slack"
39+
And I should see a link to the slack channel for "hello"
40+
41+
Scenario: I can see when a project is not connected to slack
42+
When I go to the "Bat Man" project "show" page
43+
Then I should not see "Bat Man on Slack"
44+
And I should see "not linked to Slack"

features/projects/create_projects.feature

+3-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Feature: Create projects
2626
| Status |
2727
| GitHub url (primary) |
2828
| Issue Tracker link |
29+
| Slack channel name |
2930

3031
Scenario Outline: Saving a new project: success
3132
Given I have logged in
@@ -35,6 +36,7 @@ Feature: Create projects
3536
And I fill in "Description" with "<description>"
3637
And I fill in "GitHub url (primary)" with "<gh_link>"
3738
And I fill in "Issue Tracker link" with "<pt_link>"
39+
And I fill in "Slack channel name" with "slackin"
3840
And I select "Status" to "Active"
3941
And I click the "Submit" button
4042
Then I should be on the "Show" page for project "<title>"
@@ -46,6 +48,7 @@ Feature: Create projects
4648
| ACTIVE |
4749
And I should see a link to "<title>" on github
4850
And I should see a link to "<title>" on Pivotal Tracker
51+
And I should see a link to the slack channel for "<title>"
4952

5053
Examples:
5154
| title | description | gh_link | pt_link |
@@ -83,4 +86,3 @@ Feature: Create projects
8386
| ACTIVE |
8487
And I should see a link to "multiple repo project" on github
8588
And I should see a link to "multiple repo project" on Pivotal Tracker
86-

features/projects/edit_project.feature

+8
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,22 @@ Feature: Edit Project
3333
When I click "Back"
3434
Then I should be on the "Show" page for project "hello mars"
3535

36+
@javascript
3637
Scenario: Updating a project: success
3738
Given I have logged in
3839
And I am on the "Edit" page for project "hello mars"
3940
And I fill in "Description" with "Hello, Uranus!"
41+
And I click "Add more repos"
4042
And I fill in "GitHub url (primary)" with "https://github.com/google/instant-hangouts"
4143
And I fill in "Issue Tracker link" with "https://www.pivotaltracker.com/s/projects/853345"
44+
And I fill in "Slack channel name" with "slackin"
4245
And I click the "Submit" button
4346
Then I should be on the "Show" page for project "hello mars"
4447
And I should see a success flash "Project was successfully updated."
4548
And I should see "Hello, Uranus!"
4649
And I should see a link to "hello mars" on github
4750
And I should see a link to "hello mars" on Pivotal Tracker
51+
And I should see a link to the slack channel for "hello mars"
4852

4953
Scenario: Saving a project: failure
5054
Given I have logged in
@@ -53,9 +57,11 @@ Feature: Edit Project
5357
And I click the "Submit" button
5458
Then I should see "Project was not updated."
5559

60+
@javascript
5661
Scenario: Update GitHub url if valid
5762
Given I have logged in
5863
And I am on the "Edit" page for project "hello mars"
64+
And I click "Add more repos"
5965
And I fill in "GitHub url (primary)" with "https://github.com/google/instant-hangouts"
6066
And I click the "Submit" button
6167
Then I should be on the "Show" page for project "hello mars"
@@ -69,9 +75,11 @@ Feature: Edit Project
6975
Then I should be on the "Show" page for project "hello mars"
7076
And I should see a link to "hello mars" on Pivotal Tracker
7177

78+
@javascript
7279
Scenario: Reject GitHub url update if invalid
7380
Given I have logged in
7481
And I am on the "Edit" page for project "hello mars"
82+
And I click "Add more repos"
7583
And I fill in "GitHub url (primary)" with "https:/github.com/google/instant-hangouts"
7684
And I click the "Submit" button
7785
Then I should see "Project was not updated."

features/step_definitions/projects_steps.rb

+5-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
end
1414
if hash[:github_url].present?
1515
project.source_repositories.build(url: hash[:github_url])
16-
else
17-
project.source_repositories.build
1816
end
1917
if hash[:tags]
2018
project.tag_list.add(hash[:tags], parse: true)
@@ -116,6 +114,11 @@
116114
step %Q{I #{option} see link "#{object.title}"}
117115
end
118116

117+
Then /^I should see a link to the slack channel for "([^"]*)"$/ do |project_title|
118+
project = Project.find_by title: project_title
119+
expect(page).to have_link project_title, href: "https://agileventures.slack.com/app_redirect?channel=#{project.slack_channel_name}"
120+
end
121+
119122
Given(/^The project "([^"]*)" has (\d+) (.*)$/) do |title, num, item|
120123
project = Project.find_by_title(title)
121124
case item.downcase.pluralize

0 commit comments

Comments
 (0)