rspec install
Install Rspec FacoryGirl
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -15,3 +15,4 @@
|
|||||||
/log/*.log
|
/log/*.log
|
||||||
/tmp
|
/tmp
|
||||||
/config/initializers/devise.rb
|
/config/initializers/devise.rb
|
||||||
|
/app/doc/*
|
||||||
|
|||||||
4
Gemfile
4
Gemfile
@@ -71,3 +71,7 @@ gem 'haml'
|
|||||||
gem 'awesome_nested_set'
|
gem 'awesome_nested_set'
|
||||||
gem 'annotate', ">=2.5.0"
|
gem 'annotate', ">=2.5.0"
|
||||||
gem 'carrierwave'
|
gem 'carrierwave'
|
||||||
|
group :development, :test do
|
||||||
|
gem 'factory_girl_rails'
|
||||||
|
gem 'rspec-rails'
|
||||||
|
end
|
||||||
|
|||||||
19
Gemfile.lock
19
Gemfile.lock
@@ -56,9 +56,15 @@ GEM
|
|||||||
orm_adapter (~> 0.1)
|
orm_adapter (~> 0.1)
|
||||||
railties (~> 3.1)
|
railties (~> 3.1)
|
||||||
warden (~> 1.2.1)
|
warden (~> 1.2.1)
|
||||||
|
diff-lcs (1.2.4)
|
||||||
erubis (2.7.0)
|
erubis (2.7.0)
|
||||||
execjs (1.4.0)
|
execjs (1.4.0)
|
||||||
multi_json (~> 1.0)
|
multi_json (~> 1.0)
|
||||||
|
factory_girl (4.2.0)
|
||||||
|
activesupport (>= 3.0.0)
|
||||||
|
factory_girl_rails (4.2.1)
|
||||||
|
factory_girl (~> 4.2.0)
|
||||||
|
railties (>= 3.0.0)
|
||||||
formtastic (2.2.1)
|
formtastic (2.2.1)
|
||||||
actionpack (>= 3.0)
|
actionpack (>= 3.0)
|
||||||
formtastic-bootstrap (2.0.0)
|
formtastic-bootstrap (2.0.0)
|
||||||
@@ -123,6 +129,17 @@ GEM
|
|||||||
json (~> 1.4)
|
json (~> 1.4)
|
||||||
ref (1.0.2)
|
ref (1.0.2)
|
||||||
rolify (3.2.0)
|
rolify (3.2.0)
|
||||||
|
rspec-core (2.14.4)
|
||||||
|
rspec-expectations (2.14.0)
|
||||||
|
diff-lcs (>= 1.1.3, < 2.0)
|
||||||
|
rspec-mocks (2.14.1)
|
||||||
|
rspec-rails (2.14.0)
|
||||||
|
actionpack (>= 3.0)
|
||||||
|
activesupport (>= 3.0)
|
||||||
|
railties (>= 3.0)
|
||||||
|
rspec-core (~> 2.14.0)
|
||||||
|
rspec-expectations (~> 2.14.0)
|
||||||
|
rspec-mocks (~> 2.14.0)
|
||||||
sass (3.2.5)
|
sass (3.2.5)
|
||||||
sass-rails (3.2.6)
|
sass-rails (3.2.6)
|
||||||
railties (~> 3.2.0)
|
railties (~> 3.2.0)
|
||||||
@@ -165,6 +182,7 @@ DEPENDENCIES
|
|||||||
coffee-rails (~> 3.2.1)
|
coffee-rails (~> 3.2.1)
|
||||||
devise (~> 2.2.3)
|
devise (~> 2.2.3)
|
||||||
execjs (~> 1.4.0)
|
execjs (~> 1.4.0)
|
||||||
|
factory_girl_rails
|
||||||
formtastic (~> 2.2.1)
|
formtastic (~> 2.2.1)
|
||||||
formtastic-bootstrap
|
formtastic-bootstrap
|
||||||
git
|
git
|
||||||
@@ -175,6 +193,7 @@ DEPENDENCIES
|
|||||||
paperclip (~> 3.4.0)
|
paperclip (~> 3.4.0)
|
||||||
rails (= 3.2.9)
|
rails (= 3.2.9)
|
||||||
rolify
|
rolify
|
||||||
|
rspec-rails
|
||||||
sass-rails (~> 3.2.3)
|
sass-rails (~> 3.2.3)
|
||||||
sqlite3
|
sqlite3
|
||||||
therubyracer
|
therubyracer
|
||||||
|
|||||||
10
db/schema.rb
10
db/schema.rb
@@ -13,16 +13,6 @@
|
|||||||
|
|
||||||
ActiveRecord::Schema.define(:version => 20130214233723) do
|
ActiveRecord::Schema.define(:version => 20130214233723) do
|
||||||
|
|
||||||
create_table "beispiel_translations", :force => true do |t|
|
|
||||||
t.string "locale"
|
|
||||||
t.text "desc"
|
|
||||||
t.datetime "created_at", :null => false
|
|
||||||
t.datetime "updated_at", :null => false
|
|
||||||
t.integer "beispiele_id"
|
|
||||||
end
|
|
||||||
|
|
||||||
add_index "beispiel_translations", ["locale"], :name => "index_beispiel_translations_on_locale"
|
|
||||||
|
|
||||||
create_table "beispiele", :force => true do |t|
|
create_table "beispiele", :force => true do |t|
|
||||||
t.string "name"
|
t.string "name"
|
||||||
t.text "desc"
|
t.text "desc"
|
||||||
|
|||||||
12
spec/factories/studien.rb
Normal file
12
spec/factories/studien.rb
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# Read about factories at https://github.com/thoughtbot/factory_girl
|
||||||
|
|
||||||
|
|
||||||
|
FactoryGirl.define do
|
||||||
|
factory :studium do
|
||||||
|
zahl "066 506"
|
||||||
|
name "Automatisierung"
|
||||||
|
desc "TEST DESC"
|
||||||
|
typ "Master"
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
1
spec/factories/studium_factory.rb
Normal file
1
spec/factories/studium_factory.rb
Normal file
@@ -0,0 +1 @@
|
|||||||
|
|
||||||
9
spec/models/studium_spec.rb
Normal file
9
spec/models/studium_spec.rb
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe Studium do
|
||||||
|
it "should not be valid without name" do
|
||||||
|
s = FactoryGirl.build(:studium, :name=>nil)
|
||||||
|
s.should_not be_valid
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
38
spec/spec_helper.rb
Normal file
38
spec/spec_helper.rb
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
||||||
|
ENV["RAILS_ENV"] ||= 'test'
|
||||||
|
require File.expand_path("../../config/environment", __FILE__)
|
||||||
|
require 'rspec/rails'
|
||||||
|
require 'rspec/autorun'
|
||||||
|
|
||||||
|
# Requires supporting ruby files with custom matchers and macros, etc,
|
||||||
|
# in spec/support/ and its subdirectories.
|
||||||
|
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
|
||||||
|
|
||||||
|
RSpec.configure do |config|
|
||||||
|
# ## Mock Framework
|
||||||
|
#
|
||||||
|
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
||||||
|
#
|
||||||
|
# config.mock_with :mocha
|
||||||
|
# config.mock_with :flexmock
|
||||||
|
# config.mock_with :rr
|
||||||
|
|
||||||
|
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
||||||
|
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
||||||
|
|
||||||
|
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
||||||
|
# examples within a transaction, remove the following line or assign false
|
||||||
|
# instead of true.
|
||||||
|
config.use_transactional_fixtures = true
|
||||||
|
|
||||||
|
# If true, the base class of anonymous controllers will be inferred
|
||||||
|
# automatically. This will be the default behavior in future versions of
|
||||||
|
# rspec-rails.
|
||||||
|
config.infer_base_class_for_anonymous_controllers = false
|
||||||
|
|
||||||
|
# Run specs in random order to surface order dependencies. If you find an
|
||||||
|
# order dependency and want to debug it, you can fix the order by providing
|
||||||
|
# the seed, which is printed after each run.
|
||||||
|
# --seed 1234
|
||||||
|
config.order = "random"
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user