Sha256: 3c73ed909a4d426bac63224e68f52ce22f678c1f6bba0556559372cc400b84d5
Contents?: true
Size: 1.98 KB
Versions: 16
Compression:
Stored size: 1.98 KB
Contents
require 'test_helper' class UsersTest < Totter::TestCase def test_me VCR.use_cassette 'users/me' do user = local_client.me assert_equal 'test123', user.username end end def test_user VCR.use_cassette 'users/user' do client = Totter::Client.new user = client.user('gotwalt') assert_equal 'gotwalt', user.username end end def test_update_me VCR.use_cassette 'users/update' do client = local_client options = { :given_name => "Aaron", :family_name => 'Gotwalt' } preferences = { :notification_comments => false } result = client.update_me(options, preferences) assert_equal 'Aaron', result.given_name assert_equal 'Gotwalt', result.family_name refute result.preferences.notification_comments end end def test_user_following VCR.use_cassette 'users/get_following' do following = local_client.following('4') other_user = local_client.user('adam') assert_includes following, other_user end end def test_user_followers VCR.use_cassette 'users/get_followers' do followers = local_client.followers('4') other_user = local_client.user('adam') assert_includes followers, other_user end end def test_user_votes VCR.use_cassette 'users/votes' do votes = local_client.votes('13') vote = votes.first assert_equal 2, vote.decision_id assert_equal 12, vote.decision.user_id end end def test_following VCR.use_cassette 'users/following' do assert local_client.follow('gotwalt'), 'follow user' assert local_client.unfollow('gotwalt'), 'unfollow user' # Still true, even if you aren't following them assert local_client.unfollow('gotwalt'), 'unfollow user twice' assert_raises Totter::NotFound do local_client.follow('nobody') end assert_raises Totter::NotFound do refute local_client.follow('unnobody') end end end end
Version data entries
16 entries across 16 versions & 1 rubygems