class FileStoreTest

Public Instance Methods

setup() click to toggle source
# File test/github_api_test.rb, line 10
def setup
  @store = Hub::GitHubAPI::FileStore.new('')
end
test_yaml_dump() click to toggle source
# File test/github_api_test.rb, line 36
  def test_yaml_dump
    output = yaml_dump("github.com" => [
      OrderedHash['user', 'mislav', 'oauth_token', 'OTOKEN'],
      OrderedHash['user', 'tpw', 'oauth_token', 'POKEN'],
    ])

    assert_equal "---
github.com:
- user: mislav
  oauth_token: OTOKEN
- user: tpw
  oauth_token: POKEN
".chomp, output
  end
test_yaml_load() click to toggle source
# File test/github_api_test.rb, line 52
  def test_yaml_load
    data = yaml_load <<-YAML
---
github.com:
- user: mislav
  oauth_token: OTOKEN
- user: tpw
  oauth_token: POKEN
    YAML

    assert_equal 'mislav', data['github.com'][0]['user']
    assert_equal 'OTOKEN', data['github.com'][0]['oauth_token']
    assert_equal 'tpw',    data['github.com'][1]['user']
    assert_equal 'POKEN',  data['github.com'][1]['oauth_token']
  end
test_yaml_load_quoted() click to toggle source
# File test/github_api_test.rb, line 68
  def test_yaml_load_quoted
    data = yaml_load <<-YAML
---
github.com:
- user: 'true'
  oauth_token: '1234'
    YAML

    assert_equal 'true', data['github.com'][0]['user']
    assert_equal '1234', data['github.com'][0]['oauth_token']
  end