Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/AgileVentures/WebsiteOne
Browse files Browse the repository at this point in the history
…into alternative_configure_docker
  • Loading branch information
mattwr18 committed Jul 31, 2018
2 parents a662246 + 068ecdd commit b560cf0
Show file tree
Hide file tree
Showing 11 changed files with 90 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ruby '2.5.1'

gem 'rails', '~> 5.1'
gem 'acts-as-taggable-on'
gem 'acts_as_follower', git: 'https://github.com/tcocca/acts_as_follower.git'
gem 'acts_as_follower', git: 'https://github.com/AgileVentures/acts_as_follower.git'
gem 'acts_as_tree'
gem 'acts_as_votable', '~> 0.11.1'
gem 'airbrake'
Expand Down
16 changes: 8 additions & 8 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
GIT
remote: https://github.com/AgileVentures/acts_as_follower.git
revision: 894b44451c609a9facfdb8a15bca4fc17ea1eb76
specs:
acts_as_follower (0.2.1)
activerecord (>= 4.0)

GIT
remote: https://github.com/AgileVentures/codeclimate_badges
revision: 88f15dfae8679a7895e8fa3cf6a9cb39f665745e
Expand All @@ -13,13 +20,6 @@ GIT
coffee-rails (>= 3.2.2)
railties (>= 3.0)

GIT
remote: https://github.com/tcocca/acts_as_follower.git
revision: c5ac7b9601c4af01eb4d9112330b27be4d694ecc
specs:
acts_as_follower (0.2.1)
activerecord (>= 4.0)

GEM
remote: https://rubygems.org/
specs:
Expand Down Expand Up @@ -71,7 +71,7 @@ GEM
airbrake-ruby (~> 2.10)
airbrake-ruby (2.10.0)
andand (1.3.3)
apipie-rails (0.5.9)
apipie-rails (0.5.10)
rails (>= 4.1)
arel (8.0.0)
autoprefixer-rails (8.1.0)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/projects_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 10 additions & 0 deletions app/views/projects/_connections.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,14 @@
<% else %>
<p><i class="fa fa-gear fa-lg"></i> <span class="small">not linked to IssueTracker</span></p>
<% end %>

<% if @project.slack_channel_name.present? %>
<p><i class="fa fa-slack" aria-hidden="true"></i>
<span class="small">
<%= link_to "#{@project.title} ", "https://agileventures.slack.com/app_redirect?channel=#{@project.slack_channel_name}" %>on Slack
</span>
</p>
<% else %>
<p><i class="fa fa-gear fa-lg"></i> <span class="small">not linked to Slack</span></p>
<% end %>
</aside>
4 changes: 3 additions & 1 deletion app/views/projects/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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? %>
<div class="form-group">
<h3>New project checklist</h3>
Expand All @@ -40,4 +42,4 @@
</div>
<% end %>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddSlackChannelNameToProjects < ActiveRecord::Migration[5.1]
def change
add_column :projects, :slack_channel_name, :string
end
end
3 changes: 2 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20180721104321) do
ActiveRecord::Schema.define(version: 20180729040001) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down Expand Up @@ -184,6 +184,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
Expand Down
44 changes: 44 additions & 0 deletions features/projects/connections.feature
Original file line number Diff line number Diff line change
@@ -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"
4 changes: 3 additions & 1 deletion features/projects/create_projects.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -35,6 +36,7 @@ Feature: Create projects
And I fill in "Description" with "<description>"
And I fill in "GitHub url (primary)" with "<gh_link>"
And I fill in "Issue Tracker link" with "<pt_link>"
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 "<title>"
Expand All @@ -46,6 +48,7 @@ Feature: Create projects
| ACTIVE |
And I should see a link to "<title>" on github
And I should see a link to "<title>" on Pivotal Tracker
And I should see a link to the slack channel for "<title>"

Examples:
| title | description | gh_link | pt_link |
Expand Down Expand Up @@ -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

8 changes: 8 additions & 0 deletions features/projects/edit_project.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand All @@ -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."
7 changes: 5 additions & 2 deletions features/step_definitions/projects_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b560cf0

Please sign in to comment.