houston-core 0.6.3 → 0.7.0.beta
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile.lock +53 -63
- data/app/adapters/houston/adapters/error_tracker/errbit_adapter.rb +2 -2
- data/app/adapters/houston/adapters/ticket_tracker/github_adapter.rb +1 -1
- data/app/adapters/houston/adapters/ticket_tracker/unfuddle_adapter.rb +5 -5
- data/app/adapters/houston/adapters/version_control/git_adapter.rb +4 -4
- data/app/assets/javascripts/{app → houston/app}/boot.coffee +0 -0
- data/app/assets/javascripts/{app → houston/app}/emoji.coffee.erb +0 -0
- data/app/assets/javascripts/{app → houston/app}/infinite_scroll.coffee +0 -0
- data/app/assets/javascripts/{app → houston/app}/models/commit.coffee +0 -0
- data/app/assets/javascripts/{app → houston/app}/models/release.coffee +0 -0
- data/app/assets/javascripts/{app → houston/app}/models/task.coffee +0 -0
- data/app/assets/javascripts/{app → houston/app}/models/tester.coffee +0 -0
- data/app/assets/javascripts/{app → houston/app}/models/testing_note.coffee +0 -0
- data/app/assets/javascripts/{app → houston/app}/models/ticket.coffee +0 -0
- data/app/assets/javascripts/{app → houston/app}/models/user.coffee +0 -0
- data/app/assets/javascripts/{app → houston/app}/mousetrap-bind-scoped.js +0 -0
- data/app/assets/javascripts/{app → houston/app}/releases.coffee +0 -0
- data/app/assets/javascripts/{app → houston/app}/table_row_expander.coffee +0 -0
- data/app/assets/javascripts/{app → houston/app}/ticket_tracker_refresh.coffee +0 -0
- data/app/assets/javascripts/{app → houston/app}/views/_show_sprint_view.coffee +0 -0
- data/app/assets/javascripts/{app → houston/app}/views/_tickets_view.coffee +0 -0
- data/app/assets/javascripts/{app → houston/app}/views/all_tickets_view.coffee +0 -0
- data/app/assets/javascripts/{app → houston/app}/views/commit_view.coffee +0 -0
- data/app/assets/javascripts/{app → houston/app}/views/edit_sprint_view.coffee +0 -0
- data/app/assets/javascripts/{app → houston/app}/views/edit_ticket_view.coffee +0 -0
- data/app/assets/javascripts/{app → houston/app}/views/find_or_create_ticket_view.coffee +0 -0
- data/app/assets/javascripts/{app → houston/app}/views/keyboard_shortcuts_modal.coffee +0 -0
- data/app/assets/javascripts/{app → houston/app}/views/new_ticket_modal.coffee +0 -0
- data/app/assets/javascripts/{app → houston/app}/views/new_ticket_view.coffee +0 -0
- data/app/assets/javascripts/{app → houston/app}/views/problems_view.coffee +0 -0
- data/app/assets/javascripts/{app → houston/app}/views/testing_note_view.coffee +0 -0
- data/app/assets/javascripts/{app → houston/app}/views/testing_report_view.coffee +0 -0
- data/app/assets/javascripts/{app → houston/app}/views/testing_ticket_view.coffee +0 -0
- data/app/assets/javascripts/{app → houston/app}/views/ticket_modal_view.coffee +0 -0
- data/app/assets/javascripts/{application.js → houston/application.js} +1 -1
- data/app/assets/javascripts/{core → houston/core}/app.coffee +0 -0
- data/app/assets/javascripts/{core → houston/core}/burndown_chart.coffee +0 -0
- data/app/assets/javascripts/{core → houston/core}/core_ext/array.coffee +0 -0
- data/app/assets/javascripts/{core → houston/core}/core_ext/date.coffee +0 -0
- data/app/assets/javascripts/{core → houston/core}/core_ext/number.coffee +0 -0
- data/app/assets/javascripts/{core → houston/core}/errors.coffee +1 -1
- data/app/assets/javascripts/{core → houston/core}/handlebars_helpers.coffee +0 -0
- data/app/assets/javascripts/{core → houston/core}/helpers.coffee +0 -0
- data/app/assets/javascripts/{core → houston/core}/jquery_extensions.coffee +5 -3
- data/app/assets/javascripts/{core → houston/core}/stacked_area_graph.coffee +0 -0
- data/app/assets/javascripts/{core → houston/core}/stacked_bar_graph.coffee +0 -0
- data/app/assets/javascripts/{dashboard.js → houston/dashboard.js} +1 -1
- data/app/assets/javascripts/{dashboard → houston/dashboard}/refresher.coffee +0 -0
- data/app/assets/javascripts/{vendor.js → houston/vendor.js} +0 -0
- data/app/assets/stylesheets/{application.css → houston/application.css} +0 -0
- data/app/assets/stylesheets/{application → houston/application}/ansi.scss +0 -0
- data/app/assets/stylesheets/{application → houston/application}/commit.scss +0 -0
- data/app/assets/stylesheets/{application → houston/application}/emoji.scss +0 -0
- data/app/assets/stylesheets/{application → houston/application}/exceptions.scss +1 -1
- data/app/assets/stylesheets/{application → houston/application}/find_or_create_ticket.scss +0 -0
- data/app/assets/stylesheets/{application → houston/application}/follow_up.scss +0 -0
- data/app/assets/stylesheets/{application → houston/application}/forms.scss +0 -0
- data/app/assets/stylesheets/{application → houston/application}/freight_train.css.scss +0 -0
- data/app/assets/stylesheets/{application → houston/application}/full_screen.scss +0 -0
- data/app/assets/stylesheets/{application → houston/application}/github_repos.scss +0 -0
- data/app/assets/stylesheets/{application → houston/application}/infinite_scroll.scss +0 -0
- data/app/assets/stylesheets/houston/application/jobs.scss +5 -0
- data/app/assets/stylesheets/{application → houston/application}/keyboard_shortcuts.scss +0 -0
- data/app/assets/stylesheets/{application → houston/application}/markdown.scss +0 -0
- data/app/assets/stylesheets/{application → houston/application}/mobile.scss +0 -0
- data/app/assets/stylesheets/{application → houston/application}/modals.scss +0 -0
- data/app/assets/stylesheets/{application → houston/application}/navigation.scss +0 -0
- data/app/assets/stylesheets/{application → houston/application}/new_ticket_view.scss +0 -0
- data/app/assets/stylesheets/{application → houston/application}/omnibar.scss +0 -0
- data/app/assets/stylesheets/{application → houston/application}/project_banner_buttons.scss +0 -0
- data/app/assets/stylesheets/{application → houston/application}/project_tiles.scss +0 -0
- data/app/assets/stylesheets/{application → houston/application}/projects.css.scss +0 -0
- data/app/assets/stylesheets/{application → houston/application}/pull_requests.scss +0 -0
- data/app/assets/stylesheets/{application → houston/application}/queue.scss +0 -0
- data/app/assets/stylesheets/{application → houston/application}/release_form.scss +0 -0
- data/app/assets/stylesheets/{application → houston/application}/releases.scss +1 -1
- data/app/assets/stylesheets/{application → houston/application}/sortable_table.scss +0 -0
- data/app/assets/stylesheets/{application → houston/application}/sprint.scss +0 -0
- data/app/assets/stylesheets/{application → houston/application}/tables.scss +0 -0
- data/app/assets/stylesheets/{application → houston/application}/test.scss +0 -0
- data/app/assets/stylesheets/{application → houston/application}/test_run.scss +0 -0
- data/app/assets/stylesheets/{application → houston/application}/testing_report.scss +0 -0
- data/app/assets/stylesheets/{application → houston/application}/ticket.scss +0 -0
- data/app/assets/stylesheets/{application → houston/application}/ticket_modal.scss +0 -0
- data/app/assets/stylesheets/{application → houston/application}/tickets.scss +0 -0
- data/app/assets/stylesheets/{application → houston/application}/timeline.scss +0 -0
- data/app/assets/stylesheets/{application → houston/application}/tips.scss +0 -0
- data/app/assets/stylesheets/{application → houston/application}/typeahead.scss +0 -0
- data/app/assets/stylesheets/{application → houston/application}/uploading.scss +0 -0
- data/app/assets/stylesheets/{application → houston/application}/user_wall.scss +0 -0
- data/app/assets/stylesheets/{application → houston/application}/users.scss +0 -0
- data/app/assets/stylesheets/{application → houston/application}/welcome.scss +0 -0
- data/app/assets/stylesheets/{core → houston/core}/alerts.scss +0 -0
- data/app/assets/stylesheets/{core → houston/core}/avatars.scss +0 -0
- data/app/assets/stylesheets/{core → houston/core}/burndown_chart.scss +0 -0
- data/app/assets/stylesheets/{core → houston/core}/colors.scss.erb +0 -0
- data/app/assets/stylesheets/{core → houston/core}/misc.scss +3 -0
- data/app/assets/stylesheets/{core → houston/core}/octicons-icons.scss +0 -0
- data/app/assets/stylesheets/{core → houston/core}/octicons.scss.erb +0 -0
- data/app/assets/stylesheets/{core → houston/core}/overrides.scss +0 -0
- data/app/assets/stylesheets/{core → houston/core}/roboto.scss.erb +0 -0
- data/app/assets/stylesheets/{core → houston/core}/scores.scss +0 -0
- data/app/assets/stylesheets/{dashboard.css → houston/dashboard.css} +0 -0
- data/app/assets/stylesheets/{dashboard → houston/dashboard}/dashboard.scss +0 -0
- data/app/assets/stylesheets/{print.css.scss → houston/print.css.scss} +0 -0
- data/app/assets/stylesheets/{variables.scss → houston/variables.scss} +0 -0
- data/app/assets/stylesheets/{vendor.css → houston/vendor.css} +0 -0
- data/app/concerns/houston/props.rb +96 -0
- data/app/concerns/project_adapter.rb +1 -1
- data/app/controllers/api/v1/measurements_controller.rb +32 -0
- data/app/controllers/application_controller.rb +1 -1
- data/app/controllers/authorizations_controller.rb +61 -0
- data/app/controllers/github/pulls_controller.rb +1 -1
- data/app/controllers/jobs_controller.rb +30 -1
- data/app/controllers/oauth/providers_controller.rb +45 -0
- data/app/controllers/project_options_controller.rb +2 -2
- data/app/controllers/projects_controller.rb +3 -3
- data/app/controllers/releases_controller.rb +3 -3
- data/app/controllers/user_options_controller.rb +2 -2
- data/app/controllers/users_controller.rb +1 -2
- data/app/helpers/application_helper.rb +49 -3
- data/app/helpers/email_helper.rb +19 -1
- data/app/helpers/release_helper.rb +1 -1
- data/app/helpers/ticket_helper.rb +0 -32
- data/app/interactors/cache_key_dependencies.rb +3 -8
- data/app/mailers/view_mailer.rb +8 -8
- data/app/models/authorization.rb +54 -0
- data/app/models/commit.rb +1 -1
- data/app/models/error.rb +14 -0
- data/app/models/github/comment_event.rb +4 -4
- data/app/models/github/pull_request.rb +39 -17
- data/app/models/github/pull_request_event.rb +1 -7
- data/app/models/job.rb +81 -0
- data/app/models/measurement.rb +2 -1
- data/app/models/oauth/provider.rb +35 -0
- data/app/models/project.rb +12 -3
- data/app/models/slackdown.rb +1 -1
- data/app/models/user.rb +28 -35
- data/app/presenters/measurements_presenter.rb +26 -0
- data/app/presenters/project_presenter.rb +1 -1
- data/app/views/authorizations/_form.html.erb +33 -0
- data/app/views/authorizations/edit.html.erb +7 -0
- data/app/views/authorizations/granted.html.erb +7 -0
- data/app/views/authorizations/index.html.erb +47 -0
- data/app/views/authorizations/new.html.erb +7 -0
- data/app/views/configuration_error/_no_ticket_tracker.html.erb +1 -1
- data/app/views/github/pulls/index.html.erb +5 -1
- data/app/views/jobs/index.html.erb +72 -0
- data/app/views/jobs/show.html.erb +25 -32
- data/app/views/layouts/_navigation.html.erb +1 -1
- data/app/views/layouts/application.html.erb +14 -15
- data/app/views/layouts/dashboard.html.erb +9 -10
- data/app/views/layouts/minimal.html.erb +14 -15
- data/app/views/layouts/naked.html.erb +52 -0
- data/app/views/layouts/naked_dashboard.html.erb +9 -10
- data/app/views/oauth/providers/_form.html.erb +54 -0
- data/app/views/oauth/providers/edit.html.erb +7 -0
- data/app/views/oauth/providers/index.html.erb +41 -0
- data/app/views/oauth/providers/new.html.erb +7 -0
- data/app/views/projects/_form.html.erb +8 -9
- data/app/views/projects/index.html.erb +1 -1
- data/app/views/users/_form.html.erb +20 -19
- data/bin/rails +1 -1
- data/config/application.rb +11 -10
- data/config/boot.rb +1 -2
- data/config/environments/development.rb +8 -6
- data/config/environments/production.rb +11 -16
- data/config/environments/test.rb +5 -5
- data/config/initializers/assets.rb +17 -7
- data/config/initializers/cookies_serializer.rb +1 -1
- data/config/initializers/houston_async.rb +22 -4
- data/config/initializers/houston_report_exception.rb +16 -11
- data/config/initializers/houston_scheduler.rb +1 -1
- data/config/initializers/houston_try.rb +12 -0
- data/config/routes.rb +29 -19
- data/db/fixtures/projects.yml +2 -2
- data/db/migrate/20160317140151_remove_limit_from_users_invitation_token.rb +9 -0
- data/db/migrate/20160419230411_create_oauth_providers.rb +14 -0
- data/db/migrate/20160420000616_create_authorizations.rb +16 -0
- data/db/migrate/20160507135209_create_jobs.rb +14 -0
- data/db/migrate/20160507135846_create_errors_2.rb +12 -0
- data/db/migrate/20160510233329_add_closed_at_and_merged_at_to_pull_requests.rb +7 -0
- data/db/migrate/20160625203412_convert_user_view_options_to_props.rb +21 -0
- data/db/migrate/20160625221840_convert_project_extended_attributes_to_props.rb +32 -0
- data/db/migrate/20160625230420_move_users_unfuddle_id_to_props.rb +14 -0
- data/db/structure.sql +247 -4
- data/{houston.gemspec → houston-core.gemspec} +8 -9
- data/lib/configuration.rb +15 -43
- data/lib/houston/version.rb +1 -1
- data/lib/houston_observer.rb +2 -7
- data/lib/parallel_enumerable.rb +2 -8
- data/templates/new-instance/app/assets/javascripts/.keep +0 -0
- data/templates/new-instance/app/assets/javascripts/application.js +13 -0
- data/templates/new-instance/app/assets/stylesheets/.keep +0 -0
- data/templates/new-instance/app/assets/stylesheets/application.css +13 -0
- data/templates/new-instance/app/controllers/.keep +0 -0
- data/templates/new-instance/app/models/.keep +0 -0
- data/templates/new-instance/app/views/.keep +0 -0
- data/templates/new-instance/config/alerts/errs.rb +1 -1
- data/templates/new-instance/config/jobs/purge_jobs.rb +3 -0
- data/templates/new-instance/config/main.rb +1 -0
- data/templates/new-instance/config/routes.rb +5 -0
- data/templates/new-instance/config/triggers/github/publish_comments_on_slack.rb +3 -3
- data/templates/new-instance/lib/houston/engine.rb +25 -0
- data/test/acceptance/creating_a_release_test.rb +1 -1
- data/test/integration/ci_integration_test.rb +2 -2
- data/test/integration/commits_api_test.rb +1 -1
- data/test/unit/controllers/hooks_controller_test.rb +1 -6
- data/test/unit/controllers/project_options_controller_test.rb +11 -11
- data/test/unit/controllers/user_options_controller_test.rb +13 -13
- data/test/unit/models/code_climate_coverage_report_test.rb +1 -1
- data/test/unit/models/commit_test.rb +4 -2
- data/test/unit/models/project_test.rb +5 -5
- data/test/unit/models/props_test.rb +57 -0
- data/test/unit/models/pull_request_test.rb +2 -2
- data/test/unit/models/test_run_test.rb +1 -1
- metadata +166 -151
- data/app/assets/javascripts/app/views/reports_view.coffee +0 -51
- data/app/controllers/oauth_consumers_controller.rb +0 -68
- data/app/controllers/reports_controller.rb +0 -215
- data/app/models/consumer_token.rb +0 -13
- data/app/models/github_token.rb +0 -8
- data/app/views/oauth_consumers/error.html.erb +0 -5
- data/app/views/oauth_consumers/index.html.erb +0 -29
- data/app/views/oauth_consumers/show.html.erb +0 -7
- data/app/views/reports/index.html.erb +0 -9
- data/app/views/reports/sprint.html.erb +0 -21
- data/app/views/reports/velocity.html.erb +0 -104
- data/config/initializers/oauth_consumers.rb +0 -18
- data/lib/patches/sprockets_output_path_for_assets.rb +0 -29
data/lib/houston/version.rb
CHANGED
data/lib/houston_observer.rb
CHANGED
@@ -42,13 +42,8 @@ module Houston
|
|
42
42
|
private
|
43
43
|
|
44
44
|
def invoke_callback_async(event, block, *args)
|
45
|
-
|
46
|
-
|
47
|
-
invoke_callback(event, block, *args)
|
48
|
-
ensure
|
49
|
-
ActiveRecord::Base.clear_active_connections!
|
50
|
-
Rails.logger.flush # http://stackoverflow.com/a/3516003/731300
|
51
|
-
end
|
45
|
+
Houston.async do
|
46
|
+
invoke_callback(event, block, *args)
|
52
47
|
end
|
53
48
|
end
|
54
49
|
|
data/lib/parallel_enumerable.rb
CHANGED
@@ -16,14 +16,8 @@ class ParallelEnumerable
|
|
16
16
|
|
17
17
|
def each
|
18
18
|
enumerable.map do |item|
|
19
|
-
|
20
|
-
|
21
|
-
yield item
|
22
|
-
rescue Exception # rescues StandardError by default; but we want to rescue and report all errors
|
23
|
-
Houston.report_exception $!
|
24
|
-
ensure
|
25
|
-
ActiveRecord::Base.clear_active_connections!
|
26
|
-
end
|
19
|
+
Houston.async! do
|
20
|
+
yield item
|
27
21
|
end
|
28
22
|
end.each(&:join)
|
29
23
|
end
|
File without changes
|
@@ -0,0 +1,13 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require_tree .
|
File without changes
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the top of the
|
9
|
+
* compiled file, but it's generally better to create a new file per style scope.
|
10
|
+
*
|
11
|
+
*= require_self
|
12
|
+
*= require_tree .
|
13
|
+
*/
|
File without changes
|
File without changes
|
File without changes
|
@@ -7,7 +7,7 @@ $errbit_since_changes_since = 1.week.ago
|
|
7
7
|
Houston::Alerts.config.sync :changes, "err", every: "45s" do
|
8
8
|
app_project_map = Hash[Project
|
9
9
|
.where(error_tracker_name: "Errbit")
|
10
|
-
.pluck("(
|
10
|
+
.pluck("(props->>'errbit.appId')::integer", :id)]
|
11
11
|
app_ids = app_project_map.keys
|
12
12
|
|
13
13
|
Houston::Adapters::ErrorTracker::ErrbitAdapter.changed_problems(app_id: app_ids, since: $errbit_since_changes_since).map { |problem|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
Houston.config do
|
2
|
-
on "github:comment:commit" do |comment|
|
2
|
+
on "github:comment:created:commit" do |comment|
|
3
3
|
channel = "##{comment["project"].slug}" if comment["project"]
|
4
4
|
channel = "developers" unless Houston::Slack.connection.channels.include? channel
|
5
5
|
body, url = comment.values_at "body", "html_url"
|
@@ -10,7 +10,7 @@ Houston.config do
|
|
10
10
|
slack_send_message_to message, channel, as: :github, attachments: [comment], test: true
|
11
11
|
end
|
12
12
|
|
13
|
-
on "github:comment:diff" do |comment|
|
13
|
+
on "github:comment:created:diff" do |comment|
|
14
14
|
channel = "##{comment["project"].slug}" if comment["project"]
|
15
15
|
channel = "developers" unless Houston::Slack.connection.channels.include? channel
|
16
16
|
body, url = comment.values_at "body", "html_url"
|
@@ -22,7 +22,7 @@ Houston.config do
|
|
22
22
|
slack_send_message_to message, channel, as: :github, attachments: [comment], test: true
|
23
23
|
end
|
24
24
|
|
25
|
-
on "github:comment:pull" do |comment|
|
25
|
+
on "github:comment:created:pull" do |comment|
|
26
26
|
channel = "##{comment["project"].slug}" if comment["project"]
|
27
27
|
channel = "developers" unless Houston::Slack.connection.channels.include? channel
|
28
28
|
body, url = comment.values_at "body", "html_url"
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# This is required so that Houston Instances can define
|
2
|
+
# its own routes and models and views.
|
3
|
+
|
4
|
+
module Houston
|
5
|
+
class Engine < ::Rails::Engine
|
6
|
+
|
7
|
+
# Precompile assets for the instance
|
8
|
+
initializer :assets do |config|
|
9
|
+
Rails.application.config.assets.precompile += %w(
|
10
|
+
application.js
|
11
|
+
application.css )
|
12
|
+
end
|
13
|
+
|
14
|
+
# Include the Engine's migrations with the Application
|
15
|
+
# http://pivotallabs.com/leave-your-migrations-in-your-rails-engines/
|
16
|
+
initializer :append_migrations do |app|
|
17
|
+
unless app.root.to_s.match root.to_s
|
18
|
+
config.paths["db/migrate"].expanded.each do |expanded_path|
|
19
|
+
app.config.paths["db/migrate"] << expanded_path
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
@@ -16,7 +16,7 @@ class CreatingAReleaseTest < ActionDispatch::IntegrationTest
|
|
16
16
|
slug: "houston",
|
17
17
|
ticket_tracker_name: "Houston",
|
18
18
|
version_control_name: "Git",
|
19
|
-
|
19
|
+
props: {"git.location" => Rails.root.join(".git").to_s})
|
20
20
|
@project.roles.create!(name: "Maintainer", user: user)
|
21
21
|
@ticket = @project.tickets.create!(
|
22
22
|
number: 116,
|
@@ -119,7 +119,7 @@ class CIIntegrationTest < ActionDispatch::IntegrationTest
|
|
119
119
|
name: "Test",
|
120
120
|
slug: "fixture",
|
121
121
|
version_control_name: "Git",
|
122
|
-
|
122
|
+
props: {"git.location" => "git@github.com:houston/fixture.git"})
|
123
123
|
test_run = TestRun.new(project: project, sha: "bd3e9e2")
|
124
124
|
|
125
125
|
expected_url = "https://api.github.com/repos/houston/fixture/statuses/bd3e9e2e4ddf89a640a4f880cbf55bb46cc7e88a?access_token=#{Houston.config.github[:access_token]}"
|
@@ -140,7 +140,7 @@ class CIIntegrationTest < ActionDispatch::IntegrationTest
|
|
140
140
|
name: "Test",
|
141
141
|
slug: "fixture",
|
142
142
|
version_control_name: "Git",
|
143
|
-
|
143
|
+
props: {"git.location" => "git@github.com:houston/fixture.git"})
|
144
144
|
test_run = TestRun.new(project: project, sha: "bd3e9e2", result: :pass, completed_at: Time.now)
|
145
145
|
|
146
146
|
expected_url = "https://api.github.com/repos/houston/fixture/statuses/bd3e9e2e4ddf89a640a4f880cbf55bb46cc7e88a?access_token=#{Houston.config.github[:access_token]}"
|
@@ -11,7 +11,7 @@ class CommitsApiTest < ActionDispatch::IntegrationTest
|
|
11
11
|
name: "Test",
|
12
12
|
slug: "test",
|
13
13
|
version_control_name: "Git",
|
14
|
-
|
14
|
+
props: {"git.location" => Rails.root.join("test", "data", "bare_repo.git").to_s})
|
15
15
|
|
16
16
|
project.repo.all_commits.each do |sha|
|
17
17
|
native_commit = project.repo.native_commit(sha)
|
@@ -26,12 +26,7 @@ class HooksControllerTest < ActionController::TestCase
|
|
26
26
|
assert_response :success
|
27
27
|
end
|
28
28
|
|
29
|
-
should "
|
30
|
-
mock(Github::PullRequest).close!(a_pull_request, as: "baxterthehacker")
|
31
|
-
post :github, hook: github_pull_request_event_payload(action: "closed")
|
32
|
-
end
|
33
|
-
|
34
|
-
should "create or update a GitHub::PullRequest when the action is not \"closed\"" do
|
29
|
+
should "create or update a GitHub::PullRequest" do
|
35
30
|
mock(Github::PullRequest).upsert!(a_pull_request, as: "baxterthehacker")
|
36
31
|
post :github, hook: github_pull_request_event_payload
|
37
32
|
end
|
@@ -8,22 +8,22 @@ class ProjectOptionsControllerTest < ActionController::TestCase
|
|
8
8
|
setup do
|
9
9
|
sign_in User.first
|
10
10
|
@project = create(:project,
|
11
|
-
|
12
|
-
"speed" => "plaid",
|
13
|
-
"helmet" => "dark" })
|
11
|
+
props: {
|
12
|
+
"view.speed" => "plaid",
|
13
|
+
"view.helmet" => "dark" })
|
14
14
|
end
|
15
15
|
|
16
16
|
|
17
17
|
context "#update" do
|
18
18
|
should "merge supplied options with the project's options" do
|
19
19
|
expected_options = {
|
20
|
-
"speed" => "light",
|
21
|
-
"helmet" => "dark",
|
22
|
-
"schwartz" => "up side" }
|
20
|
+
"view.speed" => "light",
|
21
|
+
"view.helmet" => "dark",
|
22
|
+
"view.schwartz" => "up side" }
|
23
23
|
|
24
|
-
put :update, slug: "test", options: {speed
|
24
|
+
put :update, slug: "test", options: {"view.speed" => "light", "view.schwartz" => "up side"}
|
25
25
|
assert_response :ok
|
26
|
-
assert_equal expected_options, project.reload.
|
26
|
+
assert_equal expected_options, project.reload.props.to_h
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
@@ -31,11 +31,11 @@ class ProjectOptionsControllerTest < ActionController::TestCase
|
|
31
31
|
context "#destroy" do
|
32
32
|
should "remove the specified key from the project's options" do
|
33
33
|
expected_options = {
|
34
|
-
"speed" => "plaid" }
|
34
|
+
"view.speed" => "plaid" }
|
35
35
|
|
36
|
-
delete :destroy, slug: "test", key: "helmet"
|
36
|
+
delete :destroy, slug: "test", key: "view.helmet"
|
37
37
|
assert_response :ok
|
38
|
-
assert_equal expected_options, project.reload.
|
38
|
+
assert_equal expected_options, project.reload.props.to_h
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
@@ -7,35 +7,35 @@ class UserOptionsControllerTest < ActionController::TestCase
|
|
7
7
|
|
8
8
|
setup do
|
9
9
|
@user = create(:user,
|
10
|
-
|
11
|
-
"speed" => "plaid",
|
12
|
-
"helmet" => "dark" })
|
10
|
+
props: {
|
11
|
+
"view.speed" => "plaid",
|
12
|
+
"view.helmet" => "dark" })
|
13
13
|
sign_in @user
|
14
14
|
end
|
15
15
|
|
16
16
|
|
17
17
|
context "#update" do
|
18
|
-
should "merge supplied options with the
|
18
|
+
should "merge supplied options with the user's options" do
|
19
19
|
expected_options = {
|
20
|
-
"speed" => "light",
|
21
|
-
"helmet" => "dark",
|
22
|
-
"schwartz" => "up side" }
|
20
|
+
"view.speed" => "light",
|
21
|
+
"view.helmet" => "dark",
|
22
|
+
"view.schwartz" => "up side" }
|
23
23
|
|
24
|
-
put :update, options: {speed
|
24
|
+
put :update, options: {"view.speed" => "light", "view.schwartz" => "up side"}
|
25
25
|
assert_response :ok
|
26
|
-
assert_equal expected_options, user.reload.
|
26
|
+
assert_equal expected_options, user.reload.props.to_h
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
30
|
|
31
31
|
context "#destroy" do
|
32
|
-
should "remove the specified key from the
|
32
|
+
should "remove the specified key from the user's options" do
|
33
33
|
expected_options = {
|
34
|
-
"speed" => "plaid" }
|
34
|
+
"view.speed" => "plaid" }
|
35
35
|
|
36
|
-
delete :destroy, key: "helmet"
|
36
|
+
delete :destroy, key: "view.helmet"
|
37
37
|
assert_response :ok
|
38
|
-
assert_equal expected_options, user.reload.
|
38
|
+
assert_equal expected_options, user.reload.props.to_h
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
@@ -11,7 +11,7 @@ class CodeClimateCoverageReportTest < ActiveSupport::TestCase
|
|
11
11
|
slug: "test",
|
12
12
|
ci_server_name: "Jenkins",
|
13
13
|
version_control_name: "Git",
|
14
|
-
|
14
|
+
props: {"git.location" => Rails.root.join("test/data/bare_repo.git").to_s})
|
15
15
|
@commit = Commit.new(project: @project, sha: @sha)
|
16
16
|
@test_run = TestRun.new(
|
17
17
|
project: project,
|
@@ -85,12 +85,14 @@ class CommitTest < ActiveSupport::TestCase
|
|
85
85
|
should "ignore spaces when extracting extra attributes from a commit" do
|
86
86
|
commits = [
|
87
87
|
"I did some work {{attr: value}}",
|
88
|
-
"I set this one twice {{attr:\tv1}} {{attr: v2}}"
|
88
|
+
"I set this one twice {{attr:\tv1}} {{attr: v2}}",
|
89
|
+
"I set this one three times {{attr:v1, v2,v3}}",
|
89
90
|
]
|
90
91
|
|
91
92
|
expectations = [
|
92
93
|
{"attr" => ["value"]},
|
93
|
-
{"attr" => ["v1", "v2"]}
|
94
|
+
{"attr" => ["v1", "v2"]},
|
95
|
+
{"attr" => ["v1", "v2", "v3"]}
|
94
96
|
]
|
95
97
|
|
96
98
|
commits.zip(expectations) do |commit_message, expectation|
|
@@ -10,15 +10,15 @@ class ProjectTest < ActiveSupport::TestCase
|
|
10
10
|
|
11
11
|
context "Validation:" do
|
12
12
|
should "validate version control parameters when a version control adapter is specified" do
|
13
|
-
project = Project.new(version_control_name: "Git",
|
13
|
+
project = Project.new(version_control_name: "Git", props: {"git.location" => "/wrong/path"})
|
14
14
|
project.valid?
|
15
|
-
assert project.errors[
|
15
|
+
assert project.errors["git.location"].any?
|
16
16
|
end
|
17
17
|
|
18
18
|
should "not validate version control parameters if no adapter is specified" do
|
19
|
-
project = Project.new(version_control_name: "None",
|
19
|
+
project = Project.new(version_control_name: "None", props: {"git.location" => "/wrong/path"})
|
20
20
|
project.valid?
|
21
|
-
refute project.errors[
|
21
|
+
refute project.errors["git.location"].any?
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
@@ -64,7 +64,7 @@ class ProjectTest < ActiveSupport::TestCase
|
|
64
64
|
name: "Test",
|
65
65
|
slug: "test-01",
|
66
66
|
version_control_name: "Git",
|
67
|
-
|
67
|
+
props: {"git.location" => "git@github.com:houston/fixture.git"})
|
68
68
|
end
|
69
69
|
|
70
70
|
teardown do
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
|
3
|
+
class PropsTest < ActiveSupport::TestCase
|
4
|
+
attr_reader :user
|
5
|
+
|
6
|
+
should "raise an exception for an invalid prop name" do
|
7
|
+
assert_raises do
|
8
|
+
user = User.first
|
9
|
+
user.update_prop! "slack_user_name", "slackbot"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
context "Given a user with the prop slack.username, it" do
|
14
|
+
setup do
|
15
|
+
@user = create(:user, props: {"slack.username" => "slackbot"})
|
16
|
+
end
|
17
|
+
|
18
|
+
should "be able to look up the user by that prop" do
|
19
|
+
assert_equal user, User.find_by_prop("slack.username", "slackbot")
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
context "When .find_by_prop is used with a block" do
|
24
|
+
context "and a user exists with the queried prop, the block" do
|
25
|
+
setup do
|
26
|
+
@user = create(:user, props: {"slack.username" => "slackbot"})
|
27
|
+
end
|
28
|
+
|
29
|
+
should "not be invoked" do
|
30
|
+
invoked = false
|
31
|
+
User.find_by_prop("slack.username", "slackbot") { invoked = true }
|
32
|
+
refute invoked, "Expected the block not to be invoked: the user was found"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
context "and a user does not exist with the queried prop," do
|
37
|
+
context "the block" do
|
38
|
+
should "be invoked the first time the user is looked up" do
|
39
|
+
invoked = false
|
40
|
+
User.find_by_prop("slack.username", "slackbot") { invoked = true; User.first }
|
41
|
+
assert invoked, "Expected the block to be invoked: the user wasn't found"
|
42
|
+
end
|
43
|
+
|
44
|
+
should "not be invoked the second time the user is looked up" do
|
45
|
+
invoked = false
|
46
|
+
User.find_by_prop("slack.username", "slackbot") { invoked = true; User.first }
|
47
|
+
assert invoked, "Expected the block to be invoked: the user wasn't found"
|
48
|
+
|
49
|
+
invoked = false
|
50
|
+
User.find_by_prop("slack.username", "slackbot") { invoked = true; User.first }
|
51
|
+
refute invoked, "Expected the block not to be invoked: the user should've been mapped the first time"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
@@ -16,7 +16,7 @@ class PullRequestTest < ActiveSupport::TestCase
|
|
16
16
|
name: "Test",
|
17
17
|
slug: "test",
|
18
18
|
version_control_name: "Git",
|
19
|
-
|
19
|
+
props: {"git.location" => Rails.root.join("test", "data", "bare_repo.git").to_s})
|
20
20
|
|
21
21
|
@pull_request_payload = {
|
22
22
|
"number" => 1,
|
@@ -160,7 +160,7 @@ class PullRequestTest < ActiveSupport::TestCase
|
|
160
160
|
name: "Test",
|
161
161
|
slug: "test",
|
162
162
|
version_control_name: "Git",
|
163
|
-
|
163
|
+
props: {"git.location" => Rails.root.join("test", "data", "bare_repo.git").to_s})
|
164
164
|
|
165
165
|
@pull_request = Github::PullRequest.create!(
|
166
166
|
project: @project,
|