dtf-session 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +6 -3
- data/Gemfile.lock +17 -14
- data/README.md +3 -0
- data/db/dtf_session_development.sqlite3 +0 -0
- data/db/dtf_session_test.sqlite3 +0 -0
- data/lib/config/environment.rb +10 -4
- data/lib/dtf-session.rb +34 -3
- data/lib/dtf-session/version.rb +1 -1
- data/spec/dtf-session/dtf_session_spec.rb +35 -0
- data/spec/dtf-session/session/environment/environment_spec.rb +42 -0
- data/spec/dtf-session/session/session_spec.rb +30 -0
- data/spec/models/analysis_case_spec.rb +21 -37
- data/spec/models/case_test_spec.rb +22 -38
- data/spec/models/user_spec.rb +17 -32
- data/spec/models/verification_suite_spec.rb +21 -34
- metadata +27 -2
data/Gemfile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
3
|
# Specify your gem's dependencies in dtf-session.gemspec
|
4
|
-
group :development
|
4
|
+
group :development do
|
5
5
|
gem 'debugger'
|
6
6
|
gem 'pry'
|
7
7
|
gem 'pry-doc'
|
@@ -16,14 +16,17 @@ group :development, :test do
|
|
16
16
|
gem "pry-exception_explorer"
|
17
17
|
gem "jist"
|
18
18
|
gem "pry-theme"
|
19
|
-
gem 'simplecov'
|
20
|
-
gem 'database_cleaner'
|
21
19
|
gem 'travis-lint'
|
22
20
|
gem 'rspec-formatter-webkit'
|
23
21
|
end
|
24
22
|
|
25
23
|
group :test do
|
24
|
+
gem 'rspec'
|
25
|
+
gem 'rspec-given'
|
26
|
+
gem 'fabrication'
|
26
27
|
gem 'cover_me'
|
28
|
+
gem 'database_cleaner'
|
29
|
+
gem 'simplecov'
|
27
30
|
end
|
28
31
|
|
29
32
|
gemspec
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
dtf-session (0.0.
|
4
|
+
dtf-session (0.0.2)
|
5
5
|
dtf
|
6
6
|
json
|
7
7
|
json_pure
|
@@ -35,7 +35,7 @@ GEM
|
|
35
35
|
multi_json (~> 1.0)
|
36
36
|
arel (3.0.2)
|
37
37
|
binding_of_caller (0.6.8)
|
38
|
-
builder (3.0.
|
38
|
+
builder (3.0.4)
|
39
39
|
coderay (1.0.8)
|
40
40
|
columnize (0.3.6)
|
41
41
|
configatron (2.9.1)
|
@@ -43,17 +43,17 @@ GEM
|
|
43
43
|
cover_me (1.2.0)
|
44
44
|
configatron
|
45
45
|
hashie
|
46
|
-
database_cleaner (0.
|
46
|
+
database_cleaner (0.9.1)
|
47
47
|
debugger (1.1.4)
|
48
48
|
columnize (>= 0.3.1)
|
49
49
|
debugger-linecache (~> 1.1.1)
|
50
50
|
debugger-ruby_core_source (~> 1.1.3)
|
51
51
|
debugger-linecache (1.1.2)
|
52
52
|
debugger-ruby_core_source (>= 1.1.1)
|
53
|
-
debugger-ruby_core_source (1.1.
|
53
|
+
debugger-ruby_core_source (1.1.4)
|
54
54
|
diff-lcs (1.1.3)
|
55
55
|
diffy (2.0.8)
|
56
|
-
dtf (0.
|
56
|
+
dtf (0.4.0)
|
57
57
|
activemodel
|
58
58
|
activerecord
|
59
59
|
activesupport
|
@@ -65,7 +65,7 @@ GEM
|
|
65
65
|
thor
|
66
66
|
trollop
|
67
67
|
erubis (2.7.0)
|
68
|
-
fabrication (2.
|
68
|
+
fabrication (2.4.0)
|
69
69
|
fattr (2.2.1)
|
70
70
|
grit (2.5.0)
|
71
71
|
diff-lcs (~> 1.1)
|
@@ -75,12 +75,12 @@ GEM
|
|
75
75
|
hashr (0.0.22)
|
76
76
|
hike (1.2.1)
|
77
77
|
i18n (0.6.1)
|
78
|
-
jist (1.0
|
78
|
+
jist (1.1.0)
|
79
79
|
json
|
80
80
|
journey (1.0.4)
|
81
81
|
json (1.7.5)
|
82
82
|
json_pure (1.7.5)
|
83
|
-
method_source (0.8)
|
83
|
+
method_source (0.8.1)
|
84
84
|
mime-types (1.19)
|
85
85
|
multi_json (1.3.6)
|
86
86
|
nokogiri (1.5.5)
|
@@ -135,7 +135,7 @@ GEM
|
|
135
135
|
rake (0.9.2.2)
|
136
136
|
rdoc (3.12)
|
137
137
|
json (~> 1.4)
|
138
|
-
redcarpet (2.
|
138
|
+
redcarpet (2.2.1)
|
139
139
|
rspec (2.11.0)
|
140
140
|
rspec-core (~> 2.11.0)
|
141
141
|
rspec-expectations (~> 2.11.0)
|
@@ -145,20 +145,22 @@ GEM
|
|
145
145
|
diff-lcs (~> 1.1.3)
|
146
146
|
rspec-formatter-webkit (2.2.0)
|
147
147
|
rspec-core (~> 2.7)
|
148
|
+
rspec-given (2.0.0)
|
149
|
+
rspec (> 1.2.8)
|
148
150
|
rspec-mocks (2.11.3)
|
149
151
|
session (3.1.0)
|
150
152
|
fattr
|
151
|
-
simplecov (0.7.
|
153
|
+
simplecov (0.7.1)
|
152
154
|
multi_json (~> 1.0)
|
153
|
-
simplecov-html (~> 0.7.
|
154
|
-
simplecov-html (0.7.
|
155
|
+
simplecov-html (~> 0.7.1)
|
156
|
+
simplecov-html (0.7.1)
|
155
157
|
slop (3.3.3)
|
156
158
|
sprockets (2.1.3)
|
157
159
|
hike (~> 1.2)
|
158
160
|
rack (~> 1.0)
|
159
161
|
tilt (~> 1.1, != 1.3.0)
|
160
162
|
sqlite3 (1.3.6)
|
161
|
-
standalone_migrations (2.0.
|
163
|
+
standalone_migrations (2.0.2)
|
162
164
|
activerecord (~> 3.2.6)
|
163
165
|
railties (~> 3.2.6)
|
164
166
|
rake
|
@@ -169,7 +171,7 @@ GEM
|
|
169
171
|
trollop (2.0)
|
170
172
|
tzinfo (0.3.33)
|
171
173
|
yamler (0.1.0)
|
172
|
-
yard (0.8.
|
174
|
+
yard (0.8.3)
|
173
175
|
|
174
176
|
PLATFORMS
|
175
177
|
ruby
|
@@ -196,6 +198,7 @@ DEPENDENCIES
|
|
196
198
|
redcarpet
|
197
199
|
rspec
|
198
200
|
rspec-formatter-webkit
|
201
|
+
rspec-given
|
199
202
|
simplecov
|
200
203
|
travis-lint
|
201
204
|
yard
|
data/README.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
[![Build Status](https://travis-ci.org/dtf-gems/dtf-session.png)](https://travis-ci.org/dtf-gems/dtf-session)
|
2
|
+
[![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/dtf-gems/dtf-session)
|
3
|
+
|
1
4
|
# Deryls Testing Framework
|
2
5
|
|
3
6
|
DTF is designed to be a modular framework for testing everything from shell scripts, to Ruby, to Rails apps.
|
Binary file
|
data/db/dtf_session_test.sqlite3
CHANGED
Binary file
|
data/lib/config/environment.rb
CHANGED
@@ -16,10 +16,16 @@ require 'thor'
|
|
16
16
|
ENV['RAILS_ENV'] ||= 'development'
|
17
17
|
|
18
18
|
# Load the db config and create a connectoid. Make an ivar so its shared throughout the application
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
if ENV['RAILS_ENV'] == 'test' then
|
20
|
+
ActiveRecord::Base.establish_connection adapter: 'sqlite3', database: ':memory:'
|
21
|
+
puts "NOTICE: Loading db schema to IN-MEMORY SQLite3 db"
|
22
|
+
load "#{File.join(File.dirname(__FILE__), '../../db/schema.rb')}"
|
23
|
+
else
|
24
|
+
@dbconfig = YAML::load(File.open(File.join(File.dirname(__FILE__), '../../db/config.yml')))[ENV['RAILS_ENV']]
|
25
|
+
# Establish the database connection
|
26
|
+
puts "NOTICE: Loading db schema to ON-DISK SQLite3 db"
|
27
|
+
ActiveRecord::Base.establish_connection(@dbconfig) # Line that actually connects the db.
|
28
|
+
end
|
23
29
|
|
24
30
|
# Load all the models
|
25
31
|
Dir["#{File.join(File.dirname(__FILE__), '../../app/models/*.rb')}"].each do |model|
|
data/lib/dtf-session.rb
CHANGED
@@ -1,11 +1,42 @@
|
|
1
1
|
require "dtf-session/version"
|
2
2
|
require 'thor'
|
3
|
-
require 'session'
|
4
3
|
|
5
|
-
module Dtf
|
6
4
|
load "#{File.join(File.dirname(__FILE__), "/config/environment.rb")}"
|
7
5
|
|
6
|
+
# TODO: Add any fields from testrunner to CaseTest still needed
|
7
|
+
|
8
|
+
module Dtf
|
9
|
+
|
8
10
|
module Session
|
9
|
-
|
11
|
+
require 'session'
|
12
|
+
|
13
|
+
|
14
|
+
class Environment
|
15
|
+
|
16
|
+
attr_accessor :test_shell
|
17
|
+
attr_accessor :start_env
|
18
|
+
attr_accessor :stop_env
|
19
|
+
|
20
|
+
def set_start_env(shell)
|
21
|
+
env = shell.execute('printenv')
|
22
|
+
@start_env = self.env_to_hash(env[0])
|
23
|
+
end
|
24
|
+
|
25
|
+
def set_stop_env(shell)
|
26
|
+
env = shell.execute('printenv')
|
27
|
+
@stop_env = self.env_to_hash(env[0])
|
28
|
+
end
|
29
|
+
|
30
|
+
def env_to_hash(env_string)
|
31
|
+
lines = env_string.split("\n")
|
32
|
+
key_value_pairs = lines.map { |line|
|
33
|
+
key, value = *line.split("=", 2)
|
34
|
+
[key.to_sym, value]
|
35
|
+
}
|
36
|
+
|
37
|
+
Hash[key_value_pairs]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
10
41
|
end
|
11
42
|
end
|
data/lib/dtf-session/version.rb
CHANGED
@@ -0,0 +1,35 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
|
3
|
+
describe Dtf::Session do
|
4
|
+
|
5
|
+
context "Module" do
|
6
|
+
|
7
|
+
it "should be a Module" do
|
8
|
+
Dtf::Session.class.should eq(Module)
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should specify a VERSION" do
|
12
|
+
Dtf::Session.class.const_defined?(:VERSION)
|
13
|
+
Dtf::Session::VERSION.should_not be_empty
|
14
|
+
Dtf::Session::VERSION.class.should eq(String)
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
context "Dependencies" do
|
20
|
+
|
21
|
+
it "should depend on DTF master gem" do
|
22
|
+
@gem_dep = false
|
23
|
+
Gem.loaded_specs['dtf-session'].dependencies.each do |spec|
|
24
|
+
if spec.name == "dtf"
|
25
|
+
@gem_dep = true
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
@gem_dep.should be_true
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
|
2
|
+
|
3
|
+
describe "Environment" do
|
4
|
+
|
5
|
+
context "Class" do
|
6
|
+
|
7
|
+
it "should be a Class" do
|
8
|
+
Dtf::Session::Environment.class.should eq(Class)
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
12
|
+
|
13
|
+
context "Environment Configuration" do
|
14
|
+
env = Dtf::Session::Environment.new
|
15
|
+
|
16
|
+
it "should be assigned a Shell process" do
|
17
|
+
env.test_shell = ::Session::Bash.new
|
18
|
+
env.test_shell.class.should eq(Session::Bash)
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should capture the Shell's pre-execution environment" do
|
22
|
+
env.start_env = env.set_start_env(env.test_shell)
|
23
|
+
env.start_env.should be_a(Hash)
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should be able to execute a Shell command" do
|
27
|
+
env.test_shell.respond_to?(:execute)
|
28
|
+
env.test_shell.execute('ls')
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should be able to test the Shell's exist status" do
|
32
|
+
env.test_shell.status.should_not be nil
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should capture the Shell's post-execution environment" do
|
36
|
+
env.stop_env = env.set_stop_env(env.test_shell)
|
37
|
+
env.stop_env.should be_a(Hash)
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
2
|
+
|
3
|
+
describe Session do
|
4
|
+
|
5
|
+
context "Module" do
|
6
|
+
|
7
|
+
it "should be a Module" do
|
8
|
+
Dtf::Session.class.should eq(Module)
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
12
|
+
|
13
|
+
context "Dependencies" do
|
14
|
+
|
15
|
+
it "should depend on Session gem" do
|
16
|
+
Gem.loaded_specs['session'].should_not be_nil
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
context "Contained Classes" do
|
22
|
+
|
23
|
+
it "should contain Environment class" do
|
24
|
+
Dtf::Session.constants.include?(:Environment)
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
@@ -6,59 +6,43 @@ describe "AnalysisCase" do
|
|
6
6
|
|
7
7
|
context "when instantiated" do
|
8
8
|
|
9
|
-
let(:analysis_case) { AnalysisCase.new }
|
10
|
-
|
11
9
|
it "should be the proper class" do
|
12
|
-
analysis_case.should be_a(AnalysisCase)
|
10
|
+
Fabricate.build(:analysis_case).should be_a(AnalysisCase)
|
13
11
|
end
|
14
|
-
|
15
|
-
it "should be invalid without
|
16
|
-
analysis_case.should_not be_valid
|
17
|
-
analysis_case.errors.should_not be_empty
|
18
|
-
analysis_case[:verification_suite_id].should be_nil
|
19
|
-
analysis_case.new_record?.should be_true
|
20
|
-
end
|
21
|
-
|
22
|
-
it "should be invalid without a name" do
|
23
|
-
analysis_case.should_not be_valid
|
24
|
-
analysis_case.errors.should_not be_empty
|
25
|
-
analysis_case.errors.messages[:name].should eq(["can't be blank"])
|
26
|
-
analysis_case.new_record?.should be_true
|
12
|
+
|
13
|
+
it "should be invalid without a name" do
|
14
|
+
Fabricate.build(:analysis_case, name: nil).should_not be_valid
|
27
15
|
end
|
28
|
-
|
29
|
-
it "should be invalid without a description" do
|
30
|
-
analysis_case.should_not be_valid
|
31
|
-
|
32
|
-
|
33
|
-
|
16
|
+
|
17
|
+
it "should be invalid without a description" do
|
18
|
+
Fabricate.build(:analysis_case, description: nil).should_not be_valid
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should be invalid without being assigned to a verification suite" do
|
22
|
+
analysis_case = Fabricate.build(:analysis_case)
|
23
|
+
analysis_case[:verification_suite_id].should be_nil
|
34
24
|
end
|
35
25
|
|
36
26
|
it "should not be saved" do
|
37
|
-
analysis_case.new_record?.should be_true
|
38
|
-
analysis_case.persisted?.should_not be_true
|
27
|
+
Fabricate.build(:analysis_case).new_record?.should be_true
|
39
28
|
end
|
40
29
|
|
41
|
-
end
|
42
|
-
|
30
|
+
end
|
31
|
+
|
43
32
|
context "when created" do
|
44
33
|
user = Fabricate(:user)
|
45
34
|
vs = user.verification_suites.create(name: "RSpec Test VS", description: "Bogus VS for RSpec")
|
46
35
|
analysis_case = vs.analysis_cases.create(name: "RSpec Test AC", description: "Bogus AC for RSpec")
|
47
|
-
|
48
|
-
it "should be owned by a verification suite" do
|
49
|
-
analysis_case.should be_valid
|
36
|
+
|
37
|
+
it "should be owned by a verification suite" do
|
50
38
|
analysis_case.verification_suite_id.should_not be_nil
|
51
|
-
end
|
39
|
+
end
|
52
40
|
|
53
|
-
it "should have a valid name and description" do
|
41
|
+
it "should have a valid name and description" do
|
54
42
|
analysis_case.should be_valid
|
55
|
-
|
56
|
-
|
57
|
-
analysis_case.description.should_not be_nil
|
58
|
-
end
|
59
|
-
|
43
|
+
end
|
44
|
+
|
60
45
|
it "should be saved" do
|
61
|
-
analysis_case.should be_valid
|
62
46
|
analysis_case.new_record?.should_not be_true
|
63
47
|
analysis_case.persisted?.should be_true
|
64
48
|
end
|
@@ -6,62 +6,46 @@ describe "CaseTest" do
|
|
6
6
|
|
7
7
|
context "when instantiated" do
|
8
8
|
|
9
|
-
let(:case_test) { CaseTest.new }
|
10
|
-
|
11
9
|
it "should be the proper class" do
|
12
|
-
case_test.should be_a(CaseTest)
|
10
|
+
Fabricate.build(:case_test).should be_a(CaseTest)
|
13
11
|
end
|
14
|
-
|
15
|
-
it "should be invalid without
|
16
|
-
case_test.should_not be_valid
|
17
|
-
case_test.errors.should_not be_empty
|
18
|
-
case_test[:analysis_case_id].should be_nil
|
19
|
-
case_test.new_record?.should be_true
|
20
|
-
end
|
21
|
-
|
22
|
-
it "should be invalid without a cmd" do
|
23
|
-
case_test.should_not be_valid
|
24
|
-
case_test.errors.should_not be_empty
|
25
|
-
case_test.errors.messages[:cmd].should eq(["can't be blank"])
|
26
|
-
case_test.new_record?.should be_true
|
12
|
+
|
13
|
+
it "should be invalid without a description" do
|
14
|
+
Fabricate.build(:case_test, description: nil).should_not be_valid
|
27
15
|
end
|
28
|
-
|
29
|
-
it "should be invalid without a
|
30
|
-
case_test.should_not be_valid
|
31
|
-
|
32
|
-
|
33
|
-
|
16
|
+
|
17
|
+
it "should be invalid without a command" do
|
18
|
+
Fabricate.build(:case_test, cmd: nil).should_not be_valid
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should be invalid without being assigned to an analysis case" do
|
22
|
+
case_test = Fabricate.build(:case_test)
|
23
|
+
case_test[:analysis_case_id].should be_nil
|
34
24
|
end
|
35
25
|
|
36
26
|
it "should not be saved" do
|
37
|
-
case_test.new_record?.should be_true
|
38
|
-
case_test.persisted?.should_not be_true
|
27
|
+
Fabricate.build(:case_test).new_record?.should be_true
|
39
28
|
end
|
40
29
|
|
41
|
-
end
|
42
|
-
|
30
|
+
end
|
31
|
+
|
43
32
|
context "when created" do
|
44
33
|
user = Fabricate(:user)
|
45
34
|
vs = user.verification_suites.create(name: "RSpec Test VS", description: "Bogus VS for RSpec")
|
46
35
|
analysis_case = vs.analysis_cases.create(name: "RSpec Test AC", description: "Bogus AC for RSpec")
|
47
|
-
case_test = analysis_case.case_tests.create(cmd: "bundle exec rspec spec",
|
36
|
+
case_test = analysis_case.case_tests.create(cmd: "bundle exec rspec spec",
|
48
37
|
description: "Bogus CT for RSpec"
|
49
38
|
)
|
50
|
-
|
51
|
-
it "should be owned by an analysis case" do
|
52
|
-
case_test.should be_valid
|
39
|
+
|
40
|
+
it "should be owned by an analysis case" do
|
53
41
|
case_test.analysis_case_id.should_not be_nil
|
54
|
-
end
|
42
|
+
end
|
55
43
|
|
56
|
-
it "should have a valid cmd and description" do
|
44
|
+
it "should have a valid cmd and description" do
|
57
45
|
case_test.should be_valid
|
58
|
-
|
59
|
-
|
60
|
-
case_test.description.should_not be_nil
|
61
|
-
end
|
62
|
-
|
46
|
+
end
|
47
|
+
|
63
48
|
it "should be saved" do
|
64
|
-
case_test.should be_valid
|
65
49
|
case_test.new_record?.should_not be_true
|
66
50
|
case_test.persisted?.should be_true
|
67
51
|
end
|
data/spec/models/user_spec.rb
CHANGED
@@ -6,51 +6,36 @@ describe "User" do
|
|
6
6
|
|
7
7
|
context "when instantiated" do
|
8
8
|
|
9
|
-
let(:user) { User.new }
|
10
|
-
|
11
9
|
it "should be the proper class" do
|
12
|
-
user.should be_a(User)
|
10
|
+
Fabricate.build(:user).should be_a(User)
|
13
11
|
end
|
14
12
|
|
15
|
-
it "should be invalid without a user_name" do
|
16
|
-
user.should_not be_valid
|
17
|
-
user.errors.should_not be_empty
|
18
|
-
user.errors.messages[:user_name].should eq(["can't be blank"])
|
19
|
-
user.new_record?.should be_true
|
20
|
-
end
|
21
|
-
|
22
|
-
it "should be invalid without an email_address" do
|
23
|
-
user.should_not be_valid
|
24
|
-
user.errors.should_not be_empty
|
25
|
-
user.errors.messages[:email_address].should eq(["can't be blank"])
|
26
|
-
user.new_record?.should be_true
|
13
|
+
it "should be invalid without a user_name" do
|
14
|
+
Fabricate.build(:user, user_name: nil).should_not be_valid
|
27
15
|
end
|
28
|
-
|
29
|
-
it "should be invalid without
|
30
|
-
user.should_not be_valid
|
31
|
-
|
32
|
-
|
33
|
-
|
16
|
+
|
17
|
+
it "should be invalid without an email_address" do
|
18
|
+
Fabricate.build(:user, email_address: nil).should_not be_valid
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should be invalid without a full_name" do
|
22
|
+
Fabricate.build(:user, full_name: nil).should_not be_valid
|
34
23
|
end
|
35
24
|
|
36
25
|
it "should not be saved" do
|
37
|
-
user.new_record?.should be_true
|
38
|
-
user.persisted?.should_not be_true
|
26
|
+
Fabricate.build(:user).new_record?.should be_true
|
39
27
|
end
|
40
28
|
|
41
|
-
end
|
42
|
-
|
29
|
+
end
|
30
|
+
|
43
31
|
context "when created" do
|
44
32
|
let(:user) { Fabricate(:user)}
|
45
|
-
|
46
|
-
it "should have a valid user_name, full_name, and email_address" do
|
33
|
+
|
34
|
+
it "should have a valid user_name, full_name, and email_address" do
|
47
35
|
user.should be_valid
|
48
36
|
user.errors.should be_empty
|
49
|
-
|
50
|
-
|
51
|
-
user.email_address.should_not be_nil
|
52
|
-
end
|
53
|
-
|
37
|
+
end
|
38
|
+
|
54
39
|
it "should be saved" do
|
55
40
|
user.new_record?.should_not be_true
|
56
41
|
user.persisted?.should be_true
|
@@ -6,57 +6,44 @@ describe "VerificationSuite" do
|
|
6
6
|
|
7
7
|
context "when instantiated" do
|
8
8
|
|
9
|
-
let(:verification_suite) { VerificationSuite.new }
|
10
|
-
|
11
9
|
it "should be the proper class" do
|
12
|
-
verification_suite.should be_a(VerificationSuite)
|
10
|
+
Fabricate.build(:verification_suite).should be_a(VerificationSuite)
|
13
11
|
end
|
14
|
-
|
15
|
-
it "should be invalid without
|
16
|
-
verification_suite.should_not be_valid
|
17
|
-
verification_suite.errors.should_not be_empty
|
18
|
-
verification_suite[:user_id].should be_nil
|
19
|
-
verification_suite.new_record?.should be_true
|
20
|
-
end
|
21
|
-
|
22
|
-
it "should be invalid without a name" do
|
23
|
-
verification_suite.should_not be_valid
|
24
|
-
verification_suite.errors.should_not be_empty
|
25
|
-
verification_suite.errors.messages[:name].should eq(["can't be blank"])
|
26
|
-
verification_suite.new_record?.should be_true
|
12
|
+
|
13
|
+
it "should be invalid without a name" do
|
14
|
+
Fabricate.build(:verification_suite, name: nil).should_not be_valid
|
27
15
|
end
|
28
|
-
|
29
|
-
it "should be invalid without a description" do
|
16
|
+
|
17
|
+
it "should be invalid without a description" do
|
18
|
+
Fabricate.build(:verification_suite, description: nil).should_not be_valid
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should be invalid without being assigned to a user" do
|
22
|
+
user = Fabricate.build(:user)
|
23
|
+
verification_suite = user.verification_suites.build(name: "RSpec Test VS", description: nil)
|
30
24
|
verification_suite.should_not be_valid
|
31
|
-
verification_suite.errors.should_not be_empty
|
32
|
-
verification_suite.errors.messages[:description].should eq(["can't be blank"])
|
33
|
-
verification_suite.new_record?.should be_true
|
34
25
|
end
|
35
26
|
|
36
27
|
it "should not be saved" do
|
37
|
-
verification_suite.new_record?.should be_true
|
38
|
-
verification_suite.persisted?.should_not be_true
|
28
|
+
Fabricate.build(:verification_suite).new_record?.should be_true
|
39
29
|
end
|
40
30
|
|
41
|
-
end
|
42
|
-
|
31
|
+
end
|
32
|
+
|
43
33
|
context "when created" do
|
44
34
|
user = Fabricate(:user)
|
45
35
|
verification_suite = user.verification_suites.create(name: "RSpec Test VS", description: "Bogus VS for RSpec")
|
46
|
-
|
36
|
+
user.verification_suites.count.should == 1
|
37
|
+
|
47
38
|
it "should be owned by a user" do
|
48
39
|
verification_suite.user_id.should_not be_nil
|
49
|
-
end
|
40
|
+
end
|
50
41
|
|
51
|
-
it "should have a valid name and description" do
|
42
|
+
it "should have a valid name and description" do
|
52
43
|
verification_suite.should be_valid
|
53
|
-
|
54
|
-
|
55
|
-
verification_suite.description.should_not be_nil
|
56
|
-
end
|
57
|
-
|
44
|
+
end
|
45
|
+
|
58
46
|
it "should be saved" do
|
59
|
-
verification_suite.should be_valid
|
60
47
|
verification_suite.new_record?.should_not be_true
|
61
48
|
verification_suite.persisted?.should be_true
|
62
49
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dtf-session
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: dtf
|
@@ -123,6 +123,22 @@ dependencies:
|
|
123
123
|
- - ! '>='
|
124
124
|
- !ruby/object:Gem::Version
|
125
125
|
version: '0'
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: rspec-given
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - ! '>='
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
type: :development
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
126
142
|
- !ruby/object:Gem::Dependency
|
127
143
|
name: fabrication
|
128
144
|
requirement: !ruby/object:Gem::Requirement
|
@@ -186,6 +202,9 @@ files:
|
|
186
202
|
- LICENSE
|
187
203
|
- Rakefile
|
188
204
|
- README.md
|
205
|
+
- spec/dtf-session/dtf_session_spec.rb
|
206
|
+
- spec/dtf-session/session/environment/environment_spec.rb
|
207
|
+
- spec/dtf-session/session/session_spec.rb
|
189
208
|
- spec/fabricators/analysis_case_fabricator.rb
|
190
209
|
- spec/fabricators/case_test_fabricator.rb
|
191
210
|
- spec/fabricators/user_fabricator.rb
|
@@ -222,6 +241,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
222
241
|
- - ! '>='
|
223
242
|
- !ruby/object:Gem::Version
|
224
243
|
version: '0'
|
244
|
+
segments:
|
245
|
+
- 0
|
246
|
+
hash: -4546103080094065845
|
225
247
|
requirements: []
|
226
248
|
rubyforge_project:
|
227
249
|
rubygems_version: 1.8.24
|
@@ -230,6 +252,9 @@ specification_version: 3
|
|
230
252
|
summary: dtf-session adds Bash Session gem support for commandline based testing to
|
231
253
|
DTF.
|
232
254
|
test_files:
|
255
|
+
- spec/dtf-session/dtf_session_spec.rb
|
256
|
+
- spec/dtf-session/session/environment/environment_spec.rb
|
257
|
+
- spec/dtf-session/session/session_spec.rb
|
233
258
|
- spec/fabricators/analysis_case_fabricator.rb
|
234
259
|
- spec/fabricators/case_test_fabricator.rb
|
235
260
|
- spec/fabricators/user_fabricator.rb
|