Commit 3bf8f097 authored by Valery Sizov's avatar Valery Sizov

git hook sample: tests

parent ca538143
@admin
Feature: Admin git hooks sample
Background:
Given I sign in as an admin
And I visit git hooks page
Scenario: I can create git hook sample
When I fill in a form and submit
Then I see my git hook saved
\ No newline at end of file
require 'webmock'
class Spinach::Features::AdminGitHooksSample < Spinach::FeatureSteps
include SharedAuthentication
include SharedProject
include SharedPaths
include RSpec::Matchers
include RSpec::Mocks::ExampleMethods
include WebMock::API
step 'I fill in a form and submit' do
fill_in "Commit message", with: "my_string"
click_button "Save Git hooks"
end
step 'I see my git hook saved' do
visit admin_git_hooks_path
expect(page).to have_selector("input[value='my_string']")
end
end
......@@ -199,6 +199,10 @@ module SharedPaths
visit admin_applications_path
end
step 'I visit git hooks page' do
visit admin_git_hooks_path
end
# ----------------------------------------
# Generic Project
# ----------------------------------------
......
......@@ -7,5 +7,9 @@ FactoryGirl.define do
delete_branch_regex "MyString"
project
commit_message_regex "MyString"
factory :git_hook_sample do
is_sample true
end
end
end
......@@ -82,6 +82,19 @@ describe Projects::CreateService do
expect(project.saved?).to be(true)
end
end
context "git hook sample" do
before do
@git_hook_sample = create :git_hook_sample
end
it "creates git hook from sample" do
git_hook = create_project(@user, @opts).git_hook
[:force_push_regex, :deny_delete_tag, :delete_branch_regex, :commit_message_regex].each do |attr_name|
git_hook.send(attr_name).should == @git_hook_sample.send(attr_name)
end
end
end
end
def create_project(user, opts)
......
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