Commit 8f8a2127

mo khan <mo@mokhan.ca>
2013-07-27 03:12:57
add spec to start uploading a new creation
1 parent 2d56baa
app/controllers/creations_controller.rb
@@ -60,5 +60,6 @@ class CreationsController < ApplicationController
 
   def creation_params
     params.require(:creation).permit(:name, :story, :is_restricted, :watermark)
+    #name, story, is_restricted, watermark
   end
 end
spec/factories/category.rb
@@ -1,6 +1,6 @@
 FactoryGirl.define do
   factory :category, class: Category do
-    name 'blah'
-    slug 'blah'
+    name { Faker::Name.name }
+    slug { Faker::Name.name }
   end
 end
spec/factories/creation.rb
@@ -1,6 +1,6 @@
 FactoryGirl.define do
   factory :creation, class: Creation do
-    name 'cake'
+    name { Faker::Name.name }
     story 'whats the story morning glory?'
     #image { File.new(File.join( Rails.root, 'spec/fixtures/images/example.png')) }
   end
spec/factories/tag.rb
@@ -1,5 +1,5 @@
 FactoryGirl.define do 
   factory :tag, :class => "ActsAsTaggableOn::Tag" do
-    name "cake"
+    name { Faker::Name.name }
   end
 end
spec/factories/tutorial.rb
@@ -1,10 +1,10 @@
 FactoryGirl.define do
   factory :tutorial do
-    heading "blah"
+    heading { Faker::Name.name }
     description "well hello there"
-    url "http://mokhan.ca/"
-    image_url "http://example.com"
-    author "mo"
-    author_url "mokhan.ca"
+    url { Faker::Internet.http_url }
+    image_url { Faker::Internet.http_url }
+    author { Faker::Name.name }
+    author_url { Faker::Internet.http_url }
   end
 end
spec/features/upload_creation_spec.rb
@@ -0,0 +1,30 @@
+require "spec_helper"
+
+describe "uploading a new creation", :js => true do
+  let!(:user) { create(:user, :password => "password") }
+  let!(:category_1) { create(:category) }
+  let!(:category_2) { create(:category) }
+
+  before :each do
+    visit user_session_path
+    within('.form-inline') do
+      fill_in('user_email', :with => user.email)
+      fill_in('user_password', :with => "password")
+    end
+    click_button("Sign In")
+    click_link("Add Creation")
+
+    within(".form-horizontal") do
+      fill_in("creation_name", :with => "yummy cake")
+      fill_in("creation_watermark", :with => "yummy")
+      fill_in("creation_story", :with => "this was just so damn yummy so i ate it alone.")
+      select(category_2.name, :from => 'category_id')
+      #fill_in("creation_tags", :with => "cake, yummy")
+    end
+    click_button("NEXT STEP")
+  end
+
+  it "should get them to the image upload page" do
+    page.should have_content("Step 2 of 2")
+  end
+end