Skip to content

Commit

Permalink
Update rspec syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
coreyhaines committed Feb 14, 2015
1 parent 42358e6 commit 4b71408
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
12 changes: 6 additions & 6 deletions spec/active_record_integration_spec.rb
Expand Up @@ -10,11 +10,11 @@ class ActiveRecordDummyWithTokens

describe "Looking up by the tokens with for_<token_name>" do
it "calls the appropriate ActiveRecord finder" do
admin_version = stub
ActiveRecordDummyWithTokens.should_receive(:find_by_admin_token!).with("admin_token") { admin_version }
ActiveRecordDummyWithTokens.for_admin("admin_token").should be(admin_version)
public_version = stub
ActiveRecordDummyWithTokens.should_receive(:find_by_public_token!).with("public_token") { public_version }
ActiveRecordDummyWithTokens.for_public("public_token").should be(public_version)
admin_version = double
expect(ActiveRecordDummyWithTokens).to receive(:find_by_admin_token!).with("admin_token") { admin_version }
expect(ActiveRecordDummyWithTokens.for_admin("admin_token")).to be(admin_version)
public_version = double
expect(ActiveRecordDummyWithTokens).to receive(:find_by_public_token!).with("public_token") { public_version }
expect(ActiveRecordDummyWithTokens.for_public("public_token")).to be(public_version)
end
end
16 changes: 8 additions & 8 deletions spec/creating_tokens_spec.rb
Expand Up @@ -16,18 +16,18 @@ class WantsOneToken
end

it "sets the appropriate token property" do
tokened.public_token.should_not be_nil
expect(tokened.public_token).not_to be_nil
end

describe "the generated token" do
it 'is unique' do
tokened2 = WantsOneToken.new
tokened2.generate_tokens
tokened.public_token.should_not == tokened2.public_token
expect(tokened.public_token).not_to eq(tokened2.public_token)
end

it "has the length that was given" do
tokened.public_token.length.should == 5
expect(tokened.public_token.length).to eq(5)
end
end
end
Expand All @@ -47,19 +47,19 @@ class WantsMultipleTokens
end

it "sets all the token properties" do
tokened.public_token.should_not be_nil
tokened.admin_token.should_not be_nil
expect(tokened.public_token).not_to be_nil
expect(tokened.admin_token).not_to be_nil
end

it "has the length that was given for each token" do
tokened.public_token.length.should == 5
tokened.admin_token.length.should == 10
expect(tokened.public_token.length).to eq(5)
expect(tokened.admin_token.length).to eq(10)
end

it "does not over-write an existing token" do
tokened = WantsMultipleTokens.new
tokened.admin_token = "existing"
tokened.generate_tokens
tokened.admin_token.should eq("existing")
expect(tokened.admin_token).to eq("existing")
end
end

0 comments on commit 4b71408

Please sign in to comment.