Sha256: 07b17342a3d7df637e0dc802b27331c2f160bc1139e5e32b9d214fb56f97c350

Contents?: true

Size: 696 Bytes

Versions: 11

Compression:

Stored size: 696 Bytes

Contents

require "open3"

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

RSpec.describe "each-check" do
  it 'check each-method, return boolean' do
    File.open(filename, "r") do |file|
      file.each_line do |line|
        is_each_method = true if line.include?('each')
      end
    end
    puts "ErrorMessage: you don't use each-methods." if !is_each_method
    expect( is_each_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_2/spec/workplace_spec.rb
ruby_learner-1.2.8 contents/questions/sequential_check/section_5/part_2/spec/workplace_spec.rb
ruby_learner-1.2.7 contents/questions/sequential_check/section_5/part_2/spec/workplace_spec.rb
ruby_learner-1.2.6 contents/questions/sequential_check/section_5/part_2/spec/workplace_spec.rb
ruby_learner-1.2.5 contents/questions/sequential_check/section_5/part_2/spec/workplace_spec.rb
ruby_learner-1.2.4 contents/questions/sequential_check/section_5/part_2/spec/workplace_spec.rb
ruby_learner-1.2.3 contents/questions/sequential_check/section_5/part_2/spec/workplace_spec.rb
ruby_learner-1.2.2 contents/questions/sequential_check/section_5/part_2/spec/workplace_spec.rb
ruby_learner-1.2.1 contents/questions/sequential_check/section_5/part_2/spec/workplace_spec.rb
ruby_learner-1.2.0 contents/questions/sequential_check/section_5/part_2/spec/workplace_spec.rb
ruby_learner-1.1.15 questions/sequential_check/section_5/part_2/spec/workplace_spec.rb