mountain_berry_fields 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/Readme.md CHANGED
@@ -1,4 +1,4 @@
1
- ![travis CI status](https://secure.travis-ci.org/JoshCheek/mountain_berry_fields.png?branch=master)
1
+ [![Build Status](https://secure.travis-ci.org/JoshCheek/mountain_berry_fields.png?branch=master)](http://travis-ci.org/JoshCheek/mountain_berry_fields)
2
2
 
3
3
  # MountainBerryFields
4
4
 
@@ -0,0 +1,58 @@
1
+ # like Rake, I'm not making this a hard dependency of the lib
2
+ # but if you want to test against it, or substitute your own class
3
+ # in place of any of these, it makes sense to depend on Surrogate at least in your test env,
4
+ # in order to assert substitutability
5
+ require 'surrogate'
6
+
7
+ class MountainBerryFields
8
+ module Interface
9
+ class Evaluator
10
+ Surrogate.endow self do
11
+ define(:visible_commands) { [:visible] }
12
+ define(:invisible_commands) { [:invisible] }
13
+ end
14
+
15
+ define(:initialize) { @document = '' }
16
+ define(:tests_pass?) { true }
17
+ define(:test) { |test, &block| block.call }
18
+ define(:failure_message) { 'some failure message' }
19
+ define(:failure_name) { 'failing test name' }
20
+ define(:document)
21
+ end
22
+
23
+ class Parser
24
+ Surrogate.endow self
25
+ define(:initialize) {}
26
+ define(:parse) { 'some body' }
27
+ define(:parsed) { parse }
28
+ end
29
+
30
+ class File
31
+ Surrogate.endow self do
32
+ define(:exist?) { true }
33
+ define(:write) { true }
34
+ define(:read) { "file contents" }
35
+ end
36
+ end
37
+
38
+ class Dir
39
+ Surrogate.endow self do
40
+ define(:chdir) { |dir, &block| block.call }
41
+ define(:mktmpdir) { |prefix, &block| block.call }
42
+ end
43
+ end
44
+
45
+ class SyntaxChecker
46
+ Surrogate.endow self
47
+ define(:initialize) { |syntax| }
48
+ define(:valid?) { true }
49
+ define(:invalid_message) { "shit ain't valid" }
50
+ end
51
+
52
+ class Interaction
53
+ Surrogate.endow self
54
+ define(:declare_failure) { }
55
+ end
56
+ end
57
+ end
58
+
@@ -1,3 +1,3 @@
1
1
  class MountainBerryFields
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  end
@@ -18,8 +18,8 @@ Gem::Specification.new do |gem|
18
18
  gem.add_runtime_dependency 'erubis', '= 2.7.0'
19
19
  gem.add_runtime_dependency 'deject', '~> 0.2.2'
20
20
 
21
- gem.add_development_dependency 'mountain_berry_fields-magic_comments', '~> 1.0.0'
22
- gem.add_development_dependency 'mountain_berry_fields-rspec', '~> 1.0.0'
21
+ gem.add_development_dependency 'mountain_berry_fields-magic_comments', '~> 1.0.1'
22
+ gem.add_development_dependency 'mountain_berry_fields-rspec', '~> 1.0.2'
23
23
  gem.add_development_dependency 'surrogate', '~> 0.5.1'
24
24
  gem.add_development_dependency 'rspec', '~> 2.10.0'
25
25
  gem.add_development_dependency 'cucumber', '~> 1.2.0'
@@ -5,7 +5,7 @@ describe MountainBerryFields::CommandLineInteraction do
5
5
  let(:stderr) { interaction.stderr.string }
6
6
 
7
7
  it 'implements the interaction interface' do
8
- Mock::Interaction.should substitute_for MountainBerryFields::CommandLineInteraction, subset: true
8
+ MountainBerryFields::Interface::Interaction.should substitute_for MountainBerryFields::CommandLineInteraction, subset: true
9
9
  end
10
10
 
11
11
  specify '#declare_failure(message) writes messages to stderr, with newlines' do
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ describe MountainBerryFields::Interface::File do
4
+ it 'is substitutable for ::File' do
5
+ MountainBerryFields::Interface::File.should substitute_for ::File, subset: true
6
+ end
7
+ end
8
+
9
+ describe MountainBerryFields::Interface::Dir do
10
+ it 'is substitutable for ::Dir' do
11
+ MountainBerryFields::Interface::Dir.should substitute_for Dir, subset: true
12
+ end
13
+ end
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe MountainBerryFields::Evaluator do
4
4
  it 'implements the evaluator interface' do
5
- Mock::Evaluator.should substitute_for described_class, subset: true
5
+ MountainBerryFields::Interface::Evaluator.should substitute_for described_class, subset: true
6
6
  end
7
7
 
8
8
  let(:to_evaluate) { '' }
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe MountainBerryFields::Test::RubySyntaxChecker do
4
4
  it 'implements the SyntaxChecker interface' do
5
- Mock::SyntaxChecker.should substitute_for described_class
5
+ MountainBerryFields::Interface::SyntaxChecker.should substitute_for described_class
6
6
  end
7
7
 
8
8
  describe '#valid?' do
@@ -5,100 +5,19 @@ require 'mountain_berry_fields/command_line_interaction'
5
5
 
6
6
  require 'stringio'
7
7
  require 'surrogate/rspec'
8
+ require 'mountain_berry_fields/interface'
8
9
 
9
10
 
10
11
  RSpec::Matchers.define :pass do
11
12
  match { |matcher| matcher.pass? }
12
13
  end
13
14
 
14
- module Mock
15
- class SyntaxChecker
16
- Surrogate.endow self
17
- define(:initialize) { |syntax| }
18
- define(:valid?) { true }
19
- define(:invalid_message) { "shit ain't valid" }
20
- end
21
-
22
- class File
23
- Surrogate.endow self do
24
- define(:exist?) { true }
25
- define(:write) { true }
26
- define(:read) { "file contents" }
27
- end
28
- end
29
-
30
- class Dir
31
- Surrogate.endow self do
32
- define(:chdir) { |dir, &block| block.call }
33
- define(:mktmpdir) { |prefix, &block| block.call }
34
- end
35
- end
36
-
37
- module Process
38
- class Status
39
- Surrogate.endow self
40
- define(:success?) { true }
41
- end
42
- end
43
-
44
- class Open3
45
- Surrogate.endow self do
46
- define(:capture3) { |invocation| ["stdout", "stderr", @exitstatus||Process::Status.new] }
47
- end
48
-
49
-
50
- def self.exit_with_failure!
51
- @exitstatus = Process::Status.new.will_have_success? false
52
- self
53
- end
54
-
55
- def self.exit_with_success!
56
- @exitstatus = Process::Status.new.will_have_success? true
57
- self
58
- end
59
- end
60
-
61
- class Interaction
62
- Surrogate.endow self
63
- define(:declare_failure) { }
64
- end
65
-
66
- class Evaluator
67
- Surrogate.endow self do
68
- define(:visible_commands) { [:visible] }
69
- define(:invisible_commands) { [:invisible] }
70
- end
71
-
72
- define(:initialize) { @document = '' }
73
- define(:tests_pass?) { true }
74
- define(:test) { |test, &block| block.call }
75
- define(:failure_message) { 'some failure message' }
76
- define(:failure_name) { 'failing test name' }
77
- define(:document)
78
-
79
- def inspect
80
- '#<MOCK EVALUATOR>'
81
- end
82
- end
83
-
84
- class Parser
85
- Surrogate.endow self
86
- define(:initialize) {}
87
- define(:parse) { 'some body' }
88
- define(:parsed) { parse }
89
-
90
- def inspect
91
- '#<MOCK PARSER>'
92
- end
93
- end
94
- end
95
-
96
- MountainBerryFields.override(:file_class) { Mock::File.clone }
97
- MountainBerryFields.override(:dir_class) { Mock::Dir.clone }
98
- MountainBerryFields.override(:interaction) { Mock::Interaction.new }
99
- MountainBerryFields.override(:evaluator_class) { Mock::Evaluator.clone }
100
- MountainBerryFields.override(:parser_class) { Mock::Parser.clone }
15
+ MountainBerryFields.override(:file_class) { MountainBerryFields::Interface::File.clone }
16
+ MountainBerryFields.override(:dir_class) { MountainBerryFields::Interface::Dir.clone }
17
+ MountainBerryFields.override(:interaction) { MountainBerryFields::Interface::Interaction.new }
18
+ MountainBerryFields.override(:evaluator_class) { MountainBerryFields::Interface::Evaluator.clone }
19
+ MountainBerryFields.override(:parser_class) { MountainBerryFields::Interface::Parser.clone }
101
20
 
102
21
  MountainBerryFields::CommandLineInteraction.override(:stderr) { StringIO.new }
103
- MountainBerryFields::Test::RSpec.override(:syntax_checker_class) { Mock::SyntaxChecker }
104
- MountainBerryFields::Test::MagicComments.override(:syntax_checker_class) { Mock::SyntaxChecker }
22
+ MountainBerryFields::Test::RSpec.override(:syntax_checker_class) { MountainBerryFields::Interface::SyntaxChecker }
23
+ MountainBerryFields::Test::MagicComments.override(:syntax_checker_class) { MountainBerryFields::Interface::SyntaxChecker }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mountain_berry_fields
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-07 00:00:00.000000000 Z
12
+ date: 2012-07-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: erubis
16
- requirement: &70337161622420 !ruby/object:Gem::Requirement
16
+ requirement: &70108132823320 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - =
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 2.7.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70337161622420
24
+ version_requirements: *70108132823320
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: deject
27
- requirement: &70337161621920 !ruby/object:Gem::Requirement
27
+ requirement: &70108132822780 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,32 +32,32 @@ dependencies:
32
32
  version: 0.2.2
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70337161621920
35
+ version_requirements: *70108132822780
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: mountain_berry_fields-magic_comments
38
- requirement: &70337161621460 !ruby/object:Gem::Requirement
38
+ requirement: &70108132822300 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
42
42
  - !ruby/object:Gem::Version
43
- version: 1.0.0
43
+ version: 1.0.1
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70337161621460
46
+ version_requirements: *70108132822300
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: mountain_berry_fields-rspec
49
- requirement: &70337161621000 !ruby/object:Gem::Requirement
49
+ requirement: &70108132821760 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
53
53
  - !ruby/object:Gem::Version
54
- version: 1.0.0
54
+ version: 1.0.2
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70337161621000
57
+ version_requirements: *70108132821760
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: surrogate
60
- requirement: &70337161620540 !ruby/object:Gem::Requirement
60
+ requirement: &70108132820680 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 0.5.1
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70337161620540
68
+ version_requirements: *70108132820680
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
- requirement: &70337161620080 !ruby/object:Gem::Requirement
71
+ requirement: &70108132819780 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 2.10.0
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70337161620080
79
+ version_requirements: *70108132819780
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: cucumber
82
- requirement: &70337161619620 !ruby/object:Gem::Requirement
82
+ requirement: &70108132819180 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ~>
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: 1.2.0
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70337161619620
90
+ version_requirements: *70108132819180
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: simplecov
93
- requirement: &70337161619160 !ruby/object:Gem::Requirement
93
+ requirement: &70108132834880 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ~>
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: 0.6.4
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *70337161619160
101
+ version_requirements: *70108132834880
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: rake
104
- requirement: &70337161618780 !ruby/object:Gem::Requirement
104
+ requirement: &70108132834280 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,7 +109,7 @@ dependencies:
109
109
  version: '0'
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *70337161618780
112
+ version_requirements: *70108132834280
113
113
  description: Test code samples embedded in files like readmes
114
114
  email:
115
115
  - josh.cheek@gmail.com
@@ -136,6 +136,7 @@ files:
136
136
  - lib/mountain_berry_fields.rb
137
137
  - lib/mountain_berry_fields/command_line_interaction.rb
138
138
  - lib/mountain_berry_fields/evaluator.rb
139
+ - lib/mountain_berry_fields/interface.rb
139
140
  - lib/mountain_berry_fields/parser.rb
140
141
  - lib/mountain_berry_fields/rake_task.rb
141
142
  - lib/mountain_berry_fields/test.rb
@@ -145,8 +146,8 @@ files:
145
146
  - mountain_berry_fields.gemspec
146
147
  - readme_helper.rb
147
148
  - spec/command_line_interaction_spec.rb
149
+ - spec/core_lib_substitutability_spec.rb
148
150
  - spec/evaluator_spec.rb
149
- - spec/mock_substitutability_spec.rb
150
151
  - spec/mountain_berry_fields_spec.rb
151
152
  - spec/parser_spec.rb
152
153
  - spec/ruby_syntax_checker_spec.rb
@@ -175,7 +176,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
175
176
  version: '0'
176
177
  requirements: []
177
178
  rubyforge_project:
178
- rubygems_version: 1.8.17
179
+ rubygems_version: 1.8.11
179
180
  signing_key:
180
181
  specification_version: 3
181
182
  summary: Test code samples embedded in files like readmes
@@ -187,8 +188,8 @@ test_files:
187
188
  - features/step_definitions/steps.rb
188
189
  - features/support/env.rb
189
190
  - spec/command_line_interaction_spec.rb
191
+ - spec/core_lib_substitutability_spec.rb
190
192
  - spec/evaluator_spec.rb
191
- - spec/mock_substitutability_spec.rb
192
193
  - spec/mountain_berry_fields_spec.rb
193
194
  - spec/parser_spec.rb
194
195
  - spec/ruby_syntax_checker_spec.rb
@@ -197,3 +198,4 @@ test_files:
197
198
  - spec/test/always_pass_spec.rb
198
199
  - spec/test/strategy_spec.rb
199
200
  - spec/test/test_spec.rb
201
+ has_rdoc:
@@ -1,25 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Mock::File do
4
- it 'is substitutable for ::File' do
5
- Mock::File.should substitute_for ::File, subset: true
6
- end
7
- end
8
-
9
- describe Mock::Dir do
10
- it 'is substitutable for ::Dir' do
11
- Mock::Dir.should substitute_for Dir, subset: true
12
- end
13
- end
14
-
15
- describe Mock::Process::Status do
16
- it 'is substitutable for ::Process::Status' do
17
- Mock::Process::Status.should substitute_for ::Process::Status, subset: true
18
- end
19
- end
20
-
21
- describe Mock::Open3 do
22
- it 'is substitutable for ::Open3' do
23
- Mock::Open3.should substitute_for ::Open3, subset: true
24
- end
25
- end