Skip to content

Commit

Permalink
[ci] Add test for adding attribute to package
Browse files Browse the repository at this point in the history
  • Loading branch information
bgeuken committed Feb 11, 2016
1 parent ab9d4d8 commit c60a937
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 0 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/api/spec/factories/attrib_namespaces.rb
@@ -0,0 +1,5 @@
FactoryGirl.define do
factory :attrib_namespace do
name Faker::Lorem.word
end
end
9 changes: 9 additions & 0 deletions src/api/spec/factories/attrib_types.rb
@@ -0,0 +1,9 @@
FactoryGirl.define do
factory :attrib_type do
sequence(:name) { |n| "attribute_factory_#{n}" }

factory :attrib_type_with_namespace do
attrib_namespace { create(:attrib_namespace) }
end
end
end
5 changes: 5 additions & 0 deletions src/api/spec/factories/packages.rb
@@ -0,0 +1,5 @@
FactoryGirl.define do
factory :package do
name Faker::Lorem.word
end
end
6 changes: 6 additions & 0 deletions src/api/spec/factories/project.rb
Expand Up @@ -8,5 +8,11 @@
description Faker::Lorem.sentence
remoteurl Faker::Internet.url
end

factory :project_with_package do
after(:create) do |project|
project.packages << create(:package, project_id: project.id)
end
end
end
end
24 changes: 24 additions & 0 deletions src/api/spec/features/webui/attributes_spec.rb
@@ -0,0 +1,24 @@
require "browser_helper"

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

describe "attributes subtab" do
let!(:package) {
create(:package, project_id: Project.find_by_name(user.home_project_name).id)
}
let!(:attribute) { create(:attrib_type_with_namespace) }

scenario "add attribute" do
login user

visit index_attribs_path(project: user.home_project_name, package: package.name)
click_link("add-new-attribute")
expect(page).to have_text("Add Attribute")
find("select#attrib_attrib_type_id").select(attribute.name)
click_button "Create Attribute"
expect(page).to have_content("Attribute was successfully created.")
end
end

end

0 comments on commit c60a937

Please sign in to comment.