zeus 0.15.3 → 0.15.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile CHANGED
@@ -1,4 +1,7 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- # Specify your gem's dependencies in zeus.gemspec
4
- gemspec
3
+ # NOTE: Avoid putting development deps in gemspec
4
+ gemspec development_group: :gem_build_tools
5
+
6
+ gem 'rspec', '~> 3.1', groups: [:test, :development]
7
+ gem 'rake', group: :gem_build_tools
@@ -1,36 +1,33 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- zeus (0.15.3)
4
+ zeus (0.15.4)
5
5
  method_source (>= 0.6.7)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- diff-lcs (1.1.3)
11
- hpricot (0.8.6)
10
+ diff-lcs (1.2.5)
12
11
  method_source (0.8.2)
13
- mustache (0.99.5)
14
12
  rake (10.3.0)
15
- rdiscount (2.1.7.1)
16
- ronn (0.7.3)
17
- hpricot (>= 0.8.2)
18
- mustache (>= 0.7.0)
19
- rdiscount (>= 1.5.8)
20
- rspec (2.12.0)
21
- rspec-core (~> 2.12.0)
22
- rspec-expectations (~> 2.12.0)
23
- rspec-mocks (~> 2.12.0)
24
- rspec-core (2.12.2)
25
- rspec-expectations (2.12.1)
26
- diff-lcs (~> 1.1.3)
27
- rspec-mocks (2.12.2)
13
+ rspec (3.1.0)
14
+ rspec-core (~> 3.1.0)
15
+ rspec-expectations (~> 3.1.0)
16
+ rspec-mocks (~> 3.1.0)
17
+ rspec-core (3.1.7)
18
+ rspec-support (~> 3.1.0)
19
+ rspec-expectations (3.1.2)
20
+ diff-lcs (>= 1.2.0, < 2.0)
21
+ rspec-support (~> 3.1.0)
22
+ rspec-mocks (3.1.3)
23
+ rspec-support (~> 3.1.0)
24
+ rspec-support (3.1.2)
28
25
 
29
26
  PLATFORMS
30
27
  ruby
31
28
 
32
29
  DEPENDENCIES
30
+ bundler (~> 1.6)
33
31
  rake
34
- ronn (>= 0.7.0)
35
- rspec (~> 2.12.0)
32
+ rspec (~> 3.1)
36
33
  zeus!
Binary file
Binary file
Binary file
Binary file
@@ -102,6 +102,7 @@ void go()
102
102
  if (retval == -1) {
103
103
  // perror("select");
104
104
  } else if (retval) {
105
+ if(feof(stdin)) break;
105
106
  if (FD_ISSET(0, &rfds)) handleStdin();
106
107
  if (FD_ISSET(_inotify_fd, &rfds)) handleInotify();
107
108
  }
@@ -126,10 +126,8 @@ module Zeus
126
126
  def parse
127
127
  # With no arguments,
128
128
  if @argv.empty?
129
- # Just shell out to `rake test`.
130
- require 'rake'
131
- Rake::Task['test'].invoke
132
- exit
129
+ @files = []
130
+ add_file("test")
133
131
  else
134
132
  parse_options! @argv
135
133
 
@@ -206,9 +206,13 @@ module Zeus
206
206
  end
207
207
 
208
208
  def test(argv=ARGV)
209
- if spec_file?(argv) && defined?(RSpec)
209
+ # if there are two test frameworks and one of them is RSpec,
210
+ # then "zeus test/rspec/testrb" without arguments runs the
211
+ # RSpec suite by default.
212
+ if (argv.empty? || spec_file?(argv)) && defined?(RSpec)
210
213
  # disable autorun in case the user left it in spec_helper.rb
211
214
  RSpec::Core::Runner.disable_autorun!
215
+ argv = ["spec"] if argv.empty?
212
216
  exit RSpec::Core::Runner.run(argv)
213
217
  else
214
218
  Zeus::M.run(argv)
@@ -1,3 +1,3 @@
1
1
  module Zeus
2
- VERSION = "0.15.3"
2
+ VERSION = "0.15.4"
3
3
  end
@@ -6,24 +6,18 @@ module MiniTest
6
6
  end
7
7
 
8
8
  def stub_mini_test_methods
9
- MiniTest::Unit::TestCase.stub!(:test_suites).and_return [fake_suite]
10
- MiniTest::Unit.stub!(:runner).and_return fake_runner
9
+ allow(MiniTest::Unit::TestCase).to receive(:test_suites).and_return([fake_suite])
10
+ allow(MiniTest::Unit).to receive(:runner).and_return(fake_runner)
11
11
  end
12
12
 
13
13
  def fake_runner
14
- @runner ||= stub("Runner", :run => 0)
14
+ @runner ||= double("Runner", :run => 0)
15
15
  end
16
16
 
17
17
  def fake_suite
18
- @suite ||= stub("TestSuite",
19
- :test_methods => [fake_test_method],
20
- :instance_method => fake_instance_method)
21
- end
22
-
23
- def fake_suite_with_special_characters
24
- @suite ||= stub("TestSuite",
25
- :test_methods => [fake_special_characters_test_method],
26
- :instance_method => fake_instance_method(fake_special_characters_test_method))
18
+ @suite ||= double("TestSuite",
19
+ :test_methods => [test_method],
20
+ :instance_method => fake_instance_method(test_method))
27
21
  end
28
22
 
29
23
  def fake_test_method
@@ -35,7 +29,7 @@ def fake_special_characters_test_method
35
29
  end
36
30
 
37
31
  def fake_instance_method(name=fake_test_method)
38
- @instance_method ||= stub("InstanceMethod",
32
+ @instance_method ||= double("InstanceMethod",
39
33
  :source_location => ["path/to/file.rb", 2],
40
34
  :source => "def #{name} \n assert true \n end")
41
35
  end
@@ -3,106 +3,102 @@ require 'fake_mini_test'
3
3
 
4
4
  module Zeus::M
5
5
  describe Runner do
6
+ let(:test_method) { fake_test_method }
7
+
8
+ before(:each) do
9
+ stub_mini_test_methods
10
+ end
6
11
 
7
12
  context "given a test with a question mark" do
8
- before do
9
- MiniTest::Unit::TestCase.stub!(:test_suites).and_return [fake_suite_with_special_characters]
10
- MiniTest::Unit.stub!(:runner).and_return fake_runner
11
- end
13
+ let(:test_method) { fake_special_characters_test_method }
12
14
 
13
15
  it "escapes the question mark when using line number" do
14
16
  argv = ["path/to/file.rb:2"]
15
17
 
16
- fake_runner.should_receive(:run).with(["-n", "/(test_my_test_method\\?)/"])
18
+ expect(fake_runner).to receive(:run).with(["-n", "/(test_my_test_method\\?)/"])
17
19
 
18
- lambda { Runner.new(argv).run }.should exit_with_code(0)
20
+ expect(lambda { Runner.new(argv).run }).to exit_with_code(0)
19
21
  end
20
22
 
21
23
  it "does not escape regex on explicit names" do
22
24
  argv = ["path/to/file.rb", "--name", fake_special_characters_test_method]
23
25
 
24
- fake_runner.should_receive(:run).with(["-n", "test_my_test_method?"])
26
+ allow(fake_runner).to receive(:run).with(["-n", "test_my_test_method?"])
25
27
 
26
- lambda { Runner.new(argv).run }.should exit_with_code(0)
28
+ expect(lambda { Runner.new(argv).run }).to exit_with_code(0)
27
29
  end
28
30
  end
29
- end
30
-
31
- describe Runner do
32
- before do
33
- stub_mini_test_methods
34
- end
35
31
 
36
- context "no option is given" do
37
- it "runs the test without giving any option" do
32
+ context "given no option" do
33
+ it "runs the test" do
38
34
  argv = ["path/to/file.rb"]
39
35
 
40
- fake_runner.should_receive(:run).with([])
36
+ allow(fake_runner).to receive(:run).with([])
41
37
 
42
- lambda { Runner.new(argv).run }.should exit_with_code(0)
38
+ expect(lambda { Runner.new(argv).run }).to exit_with_code(0)
43
39
  end
44
40
  end
45
41
 
46
42
  context "given a line number" do
47
- it "aborts if no test is found" do
43
+ it "aborts if no test is found on that line number" do
48
44
  argv = ["path/to/file.rb:100"]
49
45
 
50
- STDERR.should_receive(:write).with(/No tests found on line 100/)
51
- fake_runner.should_not_receive :run
46
+ expect(STDERR).to receive(:write).with(/No tests found on line 100/)
47
+ expect(fake_runner).to_not receive :run
52
48
 
53
- lambda { Runner.new(argv).run }.should_not exit_with_code(0)
49
+ expect(lambda { Runner.new(argv).run }).to_not exit_with_code(0)
54
50
  end
55
51
 
56
52
  it "runs the test if the correct line number is given" do
57
53
  argv = ["path/to/file.rb:2"]
58
54
 
59
- fake_runner.should_receive(:run).with(["-n", "/(#{fake_test_method})/"])
55
+ expect(fake_runner).to receive(:run).with(["-n", "/(#{fake_test_method})/"])
60
56
 
61
- lambda { Runner.new(argv).run }.should exit_with_code(0)
57
+ expect(lambda { Runner.new(argv).run }).to exit_with_code(0)
62
58
  end
63
59
  end
64
60
 
65
- context "specifying test name" do
61
+ context "given a specific test name" do
66
62
  it "runs the specified tests when using a pattern in --name option" do
67
63
  argv = ["path/to/file.rb", "--name", "/#{fake_test_method}/"]
68
64
 
69
- fake_runner.should_receive(:run).with(["-n", "/#{fake_test_method}/"])
65
+ expect(fake_runner).to receive(:run).with(["-n", "/#{fake_test_method}/"])
70
66
 
71
- lambda { Runner.new(argv).run }.should exit_with_code(0)
67
+ expect(lambda { Runner.new(argv).run }).to exit_with_code(0)
72
68
  end
73
69
 
74
70
  it "runs the specified tests when using a pattern in -n option" do
75
71
  argv = ["path/to/file.rb", "-n", "/method/"]
76
72
 
77
- fake_runner.should_receive(:run).with(["-n", "/method/"])
73
+ expect(fake_runner).to receive(:run).with(["-n", "/method/"])
78
74
 
79
- lambda { Runner.new(argv).run }.should exit_with_code(0)
75
+ expect(lambda { Runner.new(argv).run }).to exit_with_code(0)
80
76
  end
81
77
 
82
78
  it "aborts if no test matches the given pattern" do
83
79
  argv = ["path/to/file.rb", "-n", "/garbage/"]
84
80
 
85
- STDERR.should_receive(:write).with(%r{No test name matches \'/garbage/\'})
86
- fake_runner.should_not_receive :run
81
+ expect(STDERR).to receive(:write).with(%r{No test name matches \'/garbage/\'})
82
+ expect(fake_runner).to_not receive :run
87
83
 
88
- lambda { Runner.new(argv).run }.should_not exit_with_code(0)
84
+ expect(lambda { Runner.new(argv).run }).to_not exit_with_code(0)
89
85
  end
90
86
 
91
87
  it "runs the specified tests when using a name (no pattern)" do
92
88
  argv = ["path/to/file.rb", "-n", "#{fake_test_method}"]
93
89
 
94
- fake_runner.should_receive(:run).with(["-n", fake_test_method])
90
+ expect(fake_runner).to receive(:run).with(["-n", fake_test_method])
95
91
 
96
- lambda { Runner.new(argv).run }.should exit_with_code(0)
92
+ expect(lambda { Runner.new(argv).run }).to exit_with_code(0)
97
93
  end
98
94
 
99
95
  it "aborts if no test matches the given test name" do
100
96
  argv = ["path/to/file.rb", "-n", "method"]
101
97
 
102
- STDERR.should_receive(:write).with(%r{No test name matches \'method\'})
103
- fake_runner.should_not_receive :run
98
+ expect(STDERR).to receive(:write).with(%r{No test name matches \'method\'})
99
+ expect(fake_runner).to_not receive :run
104
100
 
105
- lambda { Runner.new(argv).run }.should_not exit_with_code(0)
101
+ expect(lambda { Runner.new(argv).run }).to_not exit_with_code(0)
106
102
  end
107
103
  end
108
104
  end
@@ -4,69 +4,84 @@ module Zeus
4
4
  describe Rails do
5
5
  subject(:rails) { Rails.new }
6
6
 
7
- context "#test_helper" do
7
+ describe "#test_helper" do
8
8
  before(:each) do
9
- rails.should_receive(:require).with("minitest/unit")
9
+ # Zeus::Rails#test_helper will require minitest/unit by default.
10
+ # We need to catch it first, before setting expectations on
11
+ # helper_file requires below.
12
+ expect(rails).to receive(:require).with("minitest/unit")
10
13
  end
11
14
 
12
- it "when ENV['RAILS_TEST_HELPER'] is set helper is loaded from variable" do
13
- ENV['RAILS_TEST_HELPER'] = "a_test_helper"
14
- rails.should_receive(:require).with("a_test_helper")
15
+ context "when ENV['RAILS_TEST_HELPER'] is set" do
16
+ it "loads the test helper file from the environment variable" do
17
+ helper = "a_test_helper"
18
+ allow(ENV).to receive(:[]).with("RAILS_TEST_HELPER").and_return(helper)
15
19
 
16
- rails.test_helper
17
- ENV.clear
20
+ expect(rails).to receive(:require).with(helper)
21
+ rails.test_helper
22
+ end
18
23
  end
19
24
 
20
- it "requires rails_helper when using rspec 3.0+" do
21
- mock_file_existence(ROOT_PATH + "/spec/rails_helper.rb", true)
25
+ context "when using rspec" do
26
+ context "3.0+" do
27
+ it "requires rails_helper" do
28
+ mock_file_existence(ROOT_PATH + "/spec/rails_helper.rb", true)
22
29
 
23
- rails.should_receive(:require).with("rails_helper")
30
+ expect(rails).to receive(:require).with("rails_helper")
24
31
 
25
- rails.test_helper
26
- end
32
+ rails.test_helper
33
+ end
34
+ end
27
35
 
28
- it "when spec_helper exists spec_helper is required" do
29
- mock_file_existence(ROOT_PATH + "/spec/rails_helper.rb", false)
30
- mock_file_existence(ROOT_PATH + "/spec/spec_helper.rb", true)
36
+ it "requires spec_helper" do
37
+ mock_file_existence(ROOT_PATH + "/spec/rails_helper.rb", false)
38
+ mock_file_existence(ROOT_PATH + "/spec/spec_helper.rb", true)
31
39
 
32
- rails.should_receive(:require).with("spec_helper")
40
+ expect(rails).to receive(:require).with("spec_helper")
33
41
 
34
- rails.test_helper
42
+ rails.test_helper
43
+ end
35
44
  end
36
45
 
37
- it "when minitest_helper exists minitest_helper is required" do
38
- mock_file_existence(ROOT_PATH + "/spec/rails_helper.rb", false)
39
- mock_file_existence(ROOT_PATH + "/spec/spec_helper.rb", false)
40
- mock_file_existence(ROOT_PATH + "/test/minitest_helper.rb", true)
46
+ context "when using minitest" do
47
+ it "requires minitest_helper" do
48
+ mock_file_existence(ROOT_PATH + "/spec/rails_helper.rb", false)
49
+ mock_file_existence(ROOT_PATH + "/spec/spec_helper.rb", false)
50
+ mock_file_existence(ROOT_PATH + "/test/minitest_helper.rb", true)
41
51
 
42
- rails.should_receive(:require).with("minitest_helper")
52
+ expect(rails).to receive(:require).with("minitest_helper")
43
53
 
44
- rails.test_helper
54
+ rails.test_helper
55
+ end
45
56
  end
46
57
 
47
- it "when there is no rspec helpers or minitest_helper, test_helper is required" do
48
- mock_file_existence(ROOT_PATH + "/spec/rails_helper.rb", false)
49
- mock_file_existence(ROOT_PATH + "/spec/spec_helper.rb", false)
50
- mock_file_existence(ROOT_PATH + "/test/minitest_helper.rb", false)
58
+ context "when there are no rspec or minitest helpers" do
59
+ it "requires test_helper" do
60
+ mock_file_existence(ROOT_PATH + "/spec/rails_helper.rb", false)
61
+ mock_file_existence(ROOT_PATH + "/spec/spec_helper.rb", false)
62
+ mock_file_existence(ROOT_PATH + "/test/minitest_helper.rb", false)
51
63
 
52
- rails.should_receive(:require).with("test_helper")
64
+ expect(rails).to receive(:require).with("test_helper")
53
65
 
54
- rails.test_helper
66
+ rails.test_helper
67
+ end
55
68
  end
56
69
  end
57
70
 
58
- context "#gem_is_bundled?" do
59
- it "returns gem version from Gemfile.lock" do
60
- File.stub(:read).and_return("
61
- GEM
62
- remote: https://rubygems.org/
63
- specs:
64
- exception_notification-rake (0.0.6)
65
- exception_notification (~> 3.0.1)
66
- rake (>= 0.9.0)
67
- rake (10.0.4)
68
- ")
69
- gem_is_bundled?('rake').should == '10.0.4'
71
+ describe "#gem_is_bundled?" do
72
+ context "for a bundled gem" do
73
+ it "returns the bundled gem's version" do
74
+ allow(File).to receive(:read).and_return("
75
+ GEM
76
+ remote: https://rubygems.org/
77
+ specs:
78
+ exception_notification-rake (0.0.6)
79
+ exception_notification (~> 3.0.1)
80
+ rake (>= 0.9.0)
81
+ rake (10.0.4)
82
+ ")
83
+ expect(gem_is_bundled?('rake')).to eq '10.0.4'
84
+ end
70
85
  end
71
86
  end
72
87
  end
@@ -10,11 +10,11 @@ RSpec::Matchers.define :exit_with_code do |exp_code|
10
10
  end
11
11
  actual and actual == exp_code
12
12
  end
13
- failure_message_for_should do |block|
13
+ failure_message do |block|
14
14
  "expected block to call exit(#{exp_code}) but exit" +
15
15
  (actual.nil? ? " not called" : "(#{actual}) was called")
16
16
  end
17
- failure_message_for_should_not do |block|
17
+ failure_message_when_negated do |block|
18
18
  "expected block not to call exit(#{exp_code})"
19
19
  end
20
20
  description do
@@ -23,12 +23,12 @@ RSpec::Matchers.define :exit_with_code do |exp_code|
23
23
  end
24
24
 
25
25
  def stub_system_methods
26
- Dir.stub!(:glob).and_return(["path/to/file.rb"])
27
- Kernel.stub!(:load).and_return
26
+ allow(Dir).to receive(:glob).and_return(["path/to/file.rb"])
27
+ allow(Kernel).to receive(:load)
28
28
  end
29
29
 
30
30
  def mock_file_existence(file, result)
31
- File.should_receive(:exists?).with(file).and_return(result)
31
+ expect(File).to receive(:exists?).with(file).and_return(result)
32
32
  end
33
33
 
34
34
  RSpec.configure do |config|
@@ -27,9 +27,7 @@ Gem::Specification.new do |gem|
27
27
  gem.version = version
28
28
  gem.license = "MIT"
29
29
 
30
- gem.add_development_dependency "rspec", '~> 2.12.0'
31
- gem.add_development_dependency "rake"
32
- gem.add_development_dependency "ronn", '>= 0.7.0'
33
-
34
30
  gem.add_runtime_dependency "method_source", ">= 0.6.7"
31
+
32
+ gem.add_development_dependency "bundler", '~> 1.6'
35
33
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zeus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.3
4
+ version: 0.15.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,72 +9,40 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-11-10 00:00:00.000000000 Z
12
+ date: 2015-01-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: rspec
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ~>
20
- - !ruby/object:Gem::Version
21
- version: 2.12.0
22
- type: :development
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ~>
28
- - !ruby/object:Gem::Version
29
- version: 2.12.0
30
- - !ruby/object:Gem::Dependency
31
- name: rake
15
+ name: method_source
32
16
  requirement: !ruby/object:Gem::Requirement
33
17
  none: false
34
18
  requirements:
35
19
  - - ! '>='
36
20
  - !ruby/object:Gem::Version
37
- version: '0'
38
- type: :development
21
+ version: 0.6.7
22
+ type: :runtime
39
23
  prerelease: false
40
24
  version_requirements: !ruby/object:Gem::Requirement
41
25
  none: false
42
26
  requirements:
43
27
  - - ! '>='
44
28
  - !ruby/object:Gem::Version
45
- version: '0'
29
+ version: 0.6.7
46
30
  - !ruby/object:Gem::Dependency
47
- name: ronn
31
+ name: bundler
48
32
  requirement: !ruby/object:Gem::Requirement
49
33
  none: false
50
34
  requirements:
51
- - - ! '>='
35
+ - - ~>
52
36
  - !ruby/object:Gem::Version
53
- version: 0.7.0
37
+ version: '1.6'
54
38
  type: :development
55
39
  prerelease: false
56
40
  version_requirements: !ruby/object:Gem::Requirement
57
41
  none: false
58
42
  requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: 0.7.0
62
- - !ruby/object:Gem::Dependency
63
- name: method_source
64
- requirement: !ruby/object:Gem::Requirement
65
- none: false
66
- requirements:
67
- - - ! '>='
68
- - !ruby/object:Gem::Version
69
- version: 0.6.7
70
- type: :runtime
71
- prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ! '>='
43
+ - - ~>
76
44
  - !ruby/object:Gem::Version
77
- version: 0.6.7
45
+ version: '1.6'
78
46
  description: Boot any rails app in under a second
79
47
  email:
80
48
  - burke@libbey.me
@@ -134,7 +102,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
134
102
  version: '0'
135
103
  segments:
136
104
  - 0
137
- hash: 3094523066757945393
105
+ hash: -3287208852062006683
138
106
  required_rubygems_version: !ruby/object:Gem::Requirement
139
107
  none: false
140
108
  requirements:
@@ -143,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
143
111
  version: '0'
144
112
  segments:
145
113
  - 0
146
- hash: 3094523066757945393
114
+ hash: -3287208852062006683
147
115
  requirements: []
148
116
  rubyforge_project:
149
117
  rubygems_version: 1.8.23