Created
April 7, 2011 19:44
-
-
Save sevos/908551 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe "Activity form" do | |
let(:user) { Factory(:user) } | |
before { sign_in user.email, user.password } | |
describe "entering activity" do | |
before do | |
@enter = lambda do |what, duration, project=""| | |
within("#activity_form") do | |
fill_in "What?", :with => what | |
fill_in "How long?", :with => duration | |
fill_in "Project", :with => project | |
click_button "Log it" | |
end | |
end | |
end | |
context "with correct data" do | |
context "w/o project name" do | |
it "should save activity with float duration" do | |
@enter.call("an activity", "1.5") | |
within("#recent_activities") do | |
page.should have_content("an activity") | |
page.should have_content("1.50 (1:30)") | |
end | |
end | |
it "should save activity with duration in format 0:00" do | |
@enter.call("an activity", "2:40") | |
within("#recent_activities") do | |
page.should have_content("an activity") | |
page.should have_content("2.67 (2:40)") | |
end | |
end | |
end | |
context "with project name" do | |
it "create a project" do | |
@enter.call("an activity", "1.5", "test project") | |
Project.where(:name => "test project").should exist | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment