@halogenandtoast I started the workshop by writing specs for the app. i was able to write tests for the first video where everything was working because I did not wanted to test the app manually. But then when you started to change things by introducing the dashboard variable and also by starting to use polymorphism I could not understand how to write specs then.
Do you right specs from integration first and then controller specs and then model specs and then you try to make the new change work?
But what should I have done when you introduced the text shout variable and the photoshout variable?
This is the file I got to pass until I stopped testing.
require 'spec_helper'
describe "After user signs in" do
before do
visit new_user_path
fill_in "Username",with: "Ankur Kothari"
fill_in "Email",with: "admin@admin.com"
fill_in "Password",with: "akk322"
click_button "Sign up"
end
it "can create a new shout" do
fill_in "Body",with: "How are you?"
click_button "Text Shout!"
page.should have_link "Ankur Kothari"
page.should have_content "shouted"
page.should have_content "How are you?"
end
it "click on a user" do
fill_in "Body",with: "How are you?"
click_button "Text Shout!"
within("#shout_user") do
click_link "Ankur Kothari"
end
end
it "create a new photo shout" do
page.attach_file("Image", '/Users/apple/Desktop/ios.png')
click_button "Photo Shout!"
end
end
require 'spec_helper'
describe Shout do
it {should respond_to(:content_id)}
it {should respond_to(:content_type)}
it {should belong_to(:user)}
end