Commit 8b76e30656954c2dd95121fff46c4bc6cc81bb74

Authored by Dmitriy Zaporozhets
1 parent 224fb577

Spianch test for group dashboard

app/models/group.rb
@@ -22,6 +22,10 @@ class Group < ActiveRecord::Base @@ -22,6 +22,10 @@ class Group < ActiveRecord::Base
22 22
23 delegate :name, to: :owner, allow_nil: true, prefix: true 23 delegate :name, to: :owner, allow_nil: true, prefix: true
24 24
  25 + def self.search query
  26 + where("name like :query or code like :query", query: "%#{query}%")
  27 + end
  28 +
25 def to_param 29 def to_param
26 code 30 code
27 end 31 end
app/views/groups/show.html.haml
1 .projects 1 .projects
2 .activities.span8 2 .activities.span8
3 - .back_link  
4 - = link_to dashboard_path do  
5 - ← To dashboard 3 + = link_to dashboard_path, class: 'btn very_small' do
  4 + ← To dashboard
  5 +  
  6 + %span.cgray Events and projects are filtered in scope of group
  7 + %hr
6 = render 'shared/no_ssh' 8 = render 'shared/no_ssh'
7 - if @events.any? 9 - if @events.any?
8 .content_list= render @events 10 .content_list= render @events
app/views/snippets/show.html.haml
@@ -7,14 +7,17 @@ @@ -7,14 +7,17 @@
7 = link_to "Edit", edit_project_snippet_path(@project, @snippet), class: "btn small right" 7 = link_to "Edit", edit_project_snippet_path(@project, @snippet), class: "btn small right"
8 8
9 %br 9 %br
10 -.file_holder  
11 - .file_title  
12 - %i.icon-file  
13 - %strong= @snippet.file_name  
14 - %span.options  
15 - = link_to "raw", raw_project_snippet_path(@project, @snippet), class: "btn very_small", target: "_blank"  
16 - .file_content.code  
17 - %div{class: current_user.dark_scheme ? "black" : ""}  
18 - = raw @snippet.colorize(options: { linenos: 'True'}) 10 +%div
  11 + .file_holder
  12 + .file_title
  13 + %i.icon-file
  14 + %strong= @snippet.file_name
  15 + %span.options
  16 + = link_to "raw", raw_project_snippet_path(@project, @snippet), class: "btn very_small", target: "_blank"
  17 + .file_content.code
  18 + %div{class: current_user.dark_scheme ? "black" : ""}
  19 + = raw @snippet.colorize(options: { linenos: 'True'})
19 20
20 -= render "notes/notes_with_form", tid: @snippet.id, tt: "snippet" 21 +
  22 +%div
  23 + = render "notes/notes_with_form", tid: @snippet.id, tt: "snippet"
features/dashboard/dashboard.feature
@@ -10,6 +10,11 @@ Feature: Dashboard @@ -10,6 +10,11 @@ Feature: Dashboard
10 Then I should see "Shop" project link 10 Then I should see "Shop" project link
11 Then I should see project "Shop" activity feed 11 Then I should see project "Shop" activity feed
12 12
  13 + Scenario: I should see groups list
  14 + Given I have group with projects
  15 + And I visit dashboard page
  16 + Then I should see groups list
  17 +
13 Scenario: I should see last push widget 18 Scenario: I should see last push widget
14 Then I should see last push widget 19 Then I should see last push widget
15 And I click "Create Merge Request" link 20 And I click "Create Merge Request" link
features/group/group.feature 0 → 100644
@@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
  1 +Feature: Groups
  2 + Background:
  3 + Given I sign in as a user
  4 + And I have group with projects
  5 +
  6 + Scenario: I should see group dashboard list
  7 + When I visit group page
  8 + Then I should see projects list
  9 + And I should see projects activity feed
features/steps/group/group.rb 0 → 100644
@@ -0,0 +1,32 @@ @@ -0,0 +1,32 @@
  1 +class Groups < Spinach::FeatureSteps
  2 + include SharedAuthentication
  3 + include SharedPaths
  4 +
  5 + When 'I visit group page' do
  6 + visit group_path(current_group)
  7 + end
  8 +
  9 + Then 'I should see projects list' do
  10 + current_user.projects.each do |project|
  11 + page.should have_link project.name
  12 + end
  13 + end
  14 +
  15 + And 'I have group with projects' do
  16 + @group = Factory :group
  17 + @project = Factory :project, group: @group
  18 + @event = Factory :closed_issue_event, project: @project
  19 +
  20 + @project.add_access current_user, :admin
  21 + end
  22 +
  23 + And 'I should see projects activity feed' do
  24 + page.should have_content 'closed issue'
  25 + end
  26 +
  27 + protected
  28 +
  29 + def current_group
  30 + @group ||= Group.first
  31 + end
  32 +end