summaryrefslogtreecommitdiff
path: root/users/test
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2013-04-02 10:35:21 +0200
committerAzul <azul@leap.se>2013-04-09 09:01:34 +0200
commitaedfab27b9a03f41638fefb1b39857ca66a99257 (patch)
treedd3bf01b612a8ee83b4839df93e4d3fec446e064 /users/test
parent2fe1c1f23d5ac09f3eda68fa247e1efdf31f520b (diff)
initial token model and unit test
Diffstat (limited to 'users/test')
-rw-r--r--users/test/unit/token_test.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/users/test/unit/token_test.rb b/users/test/unit/token_test.rb
new file mode 100644
index 0000000..d409265
--- /dev/null
+++ b/users/test/unit/token_test.rb
@@ -0,0 +1,24 @@
+require 'test_helper'
+
+class ClientCertificateTest < ActiveSupport::TestCase
+
+ setup do
+ @user = FactoryGirl.create(:user)
+ end
+
+ teardown do
+ @user.destroy
+ end
+
+ test "new token for user" do
+ sample = Token.new(:user_id => @user.id)
+ assert sample.valid?
+ assert_equal @user.id, sample.user_id
+ end
+
+ test "token checks for user" do
+ sample = Token.new
+ assert !sample.valid?, "Token should require a user record"
+ end
+
+end