dtf 0.3.9 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/.rvmrc CHANGED
@@ -6,7 +6,7 @@
6
6
  # First we specify our desired <ruby>[@<gemset>], the @gemset name is optional,
7
7
  # Only full ruby name is supported here, for short names use:
8
8
  # echo "rvm use 1.9.3" > .rvmrc
9
- environment_id="ruby-1.9.3-p194@dtf"
9
+ environment_id="ruby-1.9.3-p286@dtf"
10
10
 
11
11
  # Uncomment the following lines if you want to verify rvm version per project
12
12
  rvmrc_rvm_version="1.14.1 (master)" # 1.10.1 seams as a safe start
@@ -1,23 +1,33 @@
1
1
  language: ruby
2
+ branches:
3
+ only:
4
+ - master
5
+ - stable
2
6
  rvm:
3
7
  - 1.9.2
4
8
  - 1.9.3
9
+ matrix:
10
+ allow_failures:
11
+ - rvm: 1.9.2
12
+ env:
13
+ global:
14
+ RAILS_ENV='test'
5
15
  before_install:
6
16
  - gem update bundler
17
+ install:
18
+ - bundle install --without development
7
19
  before_script:
8
- - RAILS_ENV='development' bundle exec gem list
9
- - RAILS_ENV='development' bundle exec thor dtf_setup:config
10
- - RAILS_ENV='development' bundle exec rake db:migrate
11
- - RAILS_ENV='development' bundle exec rspec spec --profile --format doc
12
- script: RAILS_ENV='production' gem build dtf.gemspec
20
+ - bundle exec gem list
21
+ script: bundle exec rspec spec --profile
22
+ after_script: RAILS_ENV='production' gem build dtf.gemspec
13
23
  notifications:
14
24
  irc:
15
25
  channels:
16
- - "irc.freenode.org#dtf-gems"
17
- on_success: always
26
+ - "irc.freenode.org#dtf-gems"
18
27
  on_failure: always
28
+ on_success: always
19
29
  email:
20
30
  recipients:
21
31
  - me@daviddwdowney.com
22
- on_success: always
23
32
  on_failure: always
33
+ on_success: always
data/Gemfile CHANGED
@@ -2,7 +2,7 @@
2
2
  source 'https://rubygems.org'
3
3
 
4
4
  # Specify your gem's dependencies in dtf.gemspec
5
- group :development, :test do
5
+ group :development do
6
6
  #gem "pry", :git => "https://github.com/pry/pry.git"
7
7
  #gem "pry-doc", :git => "https://github.com/pry/pry-doc.git"
8
8
  #gem "method_source", :git => "https://github.com/banister/method_source.git"
@@ -24,7 +24,13 @@ group :development, :test do
24
24
  end
25
25
 
26
26
  group :test do
27
+ gem 'turnip'
28
+ gem 'rspec'
29
+ gem 'rspec-given'
30
+ gem 'fabrication'
27
31
  gem 'cover_me'
32
+ gem 'database_cleaner'
33
+ gem 'simplecov'
28
34
  end
29
35
 
30
36
  gemspec
data/README.md CHANGED
@@ -1,3 +1,6 @@
1
+ [![Build Status](https://travis-ci.org/dtf-gems/dtf.png)](https://travis-ci.org/dtf-gems/dtf)
2
+ [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/dtf-gems/dtf)
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.
@@ -10,6 +10,6 @@ class AnalysisCase < ActiveRecord::Base
10
10
 
11
11
  belongs_to :verification_suite, :autosave => :true
12
12
  belongs_to :user, :autosave => :true
13
- has_many :case_tests, :dependent => :destroy
13
+ has_many :case_tests, :include => :verification_suites, :dependent => :destroy
14
14
 
15
15
  end
@@ -7,5 +7,5 @@ class CaseTest < ActiveRecord::Base
7
7
  validates_presence_of :description, :cmd
8
8
 
9
9
  belongs_to :analysis_case, :autosave => :true
10
- has_one :verification_suite, :through => :analysis_case, :autosave => :true
10
+ has_one :verification_suite, :through => :analysis_case, :include => :verification_suites, :autosave => :true
11
11
  end
@@ -7,8 +7,8 @@ class User < ActiveRecord::Base
7
7
  validates :full_name, :email_address, :user_name, :presence => true
8
8
  validates :user_name, :email_address, :uniqueness => true
9
9
 
10
- has_many :verification_suites, :dependent => :destroy
11
- has_many :analysis_cases, :through => :verification_suites, :dependent => :destroy
12
- has_many :case_tests, :through => :verification_suites, :dependent => :destroy
10
+ has_many :verification_suites, :include => :analysis_cases, :include => :case_tests, :dependent => :destroy
11
+ has_many :analysis_cases, :through => :verification_suites, :include => :case_tests, :dependent => :destroy
12
+ has_many :case_tests, :through => :verification_suites, :include => :analysis_cases, :dependent => :destroy
13
13
 
14
14
  end
@@ -17,7 +17,7 @@ class VerificationSuite < ActiveRecord::Base
17
17
  validates_presence_of :name, :description
18
18
 
19
19
  belongs_to :user, :autosave => :true
20
- has_many :analysis_cases, :dependent => :destroy
21
- has_many :case_tests, :through => :analysis_cases, :dependent => :destroy
20
+ has_many :analysis_cases, :include => :case_tests, :dependent => :destroy
21
+ has_many :case_tests, :through => :analysis_cases, :include => :analysis_cases, :dependent => :destroy
22
22
 
23
23
  end
@@ -10,16 +10,25 @@ require 'yaml'
10
10
  require 'logger'
11
11
  require 'thor'
12
12
 
13
+ # NOTE: Set RAILS_ENV to 'production' for ActiveRecord. Affects the database to use.
14
+ # Change this to 'development' while working on the gem itself, or set it in the
15
+ # environment prefixed to commands, in order to gain access to testing gems.
13
16
  # NOTE: Set RAILS_ENV to 'production' for ActiveRecord. Affects the database to use.
14
17
  # Change this to 'development' while working on the gem itself, or set it in the
15
18
  # environment prefixed to commands, in order to gain access to testing gems.
16
19
  ENV['RAILS_ENV'] ||= 'development'
17
20
 
18
21
  # Load the db config and create a connectoid. Make an ivar so its shared throughout the application
19
- @dbconfig = YAML::load(File.open(File.join(File.dirname(__FILE__), '../../db/config.yml')))[ENV['RAILS_ENV']]
20
-
21
- # Establish the database connection
22
- ActiveRecord::Base.establish_connection(@dbconfig) # Line that actually connects the db.
22
+ if ENV['RAILS_ENV'] == 'test' then
23
+ ActiveRecord::Base.establish_connection adapter: 'sqlite3', database: ':memory:'
24
+ puts "NOTICE: Loading db schema to IN-MEMORY SQLite3 db"
25
+ load "#{File.join(File.dirname(__FILE__), '../../db/schema.rb')}"
26
+ else
27
+ @dbconfig = YAML::load(File.open(File.join(File.dirname(__FILE__), '../../db/config.yml')))[ENV['RAILS_ENV']]
28
+ # Establish the database connection
29
+ puts "NOTICE: Loading db schema to ON-DISK SQLite3 db"
30
+ ActiveRecord::Base.establish_connection(@dbconfig) # Line that actually connects the db.
31
+ end
23
32
 
24
33
  # Load all the models
25
34
  Dir["#{File.join(File.dirname(__FILE__), '../../app/models/*.rb')}"].each do |model|
@@ -1,5 +1,5 @@
1
1
  # encoding: UTF-8
2
2
 
3
3
  module Dtf
4
- VERSION = "0.3.9"
4
+ VERSION = "0.4.0"
5
5
  end
@@ -5,7 +5,7 @@ Feature: Verify sub commands
5
5
 
6
6
  Background:
7
7
  Given I have dtf installed
8
-
8
+
9
9
  Scenario: Execution of create_user succeeds
10
10
  Given I execute 'create_user'
11
11
  Then I should find 'testuser' in the database
@@ -24,8 +24,8 @@ Feature: Verify sub commands
24
24
  send "I create 'create_user'"
25
25
  Given I execute 'create_vs'
26
26
  Then I should find a VS in the database
27
-
27
+
28
28
  Scenario: Execution of delete_vs succeeds
29
29
  send "I execute 'create_user'"
30
30
  Given I execute 'delete_vs'
31
- Then I should not find a VS in the database
31
+ Then I should not find a VS in the database
@@ -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 being assigned to a verification suite" do
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
- analysis_case.errors.should_not be_empty
32
- analysis_case.errors.messages[:description].should eq(["can't be blank"])
33
- analysis_case.new_record?.should be_true
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
- analysis_case.errors.should be_empty
56
- analysis_case.name.should_not be_nil
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 being assigned to a analysis case" do
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 description" do
30
- case_test.should_not be_valid
31
- case_test.errors.should_not be_empty
32
- case_test.errors.messages[:description].should eq(["can't be blank"])
33
- case_test.new_record?.should be_true
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
- case_test.errors.should be_empty
59
- case_test.cmd.should_not be_nil
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
@@ -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 a full_name" do
30
- user.should_not be_valid
31
- user.errors.should_not be_empty
32
- user.errors.messages[:full_name].should eq(["can't be blank"])
33
- user.new_record?.should be_true
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
- user.user_name.should_not be_nil
50
- user.full_name.should_not be_nil
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 being assigned to a user" do
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
- verification_suite.errors.should be_empty
54
- verification_suite.name.should_not be_nil
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
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.9
4
+ version: 0.4.0
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-10 00:00:00.000000000 Z
12
+ date: 2012-10-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -365,6 +365,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
365
365
  - - ! '>='
366
366
  - !ruby/object:Gem::Version
367
367
  version: '0'
368
+ segments:
369
+ - 0
370
+ hash: -3183727818886971908
368
371
  requirements: []
369
372
  rubyforge_project: dtf
370
373
  rubygems_version: 1.8.24