Skip to content

Commit

Permalink
1.2.0 release
Browse files Browse the repository at this point in the history
- Fixes metadata passing problem
- Update version number
  • Loading branch information
palfvin committed Feb 6, 2015
1 parent 54c5088 commit 83d0ff5
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 16 deletions.
14 changes: 11 additions & 3 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
### 1.2.0 / 2015-02-06
[full changelog](http://github.com/rspec/rspec-its/compare/v1.1.0...v1.2.0)

Breaking Changes:

Enhancements:
* Introduced `are_expected` as alias for `is_expected`

Bug fixes:
* Restored ability to pass key/value metadata parameters, broken by https://github.com/rspec/rspec-its/commit/71307bc7051f482bfc2798daa390bee9142b0d5a

### 1.1.0 / 2014-04-13
[full changelog](http://github.com/rspec/rspec-its/compare/v1.0.1...v1.1.0)

Expand All @@ -22,17 +33,14 @@ Bug fixes:

Breaking Changes:


Enhancements:
* Add `is_expected` support to match RSpec 3.0

Deprecations:


Bug Fixes:
* Report failures and backtrace from client perspective


### 1.0.0.pre / 2013-10-11

Features
Expand Down
3 changes: 3 additions & 0 deletions features/its.feature
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ Feature: attribute of subject
context "when first created" do
its(:size) { should eq(0) }
end
it "should never execute this" do
expect(true).to be(false)
end
end
"""
When I run rspec specifying line number 2
Expand Down
4 changes: 3 additions & 1 deletion lib/rspec/its.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ def should_not(matcher=nil, message=nil)
RSpec::Expectations::NegativeExpectationHandler.handle_matcher(__its_subject, matcher, message)
end

options << { :caller => its_caller }
options << {} unless options.last.kind_of?(Hash)
options.last.merge!(:caller => its_caller)

example(nil, *options, &block)

end
Expand Down
2 changes: 1 addition & 1 deletion lib/rspec/its/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module RSpec
module Its
VERSION = "1.1.0"
VERSION = "1.2.0"
end
end
37 changes: 26 additions & 11 deletions spec/rspec/its_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module RSpec
describe "#its" do
context "with implicit subject" do
context "preserves described_class" do
its(:symbol) { expect(described_class).to be Its}
its(:symbol) { expect(described_class).to be Its }
its([]) { expect(described_class).to be Its }
end
end
Expand Down Expand Up @@ -53,20 +53,20 @@ def name
end
end.new
end
its("name") { should eq("John") }
its("name.size") { should eq(4) }
its("name") { should eq("John") }
its("name.size") { should eq(4) }
its("name.size.class") { should eq(Fixnum) }

context "using should_not" do
its("name") { should_not eq("Paul") }
its("name") { should_not eq("Paul") }
end

context "using is_expected" do
its("name") { is_expected.to eq("John") }
its("name") { is_expected.to eq("John") }
end

context "using are_expected" do
its("name.chars.to_a") { are_expected.to eq(%w[J o h n]) }
its("name.chars.to_a") { are_expected.to eq(%w[J o h n]) }
end
end

Expand Down Expand Up @@ -133,7 +133,9 @@ def name
its(:last) { should eq("a") }

describe '.first' do
def subject; super().first; end
def subject;
super().first;
end

its(:next) { should eq(2) }
end
Expand All @@ -149,6 +151,7 @@ def subject; super().first; end
def initialize
@counter = -1
end

def nil_if_first_time
@counter += 1
@counter == 0 ? nil : true
Expand All @@ -164,6 +167,7 @@ def nil_if_first_time
def initialize
@counter = -1
end

def false_if_first_time
@counter += 1
@counter > 0
Expand All @@ -189,8 +193,8 @@ def false_if_first_time

describe "in shared_context" do
shared_context "shared stuff" do
subject {Array}
its(:name) {should eq "Array"}
subject { Array }
its(:name) { should eq "Array" }
end

include_context "shared stuff"
Expand All @@ -215,8 +219,19 @@ def false_if_first_time
end
end
end
context "with metadata" do
context "preserves access to metadata that doesn't end in hash" do
its([], :foo) do |example|
expect(example.metadata[:foo]).to be(true)
end
end
context "preserves access to metadata that ends in hash" do
its([], :foo, :bar => 17) do |example|
expect(example.metadata[:foo]).to be(true)
expect(example.metadata[:bar]).to be(17)
end
end
end
end
end


end

0 comments on commit 83d0ff5

Please sign in to comment.