spec/scaffolder/tool/validate_spec.rb in scaffolder-tools-0.1.2 vs spec/scaffolder/tool/validate_spec.rb in scaffolder-tools-0.1.3
- old
+ new
@@ -1,6 +1,6 @@
-require File.expand_path(File.join(File.dirname(__FILE__),'..','..','spec_helper'))
+require 'spec_helper'
describe Scaffolder::Tool::Validate do
it "should inherit from Scaffolder::Tool" do
described_class.superclass.should == Scaffolder::Tool
@@ -61,11 +61,11 @@
described_class.stubs(:sequence_errors).with(@valid).returns([])
described_class.stubs(:sequence_errors).with(@invalid).returns([nil])
end
subject do
- described_class.new(mock_command_line_settings)
+ described_class.new(MockSettings.new)
end
it "should return an empty array when scaffold is valid" do
subject.expects(:scaffold).returns([@valid,@valid])
subject.errors.should be_empty
@@ -85,11 +85,11 @@
end
describe "scaffold validation with no overlapping inserts" do
subject do
- validate = described_class.new(mock_command_line_settings)
+ validate = described_class.new(MockSettings.new)
validate.stubs(:errors).returns([])
validate
end
it "should not raise any errors" do
@@ -103,11 +103,11 @@
end
describe "returning errors using the errors method" do
subject do
- validate = described_class.new(mock_command_line_settings)
+ validate = described_class.new(MockSettings.new)
sequence = stub(:source => :seq1)
validate.stubs(:errors).returns([sequence])
described_class.stubs(:sequence_errors).with(sequence).returns(
[[stub(:open => 1,:close => 2, :source => 'some_insert')]])
@@ -131,10 +131,10 @@
end
describe "the attributes of the error data" do
subject do
- validate = described_class.new(mock_command_line_settings)
+ validate = described_class.new(MockSettings.new)
@err = {:open => 1,:close => 2,:source => 'some_insert'}
sequence = stub(:source => 'seq1')
validate.stubs(:errors).returns([sequence])
described_class.stubs(:sequence_errors).with(sequence).returns([[stub(@err)]])