Milestones cucumber. Renamed app security test

This commit is contained in:
Dmitriy Zaporozhets 2012-08-03 19:39:54 +03:00
parent 6de4882597
commit b846ac1059
4 changed files with 57 additions and 52 deletions

View file

@ -0,0 +1,18 @@
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"

View file

@ -0,0 +1,38 @@
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

View file

@ -1,6 +1,6 @@
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 }

View file

@ -1,51 +0,0 @@
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