approvals 0.0.16 → 0.0.17

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f03c9912d647a41bc6ccef8ce020201e000f125b
4
- data.tar.gz: 34f5917f013272df690db31f5edacc2929d8084f
3
+ metadata.gz: 6df7476eb9432577895df3170adc9653d7f7615f
4
+ data.tar.gz: 1ea30b6816e7282509c98524394ba9e76d787a27
5
5
  SHA512:
6
- metadata.gz: a3ef07f8ccc9ccb287d81db21fa2ca6627eb5989c086bfd4c1fa8d8ed35dd612a3ea0fb96845c36719ae3a8f728a3cc03d39c5290acd31aa72d5de2691d8a658
7
- data.tar.gz: d6396fcc5fd6692bdd3a802fe9e521fdf042c69a7549c239889815fba2db679c2d5bfe2c1b4cddd9cf6e07e17ac68b21ba428a1d0853f8ede62dec6948355941
6
+ metadata.gz: 2945a8151ca583748a19ea37448723a63fb0f9cb6eefc427cf2fa8a368b4d7372199231de86a7614e3e3746f9d9a1881b2f1e2bff23e6f2a1a16b55931446953
7
+ data.tar.gz: 478fbaf9846755cedb47216ccbec95f879faeee7ad1728b794992e9ae39b7653bfdb40dd0979f73c6c5a779dab63f1f4cedf91958f8bc4a20e7058ba16fe515a
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
20
20
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
21
21
  s.require_paths = ["lib"]
22
22
 
23
- s.add_development_dependency 'rspec', '~> 2.99.0.beta2'
23
+ s.add_development_dependency 'rspec', '~> 3.1'
24
24
  s.add_development_dependency 'json', '~> 1.8'
25
25
  s.add_dependency 'thor', '~> 0.18'
26
26
  s.add_dependency 'nokogiri', '~> 1.6'
@@ -12,11 +12,22 @@ module Approvals
12
12
  parts = [ ]
13
13
  metadata = example.metadata
14
14
 
15
- begin
16
- parts << metadata[ :description ]
17
- end while metadata = metadata[ :example_group ]
15
+ approvals_path = lambda do |metadata|
16
+ description = normalize metadata[:description]
17
+ example_group = if metadata.key?(:example_group)
18
+ metadata[:example_group]
19
+ else
20
+ metadata[:parent_example_group]
21
+ end
18
22
 
19
- parts.reverse.map { |p| normalize p }.join '/'
23
+ if example_group
24
+ [approvals_path[example_group], description].join('/')
25
+ else
26
+ description
27
+ end
28
+ end
29
+
30
+ approvals_path[example.metadata]
20
31
  end
21
32
  end
22
33
  end
@@ -1,3 +1,3 @@
1
1
  module Approvals
2
- VERSION = '0.0.16'
2
+ VERSION = '0.0.17'
3
3
  end
@@ -6,10 +6,11 @@ describe Approvals do
6
6
  let(:namer) { |example| Approvals::Namers::RSpecNamer.new(example) }
7
7
 
8
8
  it "fails" do
9
- Approvals::Dotfile.stub(:path => '/dev/null')
10
- lambda {
9
+ allow(Approvals::Dotfile).to receive(:path).and_return('/dev/null')
10
+
11
+ expect do
11
12
  Approvals.verify "this one doesn't exist", :namer => namer
12
- }.should raise_error Approvals::ApprovalError
13
+ end.to raise_error Approvals::ApprovalError
13
14
  end
14
15
 
15
16
  it "verifies a string" do
@@ -4,7 +4,7 @@ require 'approvals/configuration'
4
4
  describe Approvals::Configuration do
5
5
 
6
6
  it "defaults to 'fixtures/approvals/'" do
7
- Approvals.configuration.approvals_path.should eq('fixtures/approvals/')
7
+ expect(Approvals.configuration.approvals_path).to eq('fixtures/approvals/')
8
8
  end
9
9
 
10
10
  describe "when set" do
@@ -21,7 +21,7 @@ describe Approvals::Configuration do
21
21
  end
22
22
 
23
23
  it "overrides the output directory" do
24
- Approvals.configuration.approvals_path.should eq('output/dir/')
24
+ expect(Approvals.configuration.approvals_path).to eq('output/dir/')
25
25
  end
26
26
  end
27
27
 
@@ -5,18 +5,18 @@ describe Approvals::Dotfile do
5
5
  let(:dotfile) { '/tmp/.approvals' }
6
6
 
7
7
  before(:each) do
8
- Approvals::Dotfile.stub(:path => dotfile)
8
+ allow(Approvals::Dotfile).to receive(:path).and_return dotfile
9
9
  Approvals::Dotfile.reset
10
10
  end
11
11
 
12
12
  it "appends the text" do
13
13
  Approvals::Dotfile.append('text')
14
- File.readlines(dotfile).map(&:chomp).should eq(['text'])
14
+ expect(File.readlines(dotfile).map(&:chomp)).to eq ['text']
15
15
  end
16
16
 
17
17
  it "appends the text exactly once" do
18
18
  Approvals::Dotfile.append('text')
19
19
  Approvals::Dotfile.append('text')
20
- File.readlines(dotfile).map(&:chomp).should eq(['text'])
20
+ expect(File.readlines(dotfile).map(&:chomp)).to eq ['text']
21
21
  end
22
22
  end
@@ -5,13 +5,13 @@ describe Approvals::Executable do
5
5
 
6
6
  it "reflects the its value in inspect" do
7
7
  executable = Approvals::Executable.new('SELECT 1')
8
- executable.inspect.should eq 'SELECT 1'
8
+ expect(executable.inspect).to eq 'SELECT 1'
9
9
  end
10
10
 
11
11
  it "takes a block" do
12
12
  executable = Approvals::Executable.new('SELECT 1') do |command|
13
13
  "execute query: #{command}"
14
14
  end
15
- executable.on_failure.call('SELECT 1').should eq('execute query: SELECT 1')
15
+ expect(executable.on_failure.call('SELECT 1')).to eq 'execute query: SELECT 1'
16
16
  end
17
17
  end
@@ -67,13 +67,13 @@ shared_context 'verify examples' do
67
67
 
68
68
  specify "a failure diff" do
69
69
  ::RSpec.configuration.diff_on_approval_failure = true
70
- ::RSpec::Expectations.should_receive( :fail_with )
70
+ expect(::RSpec::Expectations).to receive(:fail_with)
71
71
  verify { 'no.' }
72
72
  ::RSpec.configuration.diff_on_approval_failure = false
73
73
  end
74
74
 
75
75
  specify "a failure diff", :diff_on_approval_failure => true do
76
- ::RSpec::Expectations.should_receive( :fail_with )
76
+ expect(::RSpec::Expectations).to receive(:fail_with)
77
77
  verify { 'no.' }
78
78
  end
79
79
  end
@@ -7,7 +7,7 @@ describe Approvals::Namers::DefaultNamer do
7
7
  subject { Approvals::Namers::DefaultNamer.new("a f!$^%&*(unky name") }
8
8
 
9
9
  it "normalizes the name" do
10
- subject.name.should eq("a_funky_name")
10
+ expect(subject.name).to eq 'a_funky_name'
11
11
  end
12
12
 
13
13
  context "when configured" do
@@ -24,12 +24,14 @@ describe Approvals::Namers::DefaultNamer do
24
24
  end
25
25
 
26
26
  it "uses the approvals output dir" do
27
- subject.output_dir.should eq('path/to/files/')
27
+ expect(subject.output_dir).to eq 'path/to/files/'
28
28
  end
29
29
  end
30
30
 
31
31
  it "must have a name" do
32
- lambda { Approvals::Namers::DefaultNamer.new(nil) }.should raise_error(ArgumentError)
32
+ expect do
33
+ Approvals::Namers::DefaultNamer.new nil
34
+ end.to raise_error ArgumentError
33
35
  end
34
36
 
35
37
  end
@@ -4,11 +4,11 @@ require 'approvals/rspec'
4
4
  describe Approvals::Namers::DirectoryNamer do
5
5
 
6
6
  it "uses non-$%^&*funky example description" do |example|
7
- Approvals::Namers::DirectoryNamer.new(example).name.should eq("approvals_namers_directorynamer/uses_non_funky_example_description")
7
+ expect(Approvals::Namers::DirectoryNamer.new(example).name).to eq 'approvals_namers_directorynamer/uses_non_funky_example_description'
8
8
  end
9
9
 
10
10
  it "has a decent default" do |example|
11
- Approvals::Namers::DirectoryNamer.new(example).output_dir.should eq('spec/fixtures/approvals/')
11
+ expect(Approvals::Namers::DirectoryNamer.new(example).output_dir).to eq 'spec/fixtures/approvals/'
12
12
  end
13
13
 
14
14
  context "when RSpec is configured" do
@@ -25,7 +25,7 @@ describe Approvals::Namers::DirectoryNamer do
25
25
  end
26
26
 
27
27
  it "uses the rspec config option" do |example|
28
- Approvals::Namers::DirectoryNamer.new(example).output_dir.should eq('spec/output/dir/')
28
+ expect(Approvals::Namers::DirectoryNamer.new(example).output_dir).to eq 'spec/output/dir/'
29
29
  end
30
30
  end
31
31
  end
@@ -3,11 +3,11 @@ require 'spec_helper'
3
3
  describe Approvals::Namers::RSpecNamer do
4
4
 
5
5
  it "uses non-$%^&*funky example description" do |example|
6
- Approvals::Namers::RSpecNamer.new(example).name.should eq("approvals_namers_rspecnamer_uses_non_funky_example_description")
6
+ expect(Approvals::Namers::RSpecNamer.new(example).name).to eq 'approvals_namers_rspecnamer_uses_non_funky_example_description'
7
7
  end
8
8
 
9
9
  it "has a decent default" do |example|
10
- Approvals::Namers::RSpecNamer.new(example).output_dir.should eq('spec/fixtures/approvals/')
10
+ expect(Approvals::Namers::RSpecNamer.new(example).output_dir).to eq 'spec/fixtures/approvals/'
11
11
  end
12
12
 
13
13
  context "when RSpec is configured" do
@@ -24,7 +24,7 @@ describe Approvals::Namers::RSpecNamer do
24
24
  end
25
25
 
26
26
  it "uses the rspec config option" do |example|
27
- Approvals::Namers::RSpecNamer.new(example).output_dir.should eq('spec/output/dir/')
27
+ expect(Approvals::Namers::RSpecNamer.new(example).output_dir).to eq 'spec/output/dir/'
28
28
  end
29
29
  end
30
30
  end
@@ -5,12 +5,12 @@ describe Approvals::Namers do
5
5
 
6
6
  it "uses the RSpecNamer" do |example|
7
7
  approval = Approvals::Approval.new("naming with rspec namer", :namer => Approvals::Namers::RSpecNamer.new(example))
8
- approval.name.should eq("approvals_namers_uses_the_rspecnamer")
8
+ expect(approval.name).to eq("approvals_namers_uses_the_rspecnamer")
9
9
  end
10
10
 
11
11
  it "uses the DefaultNamer" do
12
12
  approval = Approvals::Approval.new("naming with default namer", :name => "a name")
13
- approval.name.should eq("a_name")
13
+ expect(approval.name).to eq("a_name")
14
14
  end
15
15
 
16
16
  end
@@ -10,20 +10,20 @@ describe Approvals::Reporters::FirstWorkingReporter do
10
10
 
11
11
  it "when at least one reporter works it is working" do
12
12
  reporter = Approvals::Reporters::FirstWorkingReporter.new(no, yes)
13
- reporter.should be_working_in_this_environment
13
+ expect(reporter).to be_working_in_this_environment
14
14
  end
15
15
 
16
16
  it "when no reporters work it's not working" do
17
17
  reporter = Approvals::Reporters::FirstWorkingReporter.new(no, no)
18
- reporter.should_not be_working_in_this_environment
18
+ expect(reporter).not_to be_working_in_this_environment
19
19
  end
20
20
 
21
21
  it "calls the first working reporter" do
22
22
  working = Approvals::Reporters::FirstWorkingReporter.new(no, yes, yes_too)
23
23
 
24
- no.should_not_receive(:report)
25
- yes.should_receive(:report)
26
- yes_too.should_not_receive(:report)
24
+ expect(no).not_to receive(:report)
25
+ expect(yes).to receive(:report)
26
+ expect(yes_too).not_to receive(:report)
27
27
 
28
28
  working.report("r", "a")
29
29
  end
@@ -8,7 +8,7 @@ describe Approvals::Reporters::HtmlImageReporter do
8
8
 
9
9
  it "creates the template" do
10
10
  scrubber = Approvals::Scrubber.new(subject.html("spec/fixtures/one.png", "spec/fixtures/two.png"))
11
- scrubber.to_s.should eq('<html><head><title>Approval</title></head><body><center><table style="text-align: center;" border="1"><tr><td><img src="file://{{current_dir}}/spec/fixtures/one.png"></td><td><img src="file://{{current_dir}}/spec/fixtures/two.png"></td></tr><tr><td>received</td><td>approved</td></tr></table></center></body></html>')
11
+ expect(scrubber.to_s).to eq('<html><head><title>Approval</title></head><body><center><table style="text-align: center;" border="1"><tr><td><img src="file://{{current_dir}}/spec/fixtures/one.png"></td><td><img src="file://{{current_dir}}/spec/fixtures/two.png"></td></tr><tr><td>received</td><td>approved</td></tr></table></center></body></html>')
12
12
  end
13
13
 
14
14
  # verify "creates the appropriate command", :format => :html do
@@ -11,6 +11,6 @@ describe Approvals::Reporters::ImageMagickReporter do
11
11
  system(result)
12
12
  system(expected)
13
13
  end
14
- result.should eq(expected)
14
+ expect(result).to eq(expected)
15
15
  end
16
16
  end
@@ -2,25 +2,23 @@ require 'spec_helper'
2
2
  require 'approvals/reporters/launcher'
3
3
 
4
4
  describe Approvals::Reporters::Launcher do
5
-
6
-
7
5
  it "has a vimdiff launcher" do
8
- Approvals::Reporters::Launcher.vimdiff.call('one', 'two').should eq("vimdiff one two")
6
+ expect(described_class.vimdiff.call('one', 'two')).to eq("vimdiff one two")
9
7
  end
10
8
 
11
9
  it "has an opendiff launcher" do
12
- Approvals::Reporters::Launcher.opendiff.call('one', 'two').should eq("opendiff one two")
10
+ expect(described_class.opendiff.call('one', 'two')).to eq("opendiff one two")
13
11
  end
14
12
 
15
13
  it "has a diffmerge launcher" do
16
- Approvals::Reporters::Launcher.diffmerge.call('one', 'two').should match(/DiffMerge.*\"one\"\ \"two\"/)
14
+ expect(described_class.diffmerge.call('one', 'two')).to match(/DiffMerge.*\"one\"\ \"two\"/)
17
15
  end
18
16
 
19
17
  it "has a tortoisediff launcher" do
20
- Approvals::Reporters::Launcher.tortoisediff.call('one', 'two').should match(/TortoiseMerge.exe.*one.*two/)
18
+ expect(described_class.tortoisediff.call('one', 'two')).to match(/TortoiseMerge.exe.*one.*two/)
21
19
  end
22
20
 
23
21
  it "has a filelauncher launcher" do
24
- Approvals::Reporters::Launcher.filelauncher.call('one', 'two').should eq("open one")
22
+ expect(described_class.filelauncher.call('one', 'two')).to eq("open one")
25
23
  end
26
24
  end
@@ -4,7 +4,7 @@ require 'approvals/reporters'
4
4
  describe Approvals::Reporters::Reporter do
5
5
 
6
6
  it "is not approved by default" do
7
- Approvals::Reporters::Reporter.new.should_not be_approved_when_reported
7
+ expect(Approvals::Reporters::Reporter.new).not_to be_approved_when_reported
8
8
  end
9
9
 
10
10
  it "takes a launcher" do
@@ -12,10 +12,10 @@ describe Approvals::Reporters::Reporter do
12
12
  "echo \"mv #{received} #{approved}\""
13
13
  }
14
14
 
15
- Approvals::Reporters::Reporter.new(&move).launcher.call('received.txt', 'approved.txt').should eq("echo \"mv received.txt approved.txt\"")
15
+ expect(Approvals::Reporters::Reporter.new(&move).launcher.call('received.txt', 'approved.txt')).to eq("echo \"mv received.txt approved.txt\"")
16
16
  end
17
17
 
18
18
  it "defaults to the default OpenDiff launcher" do
19
- Approvals::Reporters::Reporter.new.launcher.should eq(Approvals::Reporters::Launcher.opendiff)
19
+ expect(Approvals::Reporters::Reporter.new.launcher).to eq(Approvals::Reporters::Launcher.opendiff)
20
20
  end
21
21
  end
@@ -8,19 +8,19 @@ describe Approvals::Scrubber do
8
8
  subject { Approvals::Scrubber.new("I am currently at #{path}") }
9
9
 
10
10
  it "has a sensible to_s" do
11
- subject.to_s.should eq("I am currently at {{current_dir}}")
11
+ expect(subject.to_s).to eq("I am currently at {{current_dir}}")
12
12
  end
13
13
 
14
14
  it "unscrubs" do
15
- subject.unscrub.should eq("I am currently at #{path}")
15
+ expect(subject.unscrub).to eq("I am currently at #{path}")
16
16
  end
17
17
 
18
18
  it "unscrubs any old string" do
19
- subject.unscrub("Hoy, where's {{current_dir}}?").should eq("Hoy, where's #{path}?")
19
+ expect(subject.unscrub("Hoy, where's {{current_dir}}?")).to eq("Hoy, where's #{path}?")
20
20
  end
21
21
  end
22
22
 
23
23
  it "overrides default hash" do
24
- Approvals::Scrubber.new("oh, my GAWD", {"deity" => "GAWD"}).to_s.should eq('oh, my {{deity}}')
24
+ expect(Approvals::Scrubber.new("oh, my GAWD", {"deity" => "GAWD"}).to_s).to eq('oh, my {{deity}}')
25
25
  end
26
26
  end
@@ -3,5 +3,5 @@ require 'approvals'
3
3
  # Configure RSpec
4
4
  RSpec.configure do |config|
5
5
  # Use color
6
- config.color_enabled = true
6
+ config.color = true
7
7
  end
@@ -4,10 +4,10 @@ require 'approvals/system_command'
4
4
  describe Approvals::SystemCommand, "#exists?" do
5
5
 
6
6
  it "does" do
7
- Approvals::SystemCommand.exists?("ls").should be_truthy
7
+ expect(Approvals::SystemCommand.exists?("ls")).to be_truthy
8
8
  end
9
9
 
10
10
  it "does not" do
11
- Approvals::SystemCommand.exists?("absolutelydoesnotexistonyoursystem").should be_falsey
11
+ expect(Approvals::SystemCommand.exists?("absolutelydoesnotexistonyoursystem")).to be_falsey
12
12
  end
13
13
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: approvals
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.16
4
+ version: 0.0.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katrina Owen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-20 00:00:00.000000000 Z
11
+ date: 2014-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.99.0.beta2
19
+ version: '3.1'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 2.99.0.beta2
26
+ version: '3.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: json
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -204,3 +204,4 @@ signing_key:
204
204
  specification_version: 4
205
205
  summary: Approval Tests for Ruby
206
206
  test_files: []
207
+ has_rdoc: