Sha256: 2644dd1fe807eaa117bb8738b0a5ecdd9334cb581570e8ad6fbecd1613a035ba

Contents?: true

Size: 696 Bytes

Versions: 11

Compression:

Stored size: 696 Bytes

Contents

require "open3"

is_loop_method = false
workshop = "#{ENV['HOME']}/.ruby_learner/workshop"
filename = "#{workshop}/lib/workplace.rb"

RSpec.describe "loop-check" do
  it 'check loop-method, return boolean' do
    File.open(filename, "r") do |file|
      file.each_line do |line|
        is_loop_method = true if line.include?('loop')
      end
    end
    puts "ErrorMessage: you don't use loop-methods." if !is_loop_method
    expect( is_loop_method ).to eq(true)
  end

  it 'return names-items' do
    stdout, stderr, status = Open3.capture3("ruby #{filename}")
    expect { puts stdout }.to output("tanaka\nnakamura\nsasaki\nsuzuki\ntanaka\nnakamura\nsasaki\nsuzuki\n").to_stdout
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
ruby_learner-1.2.9 contents/questions/sequential_check/section_5/part_3/spec/workplace_spec.rb
ruby_learner-1.2.8 contents/questions/sequential_check/section_5/part_3/spec/workplace_spec.rb
ruby_learner-1.2.7 contents/questions/sequential_check/section_5/part_3/spec/workplace_spec.rb
ruby_learner-1.2.6 contents/questions/sequential_check/section_5/part_3/spec/workplace_spec.rb
ruby_learner-1.2.5 contents/questions/sequential_check/section_5/part_3/spec/workplace_spec.rb
ruby_learner-1.2.4 contents/questions/sequential_check/section_5/part_3/spec/workplace_spec.rb
ruby_learner-1.2.3 contents/questions/sequential_check/section_5/part_3/spec/workplace_spec.rb
ruby_learner-1.2.2 contents/questions/sequential_check/section_5/part_3/spec/workplace_spec.rb
ruby_learner-1.2.1 contents/questions/sequential_check/section_5/part_3/spec/workplace_spec.rb
ruby_learner-1.2.0 contents/questions/sequential_check/section_5/part_3/spec/workplace_spec.rb
ruby_learner-1.1.15 questions/sequential_check/section_5/part_3/spec/workplace_spec.rb