Skip to content
This repository was archived by the owner on Sep 27, 2018. It is now read-only.

Commit fd95af0

Browse files
committed
fix specs
1 parent 9d85dcb commit fd95af0

9 files changed

Lines changed: 319 additions & 16 deletions

File tree

.rspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--color

codeship.gemspec

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ Gem::Specification.new do |spec|
2020

2121
spec.add_dependency "json"
2222

23-
spec.add_development_dependency "bundler", "~> 1.3"
23+
spec.add_development_dependency "bundler"
2424
spec.add_development_dependency "rake"
25-
spec.add_development_dependency "rspec", "~> 2.9"
26-
spec.add_development_dependency "vcr", "~> 2.5"
25+
spec.add_development_dependency "rspec"
26+
spec.add_development_dependency "vcr"
2727
spec.add_development_dependency "webmock"
28+
spec.add_development_dependency "pry"
2829
end

lib/codeship/status.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class Status
88
STATES = [:branchnotfound, :error, :ignored, :projectnotfound,
99
:success, :testing, :waiting, :stopped, :infrastructure_failure]
1010

11-
def initialize uuid, options = {}
11+
def initialize(uuid, options = {})
1212
@uuid = uuid
1313
@branch = options.delete(:branch)
1414
end
@@ -24,7 +24,7 @@ def image
2424
end
2525

2626
def head
27-
@head ||= http_request.head project_url
27+
@head ||= http_request.head(project_url)
2828
end
2929

3030
def project_url

spec/fixtures/cassettes/Codeship_Status/parsing_the_project_status/should_parse_infrastructure_failure.yml

Lines changed: 54 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spec/fixtures/cassettes/Codeship_Status/parsing_the_project_status/should_parse_stopped.yml

Lines changed: 54 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spec/fixtures/cassettes/Codeship_Status/parsing_the_project_status_on_a_certain_branch/should_parse_infrastructure_failure.yml

Lines changed: 54 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spec/fixtures/cassettes/Codeship_Status/parsing_the_project_status_on_a_certain_branch/should_parse_stopped.yml

Lines changed: 54 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spec/spec_helper.rb

Lines changed: 91 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,99 @@
11
require 'codeship'
22
require 'vcr'
33

4+
# This file was generated by the `rspec --init` command. Conventionally, all
5+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
6+
# The generated `.rspec` file contains `--require spec_helper` which will cause
7+
# this file to always be loaded, without a need to explicitly require it in any
8+
# files.
9+
#
10+
# Given that it is always loaded, you are encouraged to keep this file as
11+
# light-weight as possible. Requiring heavyweight dependencies from this file
12+
# will add to the boot time of your test suite on EVERY test run, even for an
13+
# individual file that may not need all of that loaded. Instead, consider making
14+
# a separate helper file that requires the additional dependencies and performs
15+
# the additional setup, and require it from the spec files that actually need
16+
# it.
17+
#
18+
# The `.rspec` file also contains a few flags that are not defaults but that
19+
# users commonly want.
20+
#
21+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
22+
RSpec.configure do |config|
23+
# rspec-expectations config goes here. You can use an alternate
24+
# assertion/expectation library such as wrong or the stdlib/minitest
25+
# assertions if you prefer.
26+
config.expect_with :rspec do |expectations|
27+
# This option will default to `true` in RSpec 4. It makes the `description`
28+
# and `failure_message` of custom matchers include text for helper methods
29+
# defined using `chain`, e.g.:
30+
# be_bigger_than(2).and_smaller_than(4).description
31+
# # => "be bigger than 2 and smaller than 4"
32+
# ...rather than:
33+
# # => "be bigger than 2"
34+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
35+
end
36+
37+
# rspec-mocks config goes here. You can use an alternate test double
38+
# library (such as bogus or mocha) by changing the `mock_with` option here.
39+
config.mock_with :rspec do |mocks|
40+
# Prevents you from mocking or stubbing a method that does not exist on
41+
# a real object. This is generally recommended, and will default to
42+
# `true` in RSpec 4.
43+
mocks.verify_partial_doubles = true
44+
end
45+
46+
# The settings below are suggested to provide a good initial experience
47+
# with RSpec, but feel free to customize to your heart's content.
48+
49+
# These two settings work together to allow you to limit a spec run
50+
# to individual examples or groups you care about by tagging them with
51+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
52+
# get run.
53+
config.filter_run :focus
54+
config.run_all_when_everything_filtered = true
55+
56+
# Limits the available syntax to the non-monkey patched syntax that is
57+
# recommended. For more details, see:
58+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
59+
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
60+
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
61+
config.disable_monkey_patching!
62+
63+
# This setting enables warnings. It's recommended, but in some cases may
64+
# be too noisy due to issues in dependencies.
65+
config.warnings = true
66+
67+
# Many RSpec users commonly either run the entire suite or an individual
68+
# file, and it's useful to allow more verbose output when running an
69+
# individual spec file.
70+
if config.files_to_run.one?
71+
# Use the documentation formatter for detailed output,
72+
# unless a formatter has already been configured
73+
# (e.g. via a command-line flag).
74+
config.default_formatter = 'doc'
75+
end
76+
77+
# Print the 10 slowest examples and example groups at the
78+
# end of the spec run, to help surface which specs are running
79+
# particularly slow.
80+
config.profile_examples = 10
81+
82+
# Run specs in random order to surface order dependencies. If you find an
83+
# order dependency and want to debug it, you can fix the order by providing
84+
# the seed, which is printed after each run.
85+
# --seed 1234
86+
config.order = :random
87+
88+
# Seed global randomization in this process using the `--seed` CLI option.
89+
# Setting this allows you to use `--seed` to deterministically reproduce
90+
# test failures related to randomization by passing the same `--seed` value
91+
# as the one that triggered the failure.
92+
Kernel.srand config.seed
93+
end
94+
495
VCR.configure do |c|
596
c.cassette_library_dir = 'spec/fixtures/cassettes'
697
c.hook_into :webmock
798
c.configure_rspec_metadata!
899
end
9-
10-
RSpec.configure do |c|
11-
# so we can use :vcr rather than :vcr => true;
12-
# in RSpec 3 this will no longer be necessary.
13-
c.treat_symbols_as_metadata_keys_with_true_values = true
14-
end

spec/status_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
require 'spec_helper'
22

3-
describe Codeship::Status do
3+
RSpec.describe Codeship::Status do
44

55
context 'parsing the project status', :vcr do
66
Codeship::Status::STATES.each do |state|
77
it "should parse #{state}" do
8-
project_status = Codeship::Status.new state
9-
project_status.status.should == state
8+
project_status = Codeship::Status.new(state)
9+
expect(project_status.status).to eq(state)
1010
end
1111
end
1212
end
1313

1414
context 'parsing the project status on a certain branch', :vcr do
1515
Codeship::Status::STATES.each do |state|
1616
it "should parse #{state}" do
17-
project_status = Codeship::Status.new state, branch: 'master'
18-
project_status.status.should == state
17+
project_status = Codeship::Status.new(state, branch: 'master')
18+
expect(project_status.status).to eq(state)
1919
end
2020
end
2121
end

0 commit comments

Comments
 (0)