Skip to content

Commit

Permalink
Add test to ruby extern requirement
Browse files Browse the repository at this point in the history
Closes #134
  • Loading branch information
Rodrigo Siqueira committed Feb 5, 2016
1 parent 1c28f0a commit 7726745
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
13 changes: 13 additions & 0 deletions spec/language/abstract_container/extern_requirement_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
require_relative '../../spec_helper'

RSpec.describe Languages::ExternRequirement do

context "When not implemented" do
it "Get requirement" do
externAbstract = Languages::ExternRequirement.new
expect{externAbstract.get_requirement("nothing")}.to raise_error(
NotImplementedError)
end
end

end
59 changes: 59 additions & 0 deletions spec/language/ruby/extern_requirement_ruby_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
require_relative '../../spec_helper'

RSpec.describe Languages::Ruby::ExternRequirementRuby do

before :all do
@extern = Languages::Ruby::ExternRequirementRuby.new
end

context "Simple case of match" do
it "'Require', Normal case" do
result = @extern.get_requirement('require "xpto"')
expect(result.library).to eq('xpto')
end

it "'require_relative', Normal case" do
result = @extern.get_requirement('require_relative "xpto"')
expect(result.library).to eq('xpto')
end
end

context "Find requires with multiple spaces" do
it "A lot of space at the end (require)" do
result = @extern.get_requirement('require "xpto" ')
expect(result.library).to eq('xpto')
end

it "A lot of space at the end (require_relative)" do
result = @extern.get_requirement('require_relative "xpto" ')
expect(result.library).to eq('xpto')
end

it "A lot of space at the beginning (require)" do
result = @extern.get_requirement('require "xpto"')
expect(result.library).to eq('xpto')
end

it "A lot of space at the beginning (require_relative)" do
result = @extern.get_requirement('require_relative "xpto"')
expect(result.library).to eq('xpto')
end

it "A lot of space at the beginning and the end (require_relative)" do
result = @extern.get_requirement('require_relative "xpto" ')
expect(result.library).to eq('xpto')
end

it "A lot of space at the beginning and the end (require)" do
result = @extern.get_requirement('require "xpto" ')
expect(result.library).to eq('xpto')
end

end

after :all do
@extern = nil
end

end

0 comments on commit 7726745

Please sign in to comment.