Commit 781fd1a80c6b65fa8c0cd71001be681e955c4edb

Authored by randx
1 parent 85b86e64

Cucumber -> Dashboard features

app/views/search/show.html.haml
... ... @@ -3,7 +3,7 @@
3 3 = label_tag :search do
4 4 %strong Looking for
5 5 .input
6   - = text_field_tag :search, params[:search],:placeholder => "issue 143", :class => "input-xxlarge"
  6 + = text_field_tag :search, params[:search], :placeholder => "issue 143", :class => "input-xxlarge", :id => "dashboard_search"
7 7 = submit_tag 'Search', :class => "btn btn-primary"
8 8 - if params[:search].present?
9 9 %br
... ...
features/dashboard/dashboard.feature
... ... @@ -0,0 +1,18 @@
  1 +Feature: Dashboard
  2 + Background:
  3 + Given I signin as a user
  4 + And I own project "Shop"
  5 + And project "Shop" has push event
  6 + And I visit dashboard page
  7 +
  8 + Scenario: I should see projects list
  9 + Then I should see "New Project" link
  10 + Then I should see "Shop" project link
  11 + Then I should see project "Shop" activity feed
  12 +
  13 + Scenario: I should see last pish widget
  14 + Then I should see last push widget
  15 + And I click "Create Merge Request" link
  16 + Then I see prefilled new Merge Request page
  17 +
  18 +
... ...
features/dashboard/search.feature
... ... @@ -0,0 +1,11 @@
  1 +Feature: Dashboard Search
  2 + Background:
  3 + Given I signin as a user
  4 + And I own project "Shop"
  5 + And I visit dashboard search page
  6 +
  7 + Scenario: I should see project i'm looking for
  8 + Given I search for "Sho"
  9 + Then I should see "Shop" project link
  10 +
  11 +
... ...
features/step_definitions/dashboard_steps.rb 0 → 100644
... ... @@ -0,0 +1,67 @@
  1 +Given /^I visit dashboard page$/ do
  2 + visit dashboard_path
  3 +end
  4 +
  5 +Then /^I should see "(.*?)" link$/ do |arg1|
  6 + page.should have_link(arg1)
  7 +end
  8 +
  9 +Then /^I should see "(.*?)" project link$/ do |arg1|
  10 + page.should have_link(arg1)
  11 +end
  12 +
  13 +Then /^I should see project "(.*?)" activity feed$/ do |arg1|
  14 + project = Project.find_by_name(arg1)
  15 + page.should have_content "#{@user.name} pushed new branch new_design at #{project.name}"
  16 +end
  17 +
  18 +Given /^project "(.*?)" has push event$/ do |arg1|
  19 + @project = Project.find_by_name(arg1)
  20 +
  21 + data = {
  22 + :before => "0000000000000000000000000000000000000000",
  23 + :after => "0220c11b9a3e6c69dc8fd35321254ca9a7b98f7e",
  24 + :ref => "refs/heads/new_design",
  25 + :user_id => @user.id,
  26 + :user_name => @user.name,
  27 + :repository => {
  28 + :name => @project.name,
  29 + :url => "localhost/rubinius",
  30 + :description => "",
  31 + :homepage => "localhost/rubinius",
  32 + :private => true
  33 + }
  34 + }
  35 +
  36 + @event = Event.create(
  37 + :project => @project,
  38 + :action => Event::Pushed,
  39 + :data => data,
  40 + :author_id => @user.id
  41 + )
  42 +end
  43 +
  44 +Then /^I should see last push widget$/ do
  45 + page.should have_content "Your last push was to branch new_design"
  46 + page.should have_link "Create Merge Request"
  47 +end
  48 +
  49 +Then /^I click "(.*?)" link$/ do |arg1|
  50 + click_link "Create Merge Request"
  51 +end
  52 +
  53 +Then /^I see prefilled new Merge Request page$/ do
  54 + current_path.should == new_project_merge_request_path(@project)
  55 + find("#merge_request_source_branch").value.should == "new_design"
  56 + find("#merge_request_target_branch").value.should == "master"
  57 + find("#merge_request_title").value.should == "New Design"
  58 +end
  59 +
  60 +Given /^I visit dashboard search page$/ do
  61 + visit search_path
  62 +end
  63 +
  64 +Given /^I search for "(.*?)"$/ do |arg1|
  65 + fill_in "dashboard_search", :with => arg1
  66 + click_button "Search"
  67 +end
... ...