Skip to content

Commit

Permalink
[ci] Use factories instead of fixtures for repositories_spec
Browse files Browse the repository at this point in the history
  • Loading branch information
hennevogel committed Feb 4, 2016
1 parent 4641d81 commit 6f35443
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 3 deletions.
11 changes: 11 additions & 0 deletions src/api/spec/factories/distribution.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FactoryGirl.define do
factory :distribution do
vendor Faker::Lorem.word
version "13.2"
name Faker::Lorem.word
project Faker::Lorem.word
reponame Faker::Lorem.word
repository "standard"
link "http://www.opensuse.org/"
end
end
6 changes: 6 additions & 0 deletions src/api/spec/factories/project.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FactoryGirl.define do
factory :project do
name Faker::Internet.domain_word
title Faker::Book.title
end
end
7 changes: 7 additions & 0 deletions src/api/spec/factories/relationship.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FactoryGirl.define do
factory :relationship do
project
user
role { Role.find_by_title('maintainer') }
end
end
6 changes: 6 additions & 0 deletions src/api/spec/factories/repository.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FactoryGirl.define do
factory :repository do
project
name Faker::Lorem.word
end
end
12 changes: 9 additions & 3 deletions src/api/spec/features/webui/repositories_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,21 @@

RSpec.feature "Repositories", :type => :feature, :js => true do
let!(:user) { create(:confirmed_user) }
let!(:project) { create(:project) }
let!(:relationship) { create(:relationship, project: project, user: user) }

let!(:my_project) { create(:project, name: 'MyProject') }
let!(:repository) { create(:repository, name: 'standard', project: my_project) }
let!(:distribution) { create(:distribution, project: 'MyProject', repository: 'standard') }

scenario "add" do
login user
visit "/project/add_repository_from_default_list/#{user.home_project_name}"
visit "/project/add_repository_from_default_list/#{project.name}"

check 'repo_Base_repo'
check "repo_#{distribution.reponame}"
click_button 'Add selected repositories'

expect(page).to have_text("Successfully added repositories")
expect(page).to have_css("#Base_repo")
expect(page).to have_css("##{distribution.reponame}")
end
end

0 comments on commit 6f35443

Please sign in to comment.