Skip to content

Commit

Permalink
Merge pull request #614 from AriT93/603_testing
Browse files Browse the repository at this point in the history
603 testing
  • Loading branch information
carols10cents committed Aug 31, 2012
2 parents 110a590 + 4cc9f82 commit 53d9c2f
Showing 1 changed file with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions test/acceptance/api/twitter_api_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
require_relative '../acceptance_helper'

describe "twitter-api" do
include AcceptanceHelper

describe "user_timeline" do
it "returns valid json" do

log_in_as_some_user

u = Fabricate(:user)

5.times do |index|
update = Fabricate(:update,
:text => "Update test is #{index}",
:twitter => true,
:author => u.author
)
u.feed.updates << update
end

visit "/api/statuses/user_timeline.json?screen_name=#{u.username}"

parsed_json = JSON.parse(source)
parsed_json.length.must_equal 5
parsed_json[0]["text"].must_equal("Update test is 4")

end
end

describe "home_timeline" do
it "it returns the home timeline for the user" do
u = Fabricate(:user)
log_in_username u

update = Fabricate(:update,
:text => "Hello World I'm on RStatus",
:author => u.author)
u.feed.updates << update

visit "/api/statuses/home_timeline.json"

parsed_json = JSON.parse(source)
parsed_json[0]["text"].must_equal(update.text)

end
end

describe "mentions" do
it "gives mentions" do
skip "unimplemented"

u = Fabricate(:user)
log_in_username u

update = Fabricate(:update,
:text => "@#{u.username} How about them Bears",
:author => u.author)

visit "/api/statuses/mention.json"

parsed_json = JSON.parse(source)
parsed_json[0]["text"].must_equal(update.text)

end
end

end

0 comments on commit 53d9c2f

Please sign in to comment.