mirror of
https://github.com/indentlabs/notebook.git
synced 2025-10-26 11:19:22 +00:00
Use factory_girl for test fixtures
This commit is contained in:
parent
c18ab5a91a
commit
ac033ffabd
4
Gemfile
4
Gemfile
@ -30,6 +30,10 @@ group :assets do
|
||||
gem 'uglifier', '>= 1.0.3'
|
||||
end
|
||||
|
||||
group :test do
|
||||
gem 'factory_girl'
|
||||
end
|
||||
|
||||
gem 'jquery-rails'
|
||||
|
||||
# To use ActiveModel has_secure_password
|
||||
|
||||
52
Gemfile.lock
52
Gemfile.lock
@ -49,18 +49,19 @@ GEM
|
||||
coffee-script (2.2.0)
|
||||
coffee-script-source
|
||||
execjs
|
||||
coffee-script-source (1.4.0)
|
||||
coffee-script-source (1.7.0)
|
||||
commonjs (0.2.7)
|
||||
erubis (2.7.0)
|
||||
execjs (1.4.0)
|
||||
multi_json (~> 1.0)
|
||||
execjs (2.0.2)
|
||||
factory_girl (4.4.0)
|
||||
activesupport (>= 3.0.0)
|
||||
hike (1.2.3)
|
||||
httparty (0.12.0)
|
||||
httparty (0.13.0)
|
||||
json (~> 1.8)
|
||||
multi_xml (>= 0.5.2)
|
||||
i18n (0.6.1)
|
||||
journey (1.0.4)
|
||||
jquery-rails (2.1.4)
|
||||
jquery-rails (3.1.0)
|
||||
railties (>= 3.0, < 5.0)
|
||||
thor (>= 0.14, < 2.0)
|
||||
json (1.8.1)
|
||||
@ -71,7 +72,7 @@ GEM
|
||||
less (~> 2.4.0)
|
||||
less-rails-fontawesome (0.8.0)
|
||||
less-rails (~> 2.4.2)
|
||||
libv8 (3.3.10.4)
|
||||
libv8 (3.16.14.3)
|
||||
mail (2.5.4)
|
||||
mime-types (~> 1.16)
|
||||
treetop (~> 1.4.8)
|
||||
@ -79,22 +80,27 @@ GEM
|
||||
mini_portile (0.5.2)
|
||||
mongo (1.6.0)
|
||||
bson (= 1.6.0)
|
||||
mongoid (2.4.6)
|
||||
activemodel (~> 3.1)
|
||||
mongo (~> 1.3)
|
||||
tzinfo (~> 0.3.22)
|
||||
mongoid-paperclip (0.0.8)
|
||||
mongoid (3.1.6)
|
||||
activemodel (~> 3.2)
|
||||
moped (~> 1.4)
|
||||
origin (~> 1.0)
|
||||
tzinfo (~> 0.3.29)
|
||||
mongoid-paperclip (0.0.9)
|
||||
paperclip (>= 2.3.6)
|
||||
multi_json (1.8.2)
|
||||
moped (1.5.2)
|
||||
multi_json (1.9.0)
|
||||
multi_xml (0.5.5)
|
||||
nokogiri (1.6.1)
|
||||
mini_portile (~> 0.5.0)
|
||||
paperclip (3.5.2)
|
||||
nokogiri (1.6.1-x86-mingw32)
|
||||
mini_portile (~> 0.5.0)
|
||||
origin (1.1.0)
|
||||
paperclip (4.1.1)
|
||||
activemodel (>= 3.0.0)
|
||||
activesupport (>= 3.0.0)
|
||||
cocaine (~> 0.5.3)
|
||||
mime-types
|
||||
polyglot (0.3.3)
|
||||
polyglot (0.3.4)
|
||||
rack (1.4.5)
|
||||
rack-cache (1.2)
|
||||
rack (>= 0.4)
|
||||
@ -117,11 +123,12 @@ GEM
|
||||
rake (>= 0.8.7)
|
||||
rdoc (~> 3.4)
|
||||
thor (>= 0.14.6, < 2.0)
|
||||
rake (10.1.0)
|
||||
rake (10.1.1)
|
||||
rdoc (3.12.2)
|
||||
json (~> 1.4)
|
||||
ref (1.0.5)
|
||||
rmagick (2.13.2)
|
||||
sass (3.2.12)
|
||||
sass (3.3.3)
|
||||
sass-rails (3.2.6)
|
||||
railties (~> 3.2.0)
|
||||
sass (>= 3.1.10)
|
||||
@ -131,27 +138,30 @@ GEM
|
||||
multi_json (~> 1.0)
|
||||
rack (~> 1.0)
|
||||
tilt (~> 1.1, != 1.3.0)
|
||||
therubyracer (0.10.1)
|
||||
libv8 (~> 3.3.10)
|
||||
therubyracer (0.12.1)
|
||||
libv8 (~> 3.16.14.0)
|
||||
ref
|
||||
thor (0.18.1)
|
||||
tilt (1.4.1)
|
||||
treetop (1.4.15)
|
||||
polyglot
|
||||
polyglot (>= 0.3.1)
|
||||
tzinfo (0.3.38)
|
||||
uglifier (1.3.0)
|
||||
tzinfo (0.3.39)
|
||||
uglifier (2.5.0)
|
||||
execjs (>= 0.3.0)
|
||||
multi_json (~> 1.0, >= 1.0.2)
|
||||
json (>= 1.8.0)
|
||||
uuidtools (2.1.4)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
x86-mingw32
|
||||
|
||||
DEPENDENCIES
|
||||
aws-sdk (~> 1.3.4)
|
||||
bootplus-rails
|
||||
bson_ext (= 1.6.0)
|
||||
coffee-rails (~> 3.2.1)
|
||||
factory_girl
|
||||
jquery-rails
|
||||
less-rails
|
||||
less-rails-fontawesome
|
||||
|
||||
6
test/factories/character.rb
Normal file
6
test/factories/character.rb
Normal file
@ -0,0 +1,6 @@
|
||||
FactoryGirl.define do
|
||||
factory :character do
|
||||
name "MyString"
|
||||
age "MyString"
|
||||
end
|
||||
end
|
||||
6
test/factories/session.rb
Normal file
6
test/factories/session.rb
Normal file
@ -0,0 +1,6 @@
|
||||
FactoryGirl.define do
|
||||
factory :session do
|
||||
username "MyString"
|
||||
password "MyString"
|
||||
end
|
||||
end
|
||||
7
test/factories/user.rb
Normal file
7
test/factories/user.rb
Normal file
@ -0,0 +1,7 @@
|
||||
FactoryGirl.define do
|
||||
factory :user do
|
||||
name "MyString"
|
||||
email "MyString"
|
||||
password "MyString"
|
||||
end
|
||||
end
|
||||
0
test/fixtures/.gitkeep
vendored
0
test/fixtures/.gitkeep
vendored
9
test/fixtures/characters.yml
vendored
9
test/fixtures/characters.yml
vendored
@ -1,9 +0,0 @@
|
||||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
|
||||
|
||||
one:
|
||||
name: MyString
|
||||
age: MyString
|
||||
|
||||
two:
|
||||
name: MyString
|
||||
age: MyString
|
||||
9
test/fixtures/sessions.yml
vendored
9
test/fixtures/sessions.yml
vendored
@ -1,9 +0,0 @@
|
||||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
|
||||
|
||||
one:
|
||||
username: MyString
|
||||
password: MyString
|
||||
|
||||
two:
|
||||
username: MyString
|
||||
password: MyString
|
||||
11
test/fixtures/users.yml
vendored
11
test/fixtures/users.yml
vendored
@ -1,11 +0,0 @@
|
||||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
|
||||
|
||||
one:
|
||||
name: MyString
|
||||
email: MyString
|
||||
password: MyString
|
||||
|
||||
two:
|
||||
name: MyString
|
||||
email: MyString
|
||||
password: MyString
|
||||
@ -2,7 +2,7 @@ require 'test_helper'
|
||||
|
||||
class CharactersControllerTest < ActionController::TestCase
|
||||
setup do
|
||||
@character = characters(:one)
|
||||
@character = build(:character)
|
||||
end
|
||||
|
||||
test "should get index" do
|
||||
|
||||
@ -2,7 +2,7 @@ require 'test_helper'
|
||||
|
||||
class SessionsControllerTest < ActionController::TestCase
|
||||
setup do
|
||||
@session = sessions(:one)
|
||||
@session = build(:session)
|
||||
end
|
||||
|
||||
test "should get index" do
|
||||
|
||||
@ -3,4 +3,5 @@ require File.expand_path('../../config/environment', __FILE__)
|
||||
require 'rails/test_help'
|
||||
|
||||
class ActiveSupport::TestCase
|
||||
end
|
||||
include FactoryGirl::Syntax::Methods
|
||||
end
|
||||
@ -2,7 +2,6 @@ require 'test_helper'
|
||||
|
||||
class CharacterTest < ActiveSupport::TestCase
|
||||
test "character exists" do
|
||||
assert_not_nil characters(:one), "Characters test fixture is inaccessible"
|
||||
assert_not_nil characters(:two), "Characters test fixture is inaccessible"
|
||||
assert_not_nil build(:character), "Characters factory is returning nil"
|
||||
end
|
||||
end
|
||||
|
||||
@ -2,7 +2,6 @@ require 'test_helper'
|
||||
|
||||
class SessionTest < ActiveSupport::TestCase
|
||||
test "session exists" do
|
||||
assert_not_nil sessions(:one), "Sessions test fixture is inaccessible"
|
||||
assert_not_nil sessions(:two), "Sessions test fixture is inaccessible"
|
||||
assert_not_nil build(:session), "Sessions factory is returning nil"
|
||||
end
|
||||
end
|
||||
|
||||
@ -2,7 +2,6 @@ require 'test_helper'
|
||||
|
||||
class UserTest < ActiveSupport::TestCase
|
||||
test "user exists" do
|
||||
assert_not_nil user(:one), "Users test fixture is inaccessible"
|
||||
assert_not_nil user(:two), "Users test fixture is inaccessible"
|
||||
assert_not_nil build(:user), "Users factory is returning nil"
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
Reference in New Issue
Block a user