Skip to content

Commit

Permalink
still stuck on integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
jameslin101 committed Feb 28, 2012
1 parent 7301b27 commit f526ce9
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 4 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ gem 'haml-rails'
gem 'clearance'
gem 'awesome_print'
gem 'twitter-bootstrap-rails'
gem 'heroku'

# Gems used only for assets and not required
# in production environments by default.
Expand Down
12 changes: 12 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ GEM
activesupport (= 3.1.3)
activesupport (3.1.3)
multi_json (~> 1.0)
addressable (2.2.6)
arel (2.2.1)
awesome_print (1.0.2)
builder (3.0.0)
Expand Down Expand Up @@ -80,13 +81,20 @@ GEM
activesupport (~> 3.0)
haml (~> 3.0)
railties (~> 3.0)
heroku (2.8.6)
launchy (>= 0.3.2)
rest-client (~> 1.6.1)
rubyzip
term-ansicolor (~> 1.0.5)
hike (1.2.1)
hirb (0.6.0)
i18n (0.6.0)
jquery-rails (1.0.19)
railties (~> 3.0)
thor (~> 0.14)
json (1.6.5)
launchy (2.0.5)
addressable (~> 2.2.6)
less (2.0.9)
commonjs (~> 0.2.0)
therubyracer (~> 0.9.9)
Expand Down Expand Up @@ -130,6 +138,8 @@ GEM
rake (0.9.2.2)
rdoc (3.12)
json (~> 1.4)
rest-client (1.6.7)
mime-types (>= 1.16)
rspec (2.8.0)
rspec-core (~> 2.8.0)
rspec-expectations (~> 2.8.0)
Expand Down Expand Up @@ -162,6 +172,7 @@ GEM
hike (~> 1.2)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
term-ansicolor (1.0.6)
therubyracer (0.9.9)
libv8 (~> 3.3.10)
thor (0.14.6)
Expand Down Expand Up @@ -197,6 +208,7 @@ DEPENDENCIES
ffaker
fuubar
haml-rails
heroku
hirb
jquery-rails
pg
Expand Down
29 changes: 25 additions & 4 deletions spec/integration/services_spec.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
require 'spec_helper'

describe "test service requests" do

before(:each) do
@user = Factory(:user)
#@user = Factory(:user, :password => "password")
@user = User.create!(:email => "[email protected]", :password => "password")
@service = Factory(:service, :user => @user)
end

Expand All @@ -11,12 +13,31 @@
visit edit_service_path(@service.id)
current_path.should == sign_in_path
end

it "should be able to log in" do
visit services_path
click_link "[Sign in]"
fill_in "Email", with: "[email protected]"
fill_in "Password", with: "password"
click_button "Sign in"
sleep 3
current_path.should
page.should have_content "[email protected]"
end
end

context "when logged in" do
context "when logged in", :js => true do
before do
sign_in_as @user
#sign_in_as @user
#post_via_redirect session_path, 'session[email]' => @user.email, 'session[password]' => @user.password
visit services_path
click_link "[Sign in]"
fill_in "Email", with: "[email protected]"
fill_in "Password", with: "password"
click_button "Sign in"
sleep 3
end

it "should be able to create a service" do
# From homepage, see post listing
visit services_path
Expand Down
20 changes: 20 additions & 0 deletions spec/integration/user_login_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
require 'spec_helper'

describe "test logging in" do

before(:each) do
@user = User.create!(:email => "[email protected]", :password => "password")
end

context "when logged out" do

it "should be able to log in", :js=>true do
ap @user
visit sign_in_path
fill_in "Email", with: "[email protected]"
fill_in "Password", with: "password"
click_button "Sign in"
page.find(".user").should have_content "[email protected]"
end
end
end

0 comments on commit f526ce9

Please sign in to comment.