Skip to content
Snippets Groups Projects
Commit bfa4b278 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Tests added

parent d542b97a
No related branches found
No related tags found
No related merge requests found
source 'https://rubygems.org'
 
def darwin_only(require_as)
RUBY_PLATFORM.include?('darwin') && require_as
end
def linux_only(require_as)
RUBY_PLATFORM.include?('linux') && require_as
end
gem 'rails', '3.2.8'
 
# DB
Loading
Loading
@@ -41,10 +49,20 @@ group :assets do
gem 'bootstrap-sass'
end
 
group :development do
gem 'annotate'
end
group :development, :test do
gem 'pry'
gem 'rspec-rails'
gem 'capybara'
gem 'annotate'
gem 'shoulda-matchers'
gem 'guard-rspec'
gem 'rb-fsevent', require: darwin_only('rb-fsevent')
gem 'growl', require: darwin_only('growl')
gem 'rb-inotify', require: linux_only('rb-inotify')
end
Loading
Loading
@@ -65,6 +65,12 @@ GEM
ffi (1.1.5)
foreman (0.60.2)
thor (>= 0.13.6)
growl (1.0.3)
guard (1.3.2)
listen (>= 0.4.2)
thor (>= 0.14.6)
guard-rspec (1.2.1)
guard (>= 1.1)
haml (3.1.7)
haml-rails (0.3.5)
actionpack (>= 3.1, < 4.1)
Loading
Loading
@@ -81,6 +87,7 @@ GEM
libv8 (3.3.10.4)
libwebsocket (0.1.5)
addressable
listen (0.5.0)
mail (2.4.4)
i18n (>= 0.4.0)
mime-types (~> 1.16)
Loading
Loading
@@ -121,6 +128,9 @@ GEM
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
rake (0.9.2.2)
rb-fsevent (0.9.1)
rb-inotify (0.8.8)
ffi (>= 0.5.0)
rdoc (3.12)
json (~> 1.4)
redis (3.0.2)
Loading
Loading
@@ -156,6 +166,8 @@ GEM
multi_json (~> 1.0)
rubyzip
settingslogic (2.0.8)
shoulda-matchers (1.3.0)
activesupport (>= 3.0.0)
sinatra (1.3.3)
rack (~> 1.3, >= 1.3.6)
rack-protection (~> 1.2)
Loading
Loading
@@ -200,16 +212,21 @@ DEPENDENCIES
coffee-rails (~> 3.2.1)
devise
foreman
growl
guard-rspec
haml-rails
jquery-rails
mysql2
pry
rails (= 3.2.8)
rake
rb-fsevent
rb-inotify
resque
rspec-rails
sass-rails (~> 3.2.3)
settingslogic
shoulda-matchers
stamp
therubyracer
thin
Loading
Loading
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
guard 'rspec', :version => 2 do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }
# Rails example
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
watch('config/routes.rb') { "spec/routing" }
watch('app/controllers/application_controller.rb') { "spec/controllers" }
# Capybara request specs
watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" }
# Turnip features and steps
watch(%r{^spec/acceptance/(.+)\.feature$})
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
end
[Dolphin]
PreviewsShown=true
Timestamp=2012,11,5,14,44,35
require 'spec_helper'
describe Build do
subject { Build.new }
it { should belong_to(:project) }
end
require 'spec_helper'
describe Project do
subject { Project.new }
it { should have_many(:builds) }
it { should validate_presence_of :name }
it { should validate_presence_of :path }
it { should validate_presence_of :scripts }
it { should validate_presence_of :timeout }
it { should validate_presence_of :token }
end
require 'spec_helper'
describe "Projects" do
before do
login_as :user
opts = {
id: 1,
name: 'GitLab',
status: nil,
last_build: nil
}
@project = Project.new
@project.stub(opts)
end
describe "GET /projects" do
before do
Project.stub(all: [@project])
visit projects_path
end
it { page.should have_content @project.name }
it { page.should have_content 'Add Project' }
end
describe "GET /projects/:id" do
before do
Project.stub(find: @project)
visit project_path(@project)
end
it { page.should have_content @project.name }
end
end
Loading
Loading
@@ -9,6 +9,8 @@ require 'rspec/autorun'
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
 
RSpec.configure do |config|
config.include LoginHelpers, type: :request
# ## Mock Framework
#
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
Loading
Loading
module LoginHelpers
def login_as(role)
raise 'Only :user allowed' unless role == :user
@user = User.create(
email: 'test@test.com',
password: '123456',
password_confirmation: '123456'
)
login_with(@user)
end
# Internal: Login as the specified user
#
# user - User instance to login with
def login_with(user)
visit new_user_session_path
fill_in "user_email", with: user.email
fill_in "user_password", with: "123456"
click_button "Sign in"
end
def logout
click_link "Logout" rescue nil
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment