Commit 00ed3966

mo khan <mo@mokhan.ca>
2014-08-06 23:03:05
collapse factories into a single file.
1 parent 20dbf29
spec/controllers/sitemap_controller_spec.rb
@@ -0,0 +1,14 @@
+require "rails_helper"
+
+describe SitemapController do
+  describe "#index" do
+    let!(:cake) { create(:cake) }
+    let!(:tutorial) { create(:tutorial) }
+
+    it "returns the most recent cakes" do
+      get :index, format: :xml
+      puts "BODY: #{response.body.inspect}"
+      expect(response.body).to_not be_empty
+    end
+  end
+end
spec/factories/activity.rb
@@ -1,6 +0,0 @@
-FactoryGirl.define do
-  factory :activity, class: Activity do
-    user { FactoryGirl.create(:user) }
-    subject { FactoryGirl.create(:creation) }
-  end
-end
spec/factories/category.rb
@@ -1,6 +0,0 @@
-FactoryGirl.define do
-  factory :category, class: Category do
-    name { Faker::Name.name }
-    slug { Faker::Name.name.gsub(/ /, "-").downcase }
-  end
-end
spec/factories/creation.rb
@@ -1,9 +0,0 @@
-FactoryGirl.define do
-  factory :creation, class: Creation do
-    name { Faker::Name.name }
-    story 'whats the story morning glory?'
-    user { FactoryGirl.create(:user) }
-    association :category
-    #image { File.new(File.join( Rails.root, 'spec/fixtures/images/example.png')) }
-  end
-end
spec/factories/favorite.rb
@@ -1,6 +0,0 @@
-FactoryGirl.define do
-  factory :favorite do
-    user { FactoryGirl.create(:user) }
-    creation { FactoryGirl.create(:creation) }
-  end
-end
spec/factories/photo.rb
@@ -1,5 +0,0 @@
-FactoryGirl.define do
-  factory :photo, class: Photo do
-    image { 'example.png' }
-  end
-end
spec/factories/tag.rb
@@ -1,5 +0,0 @@
-FactoryGirl.define do 
-  factory :tag, :class => "ActsAsTaggableOn::Tag" do
-    name { Faker::Name.name }
-  end
-end
spec/factories/tutorial.rb
@@ -1,10 +0,0 @@
-FactoryGirl.define do
-  factory :tutorial do
-    heading { Faker::Name.name }
-    description "well hello there"
-    url { Faker::Internet.http_url }
-    image_url { Faker::Internet.http_url }
-    author { Faker::Name.name }
-    author_url { Faker::Internet.http_url }
-  end
-end
spec/factories/user.rb
@@ -1,9 +0,0 @@
-FactoryGirl.define do
-  factory :user, class: User do
-    name { Faker::Name.name }
-    email { Faker::Internet.email }
-    password 'password'
-    website { Faker::Internet.http_url }
-    city 'calgary'
-  end
-end
spec/factories.rb
@@ -0,0 +1,42 @@
+FactoryGirl.define do
+  factory :activity, class: Activity do
+    user { FactoryGirl.create(:user) }
+    subject { FactoryGirl.create(:creation) }
+  end
+  factory :category, class: Category do
+    name { Faker::Name.name }
+    slug { Faker::Name.name.gsub(/ /, "-").downcase }
+  end
+  factory :creation, class: Creation do
+    name { Faker::Name.name }
+    story 'whats the story morning glory?'
+    user { FactoryGirl.create(:user) }
+    association :category
+    #image { File.new(File.join( Rails.root, 'spec/fixtures/images/example.png')) }
+  end
+  factory :favorite do
+    user { FactoryGirl.create(:user) }
+    creation { FactoryGirl.create(:creation) }
+  end
+  factory :photo, class: Photo do
+    image { 'example.png' }
+  end
+  factory :tag, :class => "ActsAsTaggableOn::Tag" do
+    name { Faker::Name.name }
+  end
+  factory :tutorial do
+    heading { Faker::Name.name }
+    description "well hello there"
+    url { Faker::Internet.http_url }
+    image_url { Faker::Internet.http_url }
+    author { Faker::Name.name }
+    author_url { Faker::Internet.http_url }
+  end
+  factory :user, class: User do
+    name { Faker::Name.name }
+    email { Faker::Internet.email }
+    password 'password'
+    website { Faker::Internet.http_url }
+    city 'calgary'
+  end
+end