Skip to content

Commit

Permalink
Update more rspec old style .should calls
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew committed Sep 25, 2014
1 parent d1984db commit 4f304c8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions spec/alternative_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,11 @@
end

it "should have a probability of being the winning alternative (p_winner)" do
alternative.p_winner.should_not be_nil
expect(alternative.p_winner).not_to be_nil
end

it "should have a probability of being the winner for each goal" do
alternative.p_winner(goal1).should_not be_nil
expect(alternative.p_winner(goal1)).not_to be_nil
end

it "should be possible to set the p_winner" do
Expand Down
2 changes: 1 addition & 1 deletion spec/encapsulated_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def params

describe "ab_test" do
it "should not raise an error when params raises an error" do
lambda { ab_test('link_color', 'blue', 'red') }.should_not raise_error
expect(lambda { ab_test('link_color', 'blue', 'red') }).not_to raise_error
end
end
end
8 changes: 4 additions & 4 deletions spec/experiment_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -381,13 +381,13 @@ def same_but_different_goals
it "should return a hash with the probability of each alternative being the best" do
experiment = Split::Experiment.find_or_create('mathematicians', 'bernoulli', 'poisson', 'lagrange')
experiment.calc_winning_alternatives
experiment.alternative_probabilities.should_not be_nil
expect(experiment.alternative_probabilities).not_to be_nil
end

it "should return between 46% and 54% probability for an experiment with 2 alternatives and no data" do
experiment = Split::Experiment.find_or_create('scientists', 'einstein', 'bohr')
experiment.calc_winning_alternatives
experiment.alternatives[0].p_winner.should be_within(0.04).of(0.50)
expect(experiment.alternatives[0].p_winner).to be_within(0.04).of(0.50)
end

it "should calculate the probability of being the winning alternative separately for each goal" do
Expand All @@ -403,8 +403,8 @@ def same_but_different_goals
alt = experiment.alternatives[0]
p_goal1 = alt.p_winner(goal1)
p_goal2 = alt.p_winner(goal2)
p_goal1.should_not be_within(0.04).of(p_goal2)
expect(p_goal1).not_to be_within(0.04).of(p_goal2)
end
end
end

end

0 comments on commit 4f304c8

Please sign in to comment.