Commit 9530a7fd
Changed files (3)
app
controllers
spec
factories
requests
app/controllers/creations_controller.rb
@@ -2,7 +2,8 @@ class CreationsController < ApplicationController
before_filter :authenticate_user!, :except => [:show, :index]
# GET /creations
def index
- @creations = Creation.where(:is_restricted => false, :is_published => true).page(params[:page]).per(16)
+ #@creations = Creation.where(:is_restricted => false, :is_published => true).page(params[:page]).per(16)
+ @creations = Creation.where(:is_restricted => false).page(params[:page]).per(16)
end
# GET /creations/1
spec/factories/photo.rb
@@ -0,0 +1,5 @@
+FactoryGirl.define do
+ factory :photo, class: Photo do
+ image { File.new(File.join( Rails.root, 'spec/fixtures/images/example.png')) }
+ end
+end
spec/requests/creations_spec.rb
@@ -3,10 +3,14 @@ require 'spec_helper'
describe "Creations" do
describe "GET /creations" do
before(:each) do
- FactoryGirl.create(:creation)
+ creation = FactoryGirl.create(:creation) do |c|
+ c.photos.create(:image => File.new(File.join( Rails.root, 'spec/fixtures/images/example.png')), :is_primary => true)
+ c.user = FactoryGirl.create(:user)
+ end
+ creation.save!
+ get creations_path
end
it "works! (now write some real specs)" do
- get creations_path
response.status.should be(200)
end
end