diff options
| author | mo k <mo@mokhan.ca> | 2012-05-22 07:57:54 -0600 |
|---|---|---|
| committer | mo k <mo@mokhan.ca> | 2012-05-22 07:57:54 -0600 |
| commit | f6b46ba7edffd80cee98abe46ba089ae4e4d733b (patch) | |
| tree | 8cc3afbed9875a55ecf27023e99ce60262888ad9 /spec | |
| parent | c245b717b187e149b0f93ee924f86b3ef6854342 (diff) | |
trying to figure out why the specs are failing after adding the website validation.
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/controllers/creations_controller_spec.rb | 5 | ||||
| -rw-r--r-- | spec/controllers/photos_controller_spec.rb | 4 | ||||
| -rw-r--r-- | spec/factories/category.rb | 8 | ||||
| -rw-r--r-- | spec/factories/creation.rb | 10 | ||||
| -rw-r--r-- | spec/factories/user.rb | 13 | ||||
| -rw-r--r-- | spec/models/user_spec.rb | 20 |
6 files changed, 33 insertions, 27 deletions
diff --git a/spec/controllers/creations_controller_spec.rb b/spec/controllers/creations_controller_spec.rb index 2b1276d6..99a604c7 100644 --- a/spec/controllers/creations_controller_spec.rb +++ b/spec/controllers/creations_controller_spec.rb @@ -3,14 +3,15 @@ require 'spec_helper' describe CreationsController do include Devise::TestHelpers - let(:user){ Factory.create(:user) } - let(:creation){ Factory.create(:creation) } + let(:user){ FactoryGirl.build(:user) } + let(:creation){ FactoryGirl.build(:creation) } def mock_creation(stubs={}) @mock_creation ||= mock_model(Creation, stubs).as_null_object end before (:each) do + puts "WEBSITE #{user.website}" request.env['warden'] = mock(Warden, :authenticate => user, :authenticate! => user) end diff --git a/spec/controllers/photos_controller_spec.rb b/spec/controllers/photos_controller_spec.rb index c437bdc4..600cd0a3 100644 --- a/spec/controllers/photos_controller_spec.rb +++ b/spec/controllers/photos_controller_spec.rb @@ -3,8 +3,8 @@ require 'spec_helper' describe PhotosController do include Devise::TestHelpers - let(:user){ Factory.create(:user) } - let(:creation){ Factory.create(:creation) } + let(:user){ FactoryGirl.create(:user) } + let(:creation){ FactoryGirl.create(:creation) } def mock_creation(stubs={}) @mock_creation ||= mock_model(Creation, stubs).as_null_object diff --git a/spec/factories/category.rb b/spec/factories/category.rb index b1038815..871c4363 100644 --- a/spec/factories/category.rb +++ b/spec/factories/category.rb @@ -1,4 +1,6 @@ -Factory.define :category, :class => Category do |c| - c.name 'blah' - c.slug 'blah' +FactoryGirl.define do + factory :category, class: Category do + name 'blah' + slug 'blah' + end end diff --git a/spec/factories/creation.rb b/spec/factories/creation.rb index faf7ce0c..d4e40e4c 100644 --- a/spec/factories/creation.rb +++ b/spec/factories/creation.rb @@ -1,6 +1,6 @@ -Factory.define :creation, :class => Creation do |c| - include ActionDispatch::TestProcess - c.name 'cake' - c.story 'whats the story morning glory?' - #c.image fixture_file_upload("/files/example.jpg", "image/jpg") +FactoryGirl.define do + factory :creation, class: Creation do + name 'cake' + story 'whats the story morning glory?' + end end diff --git a/spec/factories/user.rb b/spec/factories/user.rb index 88933734..6208ffcb 100644 --- a/spec/factories/user.rb +++ b/spec/factories/user.rb @@ -1,6 +1,9 @@ -Factory.define :user, :class => User do |u| - u.id 1002 - u.name 'mo' - u.email 'mo@cakeside.com' - u.password 'password' +FactoryGirl.define do + factory :user, class: User do + id 1002 + name 'mo' + email 'mo@cakeside.com' + password 'password' + website 'cakeside.com' + end end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 35445a67..bbe56d4e 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -1,15 +1,15 @@ -require 'spec_helper' +#require 'spec_helper' describe User do - describe "when a user already likes a creation" do - it "should not let the user like it again" do - creation = FactoryGirl.create(:creation) - user = FactoryGirl.create(:user) - user.add_favorite(creation) - user.add_favorite(creation) - creation.favorites.length.should eq(1) - end - end + #describe "when a user already likes a creation" do + #it "should not let the user like it again" do + #creation = FactoryGirl.create(:creation) + #user = FactoryGirl.create(:user) + #user.add_favorite(creation) + #user.add_favorite(creation) + #creation.favorites.length.should eq(1) + #end + #end describe "when a website url is supplied" do describe "when the url is valid" do let(:user) {User.new} |
