Skip to content

Commit

Permalink
removed Markdown tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lslezak committed Dec 13, 2014
1 parent c323f9e commit f7fb169
Show file tree
Hide file tree
Showing 8 changed files with 236 additions and 1,122 deletions.
24 changes: 0 additions & 24 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,32 +13,8 @@ end
require "cucumber/rake/task"
Cucumber::Rake::Task.new(:features)

require "redcarpet"
require_relative "spec/rspec_renderer"

def render_markdown(renderer, task)
puts "Rendering file: #{task.name}"
markdown = Redcarpet::Markdown.new(renderer, fenced_code_blocks: true)

string = markdown.render(File.read(task.prerequisites[0]))
File.write(task.name, string)
end

renderer = "spec/rspec_renderer.rb"

file "spec/builtins_spec.rb" => ["spec/builtins_spec.md", renderer] do |t|
render_markdown(RSpecRenderer.new("RuboCop::Cop::Yast::Builtins"), t)
end

file "spec/builtins_spec.html" => ["spec/builtins_spec.md", renderer] do |t|
render_markdown(Redcarpet::Render::HTML, t)
end
desc "Render the specification to HTML locally"
task html: ["spec/builtins_spec.html"]

require "rspec/core/rake_task"
RSpec::Core::RakeTask.new(:spec)
task spec: ["spec/builtins_spec.rb"]

require "rubocop/rake_task"
RuboCop::RakeTask.new(:rubocop)
Expand Down
41 changes: 21 additions & 20 deletions features/builtins_env.feature
Original file line number Diff line number Diff line change
@@ -1,35 +1,36 @@
Feature: Builtins.getenv()

Scenario: With string literal parameter is translated to ENV equivalent
Given the original code is
"""
Builtins.getenv("foo")
"""
"""
Builtins.getenv("foo")
"""
When I correct it using RuboCop::Cop::Yast::Builtins cop
Then the code should be converted to
"""
ENV["foo"]
"""
"""
ENV["foo"]
"""

Scenario: Variable as parameter is preserved
Given the original code is
"""
foo = bar
Builtins.getenv(foo)
"""
"""
foo = bar
Builtins.getenv(foo)
"""
When I correct it using RuboCop::Cop::Yast::Builtins cop
Then the code should be converted to
"""
foo = bar
ENV[foo]
"""
"""
foo = bar
ENV[foo]
"""

Scenario: Any other statement is preserved
Given the original code is
"""
Builtins.getenv(Ops.add(foo, bar))
"""
"""
Builtins.getenv(Ops.add(foo, bar))
"""
When I correct it using RuboCop::Cop::Yast::Builtins cop
Then the code should be converted to
"""
ENV[Ops.add(foo, bar)]
"""
"""
ENV[Ops.add(foo, bar)]
"""
Loading

0 comments on commit f7fb169

Please sign in to comment.