File: create_token_spec.rb

package info (click to toggle)
ruby-vagrant-cloud 3.0.5-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 408 kB
  • sloc: ruby: 4,343; makefile: 7
file content (79 lines) | stat: -rw-r--r-- 1,908 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
require 'spec_helper'
require 'vagrant_cloud'

describe VagrantCloud::Response::CreateToken do
  let(:token) { "token" }
  let(:token_hash) { "token_hash" }
  let(:created_at) { Time.now.to_s }
  let(:description) { "description" }

  let(:args) { {token: token, token_hash: token_hash,
    created_at: created_at, description: description } }
  let(:subject) { described_class.new(**args) }

  describe "#initialize" do
    it "should create a new instance" do
      expect { subject }.not_to raise_error
    end

    it "should require token" do
      args.delete(:token)
      expect { subject }.to raise_error(ArgumentError)
    end

    it "should require token_hash" do
      args.delete(:token_hash)
      expect { subject }.to raise_error(ArgumentError)
    end

    it "should require created_at" do
      args.delete(:created_at)
      expect { subject }.to raise_error(ArgumentError)
    end

    it "should require description" do
      args.delete(:description)
      expect { subject }.to raise_error(ArgumentError)
    end
  end

  describe "#token" do
    it "should return a value" do
      expect(subject.token).to eq(token)
    end

    it "should freeze the value" do
      expect(subject.token).to be_frozen
    end
  end

  describe "#token_hash" do
    it "should return a value" do
      expect(subject.token_hash).to eq(token_hash)
    end

    it "should freeze the value" do
      expect(subject.token_hash).to be_frozen
    end
  end

  describe "#created_at" do
    it "should return a value" do
      expect(subject.created_at).to eq(created_at)
    end

    it "should freeze the value" do
      expect(subject.created_at).to be_frozen
    end
  end

  describe "#description" do
    it "should return a value" do
      expect(subject.description).to eq(description)
    end

    it "should freeze the value" do
      expect(subject.description).to be_frozen
    end
  end
end