diff --git a/.rspec b/.rspec new file mode 100644 index 0000000..5f16476 --- /dev/null +++ b/.rspec @@ -0,0 +1,2 @@ +--color +--format progress diff --git a/exec.rb b/exec.rb index 0e59aba..1f79b70 100644 --- a/exec.rb +++ b/exec.rb @@ -3,5 +3,5 @@ fizzbuzz = Fizzbuzz.new (1..100).each do |number| - puts fizzbuzz.calculate number + puts "#{number}: #{fizzbuzz.calculate(number)}" end diff --git a/lib/fizzbuzz.rb b/lib/fizzbuzz.rb index 4746a88..f9a304d 100644 --- a/lib/fizzbuzz.rb +++ b/lib/fizzbuzz.rb @@ -1,6 +1,8 @@ class Fizzbuzz def calculate number - if number % 3 == 0 && number % 5 == 0 + if number.to_s.include? '7' + 'GitHub' + elsif number % 3 == 0 && number % 5 == 0 'fizzbuzz' elsif number % 3 == 0 'fizz' diff --git a/spec/fizzbuzz_spec.rb b/spec/fizzbuzz_spec.rb index 93a63e6..84e32ac 100644 --- a/spec/fizzbuzz_spec.rb +++ b/spec/fizzbuzz_spec.rb @@ -20,4 +20,11 @@ it { subject.calculate(15).should eq 'fizzbuzz' } it { subject.calculate(30).should eq 'fizzbuzz' } end + + context 'GitHub number' do + it { subject.calculate(77).should eq 'GitHub' } + it { subject.calculate(17).should eq 'GitHub' } + it { subject.calculate(27).should eq 'GitHub' } + it { subject.calculate(75).should eq 'GitHub' } + end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..dbc4f1a --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,17 @@ +# This file was generated by the `rspec --init` command. Conventionally, all +# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. +# Require this file using `require "spec_helper"` to ensure that it is only +# loaded once. +# +# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration +RSpec.configure do |config| + config.treat_symbols_as_metadata_keys_with_true_values = true + config.run_all_when_everything_filtered = true + config.filter_run :focus + + # Run specs in random order to surface order dependencies. If you find an + # order dependency and want to debug it, you can fix the order by providing + # the seed, which is printed after each run. + # --seed 1234 + config.order = 'random' +end diff --git a/test.html b/test.html new file mode 100644 index 0000000..64787ac --- /dev/null +++ b/test.html @@ -0,0 +1 @@ +プルリクtest用html追加 \ No newline at end of file