Commit b846ac10 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Milestones cucumber. Renamed app security test

parent 6de48825
Feature: Milestones
Background:
Given I signin as a user
And I own project "Shop"
And project "Shop" has milestone "v2.2"
Given I visit project "Shop" milestones page
Scenario: I should see active milestones
Then I should see milestone "v2.2"
Scenario: I should see milestone
Given I click link "v2.2"
Then I should see milestone "v2.2"
Scenario: I create new milestone
Given I click link "New Milestone"
And I submit new milestone "v2.3"
Then I should see milestone "v2.3"
Given /^project "(.*?)" has milestone "(.*?)"$/ do |arg1, arg2|
project = Project.find_by_name(arg1)
milestone = Factory :milestone,
:title => arg2,
:project => project
3.times do |i|
issue = Factory :issue,
:project => project,
:milestone => milestone
end
end
Given /^I visit project "(.*?)" milestones page$/ do |arg1|
@project = Project.find_by_name(arg1)
visit project_milestones_path(@project)
end
Then /^I should see active milestones$/ do
milestone = @project.milestones.first
page.should have_content(milestone.title[0..10])
page.should have_content(milestone.expires_at)
page.should have_content("Browse Issues")
end
Then /^I should see milestone "(.*?)"$/ do |arg1|
milestone = @project.milestones.find_by_title(arg1)
page.should have_content(milestone.title[0..10])
page.should have_content(milestone.expires_at)
page.should have_content("Browse Issues")
end
Given /^I submit new milestone "(.*?)"$/ do |arg1|
fill_in "milestone_title", :with => arg1
click_button "Create milestone"
end
require 'spec_helper'
describe "Projects Security" do
describe "Application access" do
describe "GET /" do
it { root_path.should be_allowed_for :admin }
it { root_path.should be_allowed_for :user }
......
require 'spec_helper'
describe "Milestones" do
let(:project) { Factory :project }
before do
login_as :user
project.add_access(@user, :admin)
@milestone = Factory :milestone, :project => project
@issue = Factory :issue, :project => project
@milestone.issues << @issue
end
describe "GET /milestones" do
before do
visit project_milestones_path(project)
end
subject { page }
it { should have_content(@milestone.title[0..10]) }
it { should have_content(@milestone.expires_at) }
it { should have_content("Browse Issues") }
end
describe "GET /milestone/:id" do
before do
visit project_milestone_path(project, @milestone)
end
subject { page }
it { should have_content(@milestone.title[0..10]) }
it { should have_content(@milestone.expires_at) }
it { should have_content("Browse Issues") }
end
describe "GET /milestones/new" do
before do
visit new_project_milestone_path(project)
fill_in "milestone_title", :with => "v2.3"
click_button "Create milestone"
end
it { current_path.should == project_milestone_path(project, project.milestones.last) }
it { page.should have_content(project.milestones.last.title[0..10]) }
it { page.should have_content(project.milestones.last.expires_at) }
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment