Permalink
Browse files

Added *very* basic tests for fedora_rpms model

  • Loading branch information...
1 parent df181e0 commit 33b39414ba74fc3deddf1605de6a0f24366a74ba nicolassatragno committed Dec 31, 2012
Showing with 37 additions and 13 deletions.
  1. +5 −5 test/fixtures/fedora_rpms.yml
  2. +11 −0 test/fixtures/rpm_versions.yml
  3. +8 −5 test/fixtures/ruby_gems.yml
  4. +13 −3 test/unit/fedora_rpm_test.rb
View
10 test/fixtures/fedora_rpms.yml
@@ -4,8 +4,8 @@
# model remove the '{}' from the fixture names and add the columns immediately
# below each fixture, per the syntax in the comments below
#
-one: {}
-# column: value
-#
-two: {}
-# column: value
+one:
+ name: rubygem-foo
+ source_uri: http://fedoraproject.org
+ author: Nicolás Satragno
+ ruby_gem_id: 1
View
11 test/fixtures/rpm_versions.yml
@@ -0,0 +1,11 @@
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
+
+# This model initially had no columns defined. If you add columns to the
+# model remove the '{}' from the fixture names and add the columns immediately
+# below each fixture, per the syntax in the comments below
+#
+one:
+ fedora_rpm_id: 1
+ rpm_version: 2
+ fedora_version: 2
+ is_patched: true
View
13 test/fixtures/ruby_gems.yml
@@ -4,8 +4,11 @@
# model remove the '{}' from the fixture names and add the columns immediately
# below each fixture, per the syntax in the comments below
#
-one: {}
-# column: value
-#
-two: {}
-# column: value
+one:
+ name: foo
+ homepage: http://isitfedoraruby.com
+ version: 1.2.3.4
+ has_rpm: true
+ downloads: 666
+ source_uri: http://github.com
+
View
16 test/unit/fedora_rpm_test.rb
@@ -1,7 +1,17 @@
require 'test_helper'
class FedoraRpmTest < ActiveSupport::TestCase
- # test "the truth" do
- # assert true
- # end
+ test "obfuscated user returns well formatted name" do
+ r = FedoraRpm.new
+ r.fedora_user = "foo.bar@baz.com"
+ assert r.obfuscated_fedora_user == "foo DOT bar AT baz DOT com", "obfuscated_fedora_user DID NOT returned a valid string: #{r.obfuscated_fedora_user}"
+ end
+
+ test "shortname returns name without rubygem-" do
+ r = FedoraRpm.new
+ r.name = "rubygem-foo"
+ assert r.shortname == "foo", "RPM shortname did not return a valid string: #{r.shortname}"
+ r.name = "foo_bar"
+ assert r.shortname == "foo_bar", "RPM shortname did not return a valid string: #{r.shortname}"
+ end
end

0 comments on commit 33b3941

Please sign in to comment.